hwc: Refactor disable animation on external
Fall back to GPU for one cycle at the start of animation and display
the frame buffer for the subsequent cycle till animation ends.
Change-Id: I6c651cebaf4694f326d6e32ae485e014f391577c
diff --git a/libhwcomposer/hwc_utils.cpp b/libhwcomposer/hwc_utils.cpp
index 6f2cb9c..a36a944 100644
--- a/libhwcomposer/hwc_utils.cpp
+++ b/libhwcomposer/hwc_utils.cpp
@@ -172,6 +172,7 @@
for (uint32_t i = 0; i < HWC_NUM_DISPLAY_TYPES; i++) {
ctx->mHwcDebug[i] = new HwcDebug(i);
ctx->mLayerRotMap[i] = new LayerRotMap();
+ ctx->mAnimationState[i] = ANIMATION_STOPPED;
}
MDPComp::init(ctx);
@@ -189,13 +190,8 @@
defaultServiceManager()->getService(
String16("display.qservice")))->connect(client);
- // Initialize "No animation on external display" related parameters.
+ // Initialize device orientation to its default orientation
ctx->deviceOrientation = 0;
- ctx->mPrevCropVideo.left = ctx->mPrevCropVideo.top =
- ctx->mPrevCropVideo.right = ctx->mPrevCropVideo.bottom = 0;
- ctx->mPrevDestVideo.left = ctx->mPrevDestVideo.top =
- ctx->mPrevDestVideo.right = ctx->mPrevDestVideo.bottom = 0;
- ctx->mPrevTransformVideo = 0;
ctx->mBufferMirrorMode = false;
#ifdef VPU_TARGET
ctx->mVPUClient = new VPUClient();
@@ -1218,12 +1214,7 @@
} else if(isExtAnimating) {
// Release all the app layer fds immediately,
// if animation is in progress.
- hwc_layer_1_t const* layer = &list->hwLayers[i];
- private_handle_t *hnd = (private_handle_t *)layer->handle;
- if(isYuvBuffer(hnd)) {
- list->hwLayers[i].releaseFenceFd = dup(releaseFd);
- } else
- list->hwLayers[i].releaseFenceFd = -1;
+ list->hwLayers[i].releaseFenceFd = -1;
} else if(list->hwLayers[i].releaseFenceFd < 0) {
//If rotator has not already populated this field.
list->hwLayers[i].releaseFenceFd = dup(releaseFd);
@@ -1471,25 +1462,6 @@
}
if(dpy && isYuvBuffer(hnd)) {
- if(!ctx->listStats[dpy].isDisplayAnimating) {
- ctx->mPrevCropVideo = crop;
- ctx->mPrevDestVideo = dst;
- ctx->mPrevTransformVideo = transform;
- } else {
- // Restore the previous crop, dest rect and transform values, during
- // animation to avoid displaying videos at random coordinates.
- crop = ctx->mPrevCropVideo;
- dst = ctx->mPrevDestVideo;
- transform = ctx->mPrevTransformVideo;
- orient = static_cast<eTransform>(transform);
- //In you tube use case when a device rotated from landscape to
- // portrait, set the isFg flag and zOrder to avoid displaying UI on
- // hdmi during animation
- if(ctx->deviceOrientation) {
- isFg = ovutils::IS_FG_SET;
- z = ZORDER_1;
- }
- }
calcExtDisplayPosition(ctx, hnd, dpy, crop, dst,
transform, orient);
}
@@ -1603,28 +1575,6 @@
whf.format = getMdpFormat(HAL_PIXEL_FORMAT_BGRX_8888);
}
- if(dpy && isYuvBuffer(hnd)) {
- if(!ctx->listStats[dpy].isDisplayAnimating) {
- ctx->mPrevCropVideo = crop;
- ctx->mPrevDestVideo = dst;
- ctx->mPrevTransformVideo = transform;
- } else {
- // Restore the previous crop, dest rect and transform values, during
- // animation to avoid displaying videos at random coordinates.
- crop = ctx->mPrevCropVideo;
- dst = ctx->mPrevDestVideo;
- transform = ctx->mPrevTransformVideo;
- orient = static_cast<eTransform>(transform);
- //In you tube use case when a device rotated from landscape to
- // portrait, set the isFg flag and zOrder to avoid displaying UI on
- // hdmi during animation
- if(ctx->deviceOrientation) {
- isFg = ovutils::IS_FG_SET;
- z = ZORDER_1;
- }
- }
- }
-
setMdpFlags(layer, mdpFlagsL, 0, transform);
if(lDest != OV_INVALID && rDest != OV_INVALID) {