hwc: Cleanup patch for SideSync and WFD/HDMI downscale feature
Move block of code corresponds to SideSync and WFD/HDMI downscale
feature to a seperate function.
Change-Id: Ib07cec61abf3a7226bc4dd2ebb9f313519114fd4
diff --git a/libhwcomposer/hwc_fbupdate.cpp b/libhwcomposer/hwc_fbupdate.cpp
index ab3561f..2337b2a 100644
--- a/libhwcomposer/hwc_fbupdate.cpp
+++ b/libhwcomposer/hwc_fbupdate.cpp
@@ -58,6 +58,30 @@
mDest = ovutils::OV_INVALID;
}
+bool FBUpdateLowRes::preRotateExtDisplay(hwc_context_t *ctx,
+ ovutils::Whf &info,
+ hwc_rect_t& sourceCrop,
+ ovutils::eMdpFlags& mdpFlags,
+ int& rotFlags)
+{
+ int extOrient = getExtOrientation(ctx);
+ ovutils::eTransform orient = static_cast<ovutils::eTransform >(extOrient);
+ if(mDpy && (extOrient & HWC_TRANSFORM_ROT_90)) {
+ mRot = ctx->mRotMgr->getNext();
+ if(mRot == NULL) return false;
+ //Configure rotator for pre-rotation
+ if(configRotator(mRot, info, sourceCrop, mdpFlags, orient, 0) < 0) {
+ ALOGE("%s: configRotator Failed!", __FUNCTION__);
+ mRot = NULL;
+ return false;
+ }
+ info.format = (mRot)->getDstFormat();
+ updateSource(orient, info, sourceCrop);
+ rotFlags |= ovutils::ROT_PREROTATED;
+ }
+ return true;
+}
+
bool FBUpdateLowRes::prepare(hwc_context_t *ctx, hwc_display_contents_1 *list,
int fbZorder) {
if(!ctx->mMDP.hasOverlay) {
@@ -117,9 +141,7 @@
ovutils::eTransform orient =
static_cast<ovutils::eTransform>(transform);
// use ext orientation if any
- int extOrient = ctx->mExtOrientation;
- if(ctx->mBufferMirrorMode)
- extOrient = getMirrorModeOrientation(ctx);
+ int extOrient = getExtOrientation(ctx);
// Do not use getNonWormholeRegion() function to calculate the
// sourceCrop during animation on external display and
@@ -137,32 +159,14 @@
displayFrame = sourceCrop;
}
}
- if(mDpy && !qdutils::MDPVersion::getInstance().is8x26()) {
- if(extOrient || ctx->dpyAttr[mDpy].mDownScaleMode) {
- calcExtDisplayPosition(ctx, mDpy, sourceCrop, displayFrame);
- // If there is a external orientation set, use that
- if(extOrient) {
- transform = extOrient;
- orient = static_cast<ovutils::eTransform >(extOrient);
- }
- }
- // Calculate the actionsafe dimensions for External(dpy = 1 or 2)
- getActionSafePosition(ctx, mDpy, displayFrame);
- }
+ calcExtDisplayPosition(ctx, hnd, mDpy, sourceCrop, displayFrame,
+ transform, orient);
setMdpFlags(layer, mdpFlags, 0, transform);
// For External use rotator if there is a rotation value set
- if(mDpy && (extOrient & HWC_TRANSFORM_ROT_90)) {
- mRot = ctx->mRotMgr->getNext();
- if(mRot == NULL) return -1;
- //Configure rotator for pre-rotation
- if(configRotator(mRot, info, sourceCrop, mdpFlags, orient, 0) < 0) {
- ALOGE("%s: configRotator Failed!", __FUNCTION__);
- mRot = NULL;
- return -1;
- }
- info.format = (mRot)->getDstFormat();
- updateSource(orient, info, sourceCrop);
- rotFlags |= ovutils::ROT_PREROTATED;
+ ret = preRotateExtDisplay(ctx, info, sourceCrop, mdpFlags, rotFlags);
+ if(!ret) {
+ ALOGE("%s: preRotate for external Failed!", __FUNCTION__);
+ return false;
}
//For the mdp, since either we are pre-rotating or MDP does flips
orient = ovutils::OVERLAY_TRANSFORM_0;