void ExternalDisplay::processUEventOnline(const char *str) { const char *s1 = str + (strlen(str)-strlen(DEVICE_NODE_FB1)); // check if it is for FB1 if(strncmp(s1,DEVICE_NODE_FB1, strlen(DEVICE_NODE_FB1))== 0) { if(isHDMIConfigured()) { // HDMI connect event. // Tear-down WFD if it is active. if(mExternalDisplay == EXTERN_DISPLAY_FB2) { closeFrameBuffer(); setExternalDisplay(EXTERN_DISPLAY_NONE); } readResolution(); //Get the best mode and set setResolution(getBestMode()); enableHDMIVsync(EXTERN_DISPLAY_FB1); } else { openFrameBuffer(EXTERN_DISPLAY_FB1); } setExternalDisplay(EXTERN_DISPLAY_FB1); } else if(strncmp(s1, DEVICE_NODE_FB2, strlen(DEVICE_NODE_FB2)) == 0) { // WFD connect event if(mExternalDisplay == EXTERN_DISPLAY_FB1) { // HDMI has higher priority. // Do Not Override. }else { // WFD is connected openFrameBuffer(EXTERN_DISPLAY_FB2); setExternalDisplay(EXTERN_DISPLAY_FB2); } } }
int HDMIDisplay::configure() { if(!openFrameBuffer()) { ALOGE("%s: Failed to open FB: %d", __FUNCTION__, mFbNum); return -1; } readCEUnderscanInfo(); readResolution(); // TODO: Move this to activate /* Used for changing the resolution * getUserMode will get the preferred * mode set thru adb shell */ mCurrentMode = getUserMode(); if (mCurrentMode == -1) { //Get the best mode and set mCurrentMode = getBestMode(); } setAttributes(); // set system property property_set("hw.hdmiON", "1"); // Read the system property to determine if downscale feature is enabled. char value[PROPERTY_VALUE_MAX]; mMDPDownscaleEnabled = false; if(property_get("sys.hwc.mdp_downscale_enabled", value, "false") && !strcmp(value, "true")) { mMDPDownscaleEnabled = true; } return 0; }
void ExternalDisplay::setEDIDMode(int resMode) { ALOGD_IF(DEBUG,"resMode=%d ", resMode); { Mutex::Autolock lock(mExtDispLock); setExternalDisplay(false); openFrameBuffer(mHdmiFbNum); setResolution(resMode); } setExternalDisplay(true, mHdmiFbNum); }
int VirtualDisplay::configure() { if(!openFrameBuffer()) return -1; if(ioctl(mFd, FBIOGET_VSCREENINFO, &mVInfo) < 0) { ALOGD("%s: FBIOGET_VSCREENINFO failed with %s", __FUNCTION__, strerror(errno)); return -1; } setAttributes(); return 0; }
void FramebufferBackend::init() { LogindIntegration *logind = LogindIntegration::self(); auto takeControl = [logind, this]() { if (logind->hasSessionControl()) { openFrameBuffer(); } else { logind->takeControl(); connect(logind, &LogindIntegration::hasSessionControlChanged, this, &FramebufferBackend::openFrameBuffer); } }; if (logind->isConnected()) { takeControl(); } else { connect(logind, &LogindIntegration::connectedChanged, this, takeControl); } VirtualTerminal::create(this); }
int ExternalDisplay::configureWFDDisplay() { int ret = 0; if(mConnectedFbNum == mHdmiFbNum) { ALOGE("%s: Cannot process WFD connection while HDMI is active", __FUNCTION__); return -1; } openFrameBuffer(mWfdFbNum); if(mFd == -1) return -1; ret = ioctl(mFd, FBIOGET_VSCREENINFO, &mVInfo); if(ret < 0) { ALOGD("In %s: FBIOGET_VSCREENINFO failed Err Str = %s", __FUNCTION__, strerror(errno)); } setDpyWfdAttr(); setExternalDisplay(true, mWfdFbNum); return 0; }
int ExternalDisplay::configureHDMIDisplay() { openFrameBuffer(mHdmiFbNum); if(mFd == -1) return -1; readCEUnderscanInfo(); readResolution(); // TODO: Move this to activate /* Used for changing the resolution * getUserMode will get the preferred * mode set thru adb shell */ int mode = getUserMode(); if (mode == -1) { //Get the best mode and set mode = getBestMode(); } setResolution(mode); setDpyHdmiAttr(); setExternalDisplay(true, mHdmiFbNum); return 0; }
void ExternalDisplay::setResolution(int ID) { struct fb_var_screeninfo info; int ret = 0; if (!openFrameBuffer(EXTERN_DISPLAY_FB1)) return; ret = ioctl(mFd, FBIOGET_VSCREENINFO, &mVInfo); if(ret < 0) { ALOGD("In %s: FBIOGET_VSCREENINFO failed Err Str = %s", __FUNCTION__, strerror(errno)); } ALOGD_IF(DEBUG, "%s: GET Info<ID=%d %dx%d (%d,%d,%d)," "(%d,%d,%d) %dMHz>", __FUNCTION__, mVInfo.reserved[3], mVInfo.xres, mVInfo.yres, mVInfo.right_margin, mVInfo.hsync_len, mVInfo.left_margin, mVInfo.lower_margin, mVInfo.vsync_len, mVInfo.upper_margin, mVInfo.pixclock/1000/1000); //If its a valid mode and its a new ID - update var_screeninfo if ((isValidMode(ID)) && mCurrentMode != ID) { const struct disp_mode_timing_type *mode = &supported_video_mode_lut[0]; unsigned count = sizeof(supported_video_mode_lut)/sizeof (*supported_video_mode_lut); for (unsigned int i = 0; i < count; ++i) { const struct disp_mode_timing_type *cur = &supported_video_mode_lut[i]; if (cur->video_format == ID) mode = cur; } mode->set_info(mVInfo); ALOGD_IF(DEBUG, "%s: SET Info<ID=%d => Info<ID=%d %dx %d" "(%d,%d,%d), (%d,%d,%d) %dMHz>", __FUNCTION__, ID, mVInfo.reserved[3], mVInfo.xres, mVInfo.yres, mVInfo.right_margin, mVInfo.hsync_len, mVInfo.left_margin, mVInfo.lower_margin, mVInfo.vsync_len, mVInfo.upper_margin, mVInfo.pixclock/1000/1000); mVInfo.activate = FB_ACTIVATE_NOW | FB_ACTIVATE_ALL | FB_ACTIVATE_FORCE; ret = ioctl(mFd, FBIOPUT_VSCREENINFO, &mVInfo); if(ret < 0) { ALOGD("In %s: FBIOPUT_VSCREENINFO failed Err Str = %s", __FUNCTION__, strerror(errno)); } mCurrentMode = ID; } //Powerup ret = ioctl(mFd, FBIOBLANK, FB_BLANK_UNBLANK); if(ret < 0) { ALOGD("In %s: FBIOBLANK failed Err Str = %s", __FUNCTION__, strerror(errno)); } ret = ioctl(mFd, FBIOGET_VSCREENINFO, &mVInfo); if(ret < 0) { ALOGD("In %s: FBIOGET_VSCREENINFO failed Err Str = %s", __FUNCTION__, strerror(errno)); } //Pan_Display ret = ioctl(mFd, FBIOPAN_DISPLAY, &mVInfo); if(ret < 0) { ALOGD("In %s: FBIOPAN_DISPLAY failed Err Str = %s", __FUNCTION__, strerror(errno)); } }