Merge "hwc: Refactor disable animation on external"

This commit is contained in:
Linux Build Service Account
2013-12-17 18:25:23 -08:00
committed by Gerrit - the friendly Code Review server
4 changed files with 27 additions and 91 deletions

View File

@@ -179,15 +179,6 @@ static int hwc_prepare_external(hwc_composer_device_1 *dev,
const int fbZ = 0;
ctx->mFBUpdate[dpy]->prepare(ctx, list, fbZ);
}
if(ctx->listStats[dpy].isDisplayAnimating) {
// Mark all app layers as HWC_OVERLAY for external during
// animation, so that SF doesnt draw it on FB
for(int i = 0 ;i < ctx->listStats[dpy].numAppLayers; i++) {
hwc_layer_1_t *layer = &list->hwLayers[i];
layer->compositionType = HWC_OVERLAY;
}
}
} else {
/* External Display is in Pause state.
* Mark all application layers as OVERLAY so that
@@ -220,15 +211,6 @@ static int hwc_prepare_virtual(hwc_composer_device_1 *dev,
const int fbZ = 0;
ctx->mFBUpdate[dpy]->prepare(ctx, list, fbZ);
}
if(ctx->listStats[dpy].isDisplayAnimating) {
// Mark all app layers as HWC_OVERLAY for virtual during
// animation, so that SF doesnt draw it on FB
for(int i = 0 ;i < ctx->listStats[dpy].numAppLayers; i++) {
hwc_layer_1_t *layer = &list->hwLayers[i];
layer->compositionType = HWC_OVERLAY;
}
}
} else {
/* Virtual Display is in Pause state.
* Mark all application layers as OVERLAY so that
@@ -309,8 +291,6 @@ static int hwc_eventControl(struct hwc_composer_device_1* dev, int dpy,
if(dpy == HWC_DISPLAY_PRIMARY) {
Locker::Autolock _l(ctx->mDrawLock);
// store the primary display orientation
// will be used in hwc_video::configure to disable
// rotation animation on external display
ctx->deviceOrientation = enable;
}
break;

View File

@@ -856,9 +856,7 @@ bool MDPComp::isOnlyVideoDoable(hwc_context_t *ctx,
/* Checks for conditions where YUV layers cannot be bypassed */
bool MDPComp::isYUVDoable(hwc_context_t* ctx, hwc_layer_1_t* layer) {
bool extAnimBlockFeature = mDpy && ctx->listStats[mDpy].isDisplayAnimating;
if(isSkipLayer(layer) && !extAnimBlockFeature) {
if(isSkipLayer(layer)) {
ALOGD_IF(isDebug(), "%s: Video marked SKIP dpy %d", __FUNCTION__, mDpy);
return false;
}
@@ -1078,15 +1076,6 @@ void MDPComp::updateLayerCache(hwc_context_t* ctx,
void MDPComp::updateYUV(hwc_context_t* ctx, hwc_display_contents_1_t* list,
bool secureOnly) {
int nYuvCount = ctx->listStats[mDpy].yuvCount;
if(!nYuvCount && mDpy) {
//Reset "No animation on external display" related parameters.
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;
return;
}
for(int index = 0;index < nYuvCount; index++){
int nYuvIndex = ctx->listStats[mDpy].yuvIndices[index];
hwc_layer_1_t* layer = &list->hwLayers[nYuvIndex];
@@ -1302,6 +1291,22 @@ int MDPComp::prepare(hwc_context_t *ctx, hwc_display_contents_1_t* list) {
return ret;
}
// Detect the start of animation and fall back to GPU only once to cache
// all the layers in FB and display FB content untill animation completes.
if(ctx->listStats[mDpy].isDisplayAnimating) {
mCurrentFrame.needsRedraw = false;
if(ctx->mAnimationState[mDpy] == ANIMATION_STOPPED) {
mCurrentFrame.needsRedraw = true;
ctx->mAnimationState[mDpy] = ANIMATION_STARTED;
}
setMDPCompLayerFlags(ctx, list);
mCachedFrame.updateCounts(mCurrentFrame);
ret = -1;
return ret;
} else {
ctx->mAnimationState[mDpy] = ANIMATION_STOPPED;
}
//Hard conditions, if not met, cannot do MDP comp
if(!isFrameDoable(ctx)) {
ALOGD_IF( isDebug(),"%s: MDP Comp not possible for this frame",

View File

@@ -172,6 +172,7 @@ void initContext(hwc_context_t *ctx)
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 @@ void initContext(hwc_context_t *ctx)
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();
@@ -1241,12 +1237,7 @@ int hwc_sync(hwc_context_t *ctx, hwc_display_contents_1_t* list, int dpy,
} 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);
@@ -1494,25 +1485,6 @@ int configureNonSplit(hwc_context_t *ctx, hwc_layer_1_t *layer,
}
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);
}
@@ -1623,28 +1595,6 @@ int configureSplit(hwc_context_t *ctx, hwc_layer_1_t *layer,
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) {

View File

@@ -410,6 +410,11 @@ inline void swap(T& a, T& b) {
}; //qhwc namespace
enum eAnimationState{
ANIMATION_STOPPED,
ANIMATION_STARTED,
};
// -----------------------------------------------------------------------------
// HWC context
// This structure contains overall state
@@ -440,14 +445,10 @@ struct hwc_context_t {
hwc_rect_t mViewFrame[HWC_NUM_DISPLAY_TYPES];
qhwc::AssertiveDisplay *mAD;
qhwc::VPUClient *mVPUClient;
eAnimationState mAnimationState[HWC_NUM_DISPLAY_TYPES];
// No animation on External display feature
// Notifies hwcomposer about the device orientation before animation.
// stores the primary device orientation
int deviceOrientation;
// Stores the crop, dest rect and transform value of video before animation.
hwc_rect_t mPrevCropVideo;
hwc_rect_t mPrevDestVideo;
int mPrevTransformVideo;
//Securing in progress indicator
bool mSecuring;
//WFD on proprietary stack