diff options
author | Ethan Chen <intervigil@gmail.com> | 2016-03-16 16:56:36 -0700 |
---|---|---|
committer | Ethan Chen <intervigil@gmail.com> | 2016-03-16 16:56:36 -0700 |
commit | 1605e822fda6d6ac9c3c72d8fb2413ac24128fba (patch) | |
tree | a7b4fbedcef8ec8c5835807039c3dea12e3b612e | |
parent | a74edfb82460eeb6387b68b4c027caea05590f50 (diff) | |
parent | 7b9a3a1efc9d6aaad411543ae0ca670d1ec9f3e8 (diff) | |
download | android_hardware_qcom_display-stable/cm-13.0-caf-8952-ZNH2KB.tar.gz android_hardware_qcom_display-stable/cm-13.0-caf-8952-ZNH2KB.tar.bz2 android_hardware_qcom_display-stable/cm-13.0-caf-8952-ZNH2KB.zip |
Merge remote-tracking branch 'caf/LA.BR.1.3.3_rb1.12' into cm-13.0-caf-8952stable/cm-13.0-caf-8952-ZNH5Ystable/cm-13.0-caf-8952-ZNH2KBstable/cm-13.0-caf-8952-ZNH2K
-rw-r--r-- | libhwcomposer/hwc.cpp | 31 | ||||
-rw-r--r-- | libhwcomposer/hwc_utils.cpp | 126 | ||||
-rw-r--r-- | liboverlay/overlayCursor.cpp | 2 | ||||
-rw-r--r-- | libqdutils/mdp_version.cpp | 4 |
4 files changed, 99 insertions, 64 deletions
diff --git a/libhwcomposer/hwc.cpp b/libhwcomposer/hwc.cpp index 1df014300..701200534 100644 --- a/libhwcomposer/hwc.cpp +++ b/libhwcomposer/hwc.cpp @@ -48,6 +48,7 @@ using namespace qQdcm; #define VSYNC_DEBUG 0 #define POWER_MODE_DEBUG 1 +#define CURSOR_DEBUG 0 static int hwc_device_open(const struct hw_module_t* module, const char* name, @@ -471,6 +472,17 @@ static int hwc_setCursorPositionAsync(struct hwc_composer_device_1* dev, int dpy, int x, int y) { int ret = -1; hwc_context_t* ctx = (hwc_context_t*)(dev); + + if(!validDisplay(dpy)) { + return -EINVAL; + } + + if((x < 0) || (x > (int)ctx->dpyAttr[dpy].xres) || + (y < 0) || (y > (int)ctx->dpyAttr[dpy].yres)) { + ALOGD_IF(CURSOR_DEBUG, "%s: Invalid cursor position x=%d y=%d", + __FUNCTION__,x,y); + return 0; + } switch(dpy) { case HWC_DISPLAY_PRIMARY: { @@ -893,25 +905,6 @@ int hwc_getDisplayAttributes(struct hwc_composer_device_1* dev, int disp, return -EINVAL; } - //From HWComposer - static const uint32_t DISPLAY_ATTRIBUTES[] = { - HWC_DISPLAY_VSYNC_PERIOD, - HWC_DISPLAY_WIDTH, - HWC_DISPLAY_HEIGHT, - HWC_DISPLAY_DPI_X, - HWC_DISPLAY_DPI_Y, -#ifdef GET_DISPLAY_SECURE_STATUS_FROM_HWC - HWC_DISPLAY_SECURE, -#endif -#ifdef GET_FRAMEBUFFER_FORMAT_FROM_HWC - HWC_DISPLAY_FBFORMAT, -#endif - HWC_DISPLAY_NO_ATTRIBUTE, - }; - - const size_t NUM_DISPLAY_ATTRIBUTES = (sizeof(DISPLAY_ATTRIBUTES) / - sizeof(DISPLAY_ATTRIBUTES)[0]); - uint32_t xres = 0, yres = 0, refresh = 0, fps = 0; int ret = 0; if (hotPluggable) { diff --git a/libhwcomposer/hwc_utils.cpp b/libhwcomposer/hwc_utils.cpp index 4792d7545..39eaeb768 100644 --- a/libhwcomposer/hwc_utils.cpp +++ b/libhwcomposer/hwc_utils.cpp @@ -2939,11 +2939,30 @@ void processBootAnimCompleted(hwc_context_t *ctx, * HWC_GEOMETRY_CHANGED fail in correctly identifying the * exact bootup transition to homescreen */ - - if(list->numHwLayers > numBootUpLayers) { - // Applying default mode after bootanimation is finished + char cryptoState[PROPERTY_VALUE_MAX]; + char voldDecryptState[PROPERTY_VALUE_MAX]; + bool isEncrypted = false; + bool main_class_services_started = false; + if(property_get("ro.crypto.state", cryptoState, "unencrypted")) { + ALOGD_IF(HWC_UTILS_DEBUG, "%s: cryptostate= %s", \ + __FUNCTION__, cryptoState); + if(!strcmp(cryptoState, "encrypted")) { + isEncrypted = true; + if(property_get("vold.decrypt", voldDecryptState, "") && + !strcmp(voldDecryptState, "trigger_restart_framework")) + main_class_services_started = true; + + ALOGD_IF(HWC_UTILS_DEBUG, "%s: vold= %s", __FUNCTION__, \ + voldDecryptState); + } + } + if((!isEncrypted ||(isEncrypted && main_class_services_started)) && + (list->numHwLayers > numBootUpLayers)) { + // Applying default mode after bootanimation is finished And + // If Data is Encrypted, it is ready for access. ctx->mBootAnimCompleted = true; qdcmApplyDefaultAfterBootAnimationDone(ctx); + ALOGD_IF(HWC_UTILS_DEBUG, "%s: SettingDefaultMode ", __FUNCTION__); } } @@ -3093,53 +3112,84 @@ hwc_rect_t getSanitizeROI(struct hwc_rect roi, hwc_rect boundary) const int HEIGHT_ALIGN = qdutils::MDPVersion::getInstance().getHeightAlign(); int MIN_WIDTH = qdutils::MDPVersion::getInstance().getMinROIWidth(); const int MIN_HEIGHT = qdutils::MDPVersion::getInstance().getMinROIHeight(); + bool isPingPongSplitEnabled = + (qdutils::MDPVersion::getInstance().is8976() && + qdutils::MDPVersion::getInstance().isPingPongSplit()); + /* Assumptions: + * LEFT_ALIGN, WIDTH_ALIGN, TOP_ALIGN, HEIGHT_ALIGN are typically even */ - - if(qdutils::MDPVersion::getInstance().is8976() && - qdutils::MDPVersion::getInstance().isPingPongSplit() && - (t_roi.left < (boundary.right - boundary.left) / 2) && - (t_roi.right > (boundary.right - boundary.left) / 2)) { + if(isPingPongSplitEnabled) { MIN_WIDTH *= 2; - if(((boundary.right - boundary.left) / 2 - t_roi.left) > - (t_roi.right - (boundary.right - boundary.left) / 2)) { - t_roi.right = (boundary.right - boundary.left) - t_roi.left; + const int boundarywidth = (boundary.right - boundary.left); + if(t_roi.left > boundarywidth/2) { + /* roi-left should be left of boundarywidth */ + t_roi.left = boundarywidth - t_roi.left; + } + if(t_roi.right < boundarywidth/2) { + /* roi-right should be right of boundarywidth */ + t_roi.right = boundarywidth - t_roi.right; + } + + if((boundarywidth/2 - t_roi.left) > (t_roi.right - boundarywidth/2)) { + t_roi.right = boundarywidth - t_roi.left; } else { - t_roi.left = (boundary.right - boundary.left) - t_roi.right; + t_roi.left = boundarywidth - t_roi.right; } } - /* Align to minimum width recommended by the panel */ + + /* Ensure roi is of minimum width recommended by the panel */ if((t_roi.right - t_roi.left) < MIN_WIDTH) { const int corWidth = MIN_WIDTH - (t_roi.right - t_roi.left); t_roi.left = t_roi.left - (corWidth >> 1); t_roi.right = t_roi.right + (corWidth >> 1) + (corWidth & 1); + if(isPingPongSplitEnabled) + t_roi.left -= (corWidth & 1); if(t_roi.left < boundary.left) { t_roi.left = boundary.left; - t_roi.right = t_roi.left + MIN_WIDTH; + if(isPingPongSplitEnabled) + t_roi.right = boundary.right; + else + t_roi.right = t_roi.left + MIN_WIDTH; } else if(t_roi.right > boundary.right) { t_roi.right = boundary.right; - t_roi.left = t_roi.right - MIN_WIDTH; + if(isPingPongSplitEnabled) + t_roi.left = boundary.left; + else + t_roi.left = t_roi.right - MIN_WIDTH; } } - /* Align to minimum height recommended by the panel */ + /* Ensuire roi is of minimum height recommended by the panel */ if((t_roi.bottom - t_roi.top) < MIN_HEIGHT) { const int corHeight = MIN_HEIGHT - (t_roi.bottom - t_roi.top); t_roi.top = t_roi.top - (corHeight >> 1); t_roi.bottom = t_roi.bottom + (corHeight >> 1) + (corHeight & 1); + if(isPingPongSplitEnabled) + t_roi.top -= (corHeight & 1); if(t_roi.top < boundary.top) { t_roi.top = boundary.top; - t_roi.bottom = t_roi.top + MIN_HEIGHT; + if(isPingPongSplitEnabled) + t_roi.bottom = boundary.bottom; + else + t_roi.bottom = t_roi.top + MIN_HEIGHT; } else if(t_roi.bottom > boundary.bottom) { t_roi.bottom = boundary.bottom; - t_roi.top = t_roi.bottom - MIN_HEIGHT; + if(isPingPongSplitEnabled) + t_roi.top = boundary.top; + else + t_roi.top = t_roi.bottom - MIN_HEIGHT; } } /* Align left and width to meet panel restrictions */ - if(LEFT_ALIGN) - t_roi.left = t_roi.left - (t_roi.left % LEFT_ALIGN); + if(LEFT_ALIGN) { + const int alignedWidthDiff = (t_roi.left % LEFT_ALIGN); + t_roi.left -= alignedWidthDiff; + if(isPingPongSplitEnabled) + t_roi.right += alignedWidthDiff; + } if(WIDTH_ALIGN) { int width = t_roi.right - t_roi.left; @@ -3152,24 +3202,22 @@ hwc_rect_t getSanitizeROI(struct hwc_rect roi, hwc_rect boundary) if(LEFT_ALIGN && (t_roi.left % LEFT_ALIGN)) { int errLeft = t_roi.left % LEFT_ALIGN; t_roi.left = t_roi.left - errLeft; - t_roi.right = t_roi.right + LEFT_ALIGN - errLeft; + t_roi.right = t_roi.right + WIDTH_ALIGN - errLeft; } - if(t_roi.right > boundary.right) { - t_roi.right = boundary.right; - t_roi.left = t_roi.right - alignWidth; - - if(LEFT_ALIGN) - t_roi.left = t_roi.left - (t_roi.left % LEFT_ALIGN); - - } else if(t_roi.left < boundary.left) { + if(t_roi.right > boundary.right || t_roi.left < boundary.left) { + //Give up and go for complete width t_roi.left = boundary.left; - t_roi.right = t_roi.left + alignWidth; + t_roi.right = boundary.right; } } /* Align top and height to meet panel restrictions */ - if(TOP_ALIGN) - t_roi.top = t_roi.top - (t_roi.top % TOP_ALIGN); + if(TOP_ALIGN) { + const int alignedHeightDiff = (t_roi.top % TOP_ALIGN); + t_roi.top -= alignedHeightDiff; + if(isPingPongSplitEnabled) + t_roi.bottom += alignedHeightDiff; + } if(HEIGHT_ALIGN) { int height = t_roi.bottom - t_roi.top; @@ -3182,18 +3230,12 @@ hwc_rect_t getSanitizeROI(struct hwc_rect roi, hwc_rect boundary) if(TOP_ALIGN && (t_roi.top % TOP_ALIGN)) { int errTop = t_roi.top % TOP_ALIGN; t_roi.top = t_roi.top - errTop; - t_roi.bottom = t_roi.bottom + TOP_ALIGN - errTop; + t_roi.bottom = t_roi.bottom + HEIGHT_ALIGN - errTop; } - if(t_roi.bottom > boundary.bottom) { - t_roi.bottom = boundary.bottom; - t_roi.top = t_roi.bottom - alignHeight; - - if(TOP_ALIGN) - t_roi.top = t_roi.top - (t_roi.top % TOP_ALIGN); - - } else if(t_roi.top < boundary.top) { + if(t_roi.bottom > boundary.bottom || t_roi.top < boundary.top) { + //Give up and go for complete height t_roi.top = boundary.top; - t_roi.bottom = t_roi.top + alignHeight; + t_roi.bottom = boundary.bottom; } } diff --git a/liboverlay/overlayCursor.cpp b/liboverlay/overlayCursor.cpp index 96190e4ed..2bf09c84d 100644 --- a/liboverlay/overlayCursor.cpp +++ b/liboverlay/overlayCursor.cpp @@ -101,7 +101,7 @@ bool HWCursor::free(const int fd) { } cursor->enable = (uint16_t)0; - + cursor->set = 0; if (!setCursor(fd)) { ALOGE("%s: Failed to free cursor hw", __FUNCTION__); ret = false; diff --git a/libqdutils/mdp_version.cpp b/libqdutils/mdp_version.cpp index b4fc86fcc..b0e7cb62b 100644 --- a/libqdutils/mdp_version.cpp +++ b/libqdutils/mdp_version.cpp @@ -262,8 +262,8 @@ void MDPVersion::updatePanelInfo() { mPanelInfo.mPluggable = atoi(tokens[1]); ALOGI("Pluggable: %d", mPanelInfo.mPluggable); } - if(!strncmp(tokens[0], "is_pinpong_split", - strlen("is_pinpong_split"))) { + if(!strncmp(tokens[0], "is_pingpong_split", + strlen("is_pingpong_split"))) { mPanelInfo.mPingPongSplit = atoi(tokens[1]); ALOGI("PingPong Split: %d", mPanelInfo.mPingPongSplit); } |