Merge "hwc: Refactor disable animation on external"
This commit is contained in:
committed by
Gerrit - the friendly Code Review server
commit
c25d39f9e9
@@ -179,15 +179,6 @@ static int hwc_prepare_external(hwc_composer_device_1 *dev,
|
|||||||
const int fbZ = 0;
|
const int fbZ = 0;
|
||||||
ctx->mFBUpdate[dpy]->prepare(ctx, list, fbZ);
|
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 {
|
} else {
|
||||||
/* External Display is in Pause state.
|
/* External Display is in Pause state.
|
||||||
* Mark all application layers as OVERLAY so that
|
* 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;
|
const int fbZ = 0;
|
||||||
ctx->mFBUpdate[dpy]->prepare(ctx, list, fbZ);
|
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 {
|
} else {
|
||||||
/* Virtual Display is in Pause state.
|
/* Virtual Display is in Pause state.
|
||||||
* Mark all application layers as OVERLAY so that
|
* 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) {
|
if(dpy == HWC_DISPLAY_PRIMARY) {
|
||||||
Locker::Autolock _l(ctx->mDrawLock);
|
Locker::Autolock _l(ctx->mDrawLock);
|
||||||
// store the primary display orientation
|
// store the primary display orientation
|
||||||
// will be used in hwc_video::configure to disable
|
|
||||||
// rotation animation on external display
|
|
||||||
ctx->deviceOrientation = enable;
|
ctx->deviceOrientation = enable;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -856,9 +856,7 @@ bool MDPComp::isOnlyVideoDoable(hwc_context_t *ctx,
|
|||||||
|
|
||||||
/* Checks for conditions where YUV layers cannot be bypassed */
|
/* Checks for conditions where YUV layers cannot be bypassed */
|
||||||
bool MDPComp::isYUVDoable(hwc_context_t* ctx, hwc_layer_1_t* layer) {
|
bool MDPComp::isYUVDoable(hwc_context_t* ctx, hwc_layer_1_t* layer) {
|
||||||
bool extAnimBlockFeature = mDpy && ctx->listStats[mDpy].isDisplayAnimating;
|
if(isSkipLayer(layer)) {
|
||||||
|
|
||||||
if(isSkipLayer(layer) && !extAnimBlockFeature) {
|
|
||||||
ALOGD_IF(isDebug(), "%s: Video marked SKIP dpy %d", __FUNCTION__, mDpy);
|
ALOGD_IF(isDebug(), "%s: Video marked SKIP dpy %d", __FUNCTION__, mDpy);
|
||||||
return false;
|
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,
|
void MDPComp::updateYUV(hwc_context_t* ctx, hwc_display_contents_1_t* list,
|
||||||
bool secureOnly) {
|
bool secureOnly) {
|
||||||
int nYuvCount = ctx->listStats[mDpy].yuvCount;
|
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++){
|
for(int index = 0;index < nYuvCount; index++){
|
||||||
int nYuvIndex = ctx->listStats[mDpy].yuvIndices[index];
|
int nYuvIndex = ctx->listStats[mDpy].yuvIndices[index];
|
||||||
hwc_layer_1_t* layer = &list->hwLayers[nYuvIndex];
|
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;
|
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
|
//Hard conditions, if not met, cannot do MDP comp
|
||||||
if(!isFrameDoable(ctx)) {
|
if(!isFrameDoable(ctx)) {
|
||||||
ALOGD_IF( isDebug(),"%s: MDP Comp not possible for this frame",
|
ALOGD_IF( isDebug(),"%s: MDP Comp not possible for this frame",
|
||||||
|
|||||||
@@ -172,6 +172,7 @@ void initContext(hwc_context_t *ctx)
|
|||||||
for (uint32_t i = 0; i < HWC_NUM_DISPLAY_TYPES; i++) {
|
for (uint32_t i = 0; i < HWC_NUM_DISPLAY_TYPES; i++) {
|
||||||
ctx->mHwcDebug[i] = new HwcDebug(i);
|
ctx->mHwcDebug[i] = new HwcDebug(i);
|
||||||
ctx->mLayerRotMap[i] = new LayerRotMap();
|
ctx->mLayerRotMap[i] = new LayerRotMap();
|
||||||
|
ctx->mAnimationState[i] = ANIMATION_STOPPED;
|
||||||
}
|
}
|
||||||
|
|
||||||
MDPComp::init(ctx);
|
MDPComp::init(ctx);
|
||||||
@@ -189,13 +190,8 @@ void initContext(hwc_context_t *ctx)
|
|||||||
defaultServiceManager()->getService(
|
defaultServiceManager()->getService(
|
||||||
String16("display.qservice")))->connect(client);
|
String16("display.qservice")))->connect(client);
|
||||||
|
|
||||||
// Initialize "No animation on external display" related parameters.
|
// Initialize device orientation to its default orientation
|
||||||
ctx->deviceOrientation = 0;
|
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;
|
ctx->mBufferMirrorMode = false;
|
||||||
#ifdef VPU_TARGET
|
#ifdef VPU_TARGET
|
||||||
ctx->mVPUClient = new VPUClient();
|
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) {
|
} else if(isExtAnimating) {
|
||||||
// Release all the app layer fds immediately,
|
// Release all the app layer fds immediately,
|
||||||
// if animation is in progress.
|
// if animation is in progress.
|
||||||
hwc_layer_1_t const* layer = &list->hwLayers[i];
|
list->hwLayers[i].releaseFenceFd = -1;
|
||||||
private_handle_t *hnd = (private_handle_t *)layer->handle;
|
|
||||||
if(isYuvBuffer(hnd)) {
|
|
||||||
list->hwLayers[i].releaseFenceFd = dup(releaseFd);
|
|
||||||
} else
|
|
||||||
list->hwLayers[i].releaseFenceFd = -1;
|
|
||||||
} else if(list->hwLayers[i].releaseFenceFd < 0) {
|
} else if(list->hwLayers[i].releaseFenceFd < 0) {
|
||||||
//If rotator has not already populated this field.
|
//If rotator has not already populated this field.
|
||||||
list->hwLayers[i].releaseFenceFd = dup(releaseFd);
|
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(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,
|
calcExtDisplayPosition(ctx, hnd, dpy, crop, dst,
|
||||||
transform, orient);
|
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);
|
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);
|
setMdpFlags(layer, mdpFlagsL, 0, transform);
|
||||||
|
|
||||||
if(lDest != OV_INVALID && rDest != OV_INVALID) {
|
if(lDest != OV_INVALID && rDest != OV_INVALID) {
|
||||||
|
|||||||
@@ -410,6 +410,11 @@ inline void swap(T& a, T& b) {
|
|||||||
|
|
||||||
}; //qhwc namespace
|
}; //qhwc namespace
|
||||||
|
|
||||||
|
enum eAnimationState{
|
||||||
|
ANIMATION_STOPPED,
|
||||||
|
ANIMATION_STARTED,
|
||||||
|
};
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// HWC context
|
// HWC context
|
||||||
// This structure contains overall state
|
// This structure contains overall state
|
||||||
@@ -440,14 +445,10 @@ struct hwc_context_t {
|
|||||||
hwc_rect_t mViewFrame[HWC_NUM_DISPLAY_TYPES];
|
hwc_rect_t mViewFrame[HWC_NUM_DISPLAY_TYPES];
|
||||||
qhwc::AssertiveDisplay *mAD;
|
qhwc::AssertiveDisplay *mAD;
|
||||||
qhwc::VPUClient *mVPUClient;
|
qhwc::VPUClient *mVPUClient;
|
||||||
|
eAnimationState mAnimationState[HWC_NUM_DISPLAY_TYPES];
|
||||||
|
|
||||||
// No animation on External display feature
|
// stores the primary device orientation
|
||||||
// Notifies hwcomposer about the device orientation before animation.
|
|
||||||
int deviceOrientation;
|
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
|
//Securing in progress indicator
|
||||||
bool mSecuring;
|
bool mSecuring;
|
||||||
//WFD on proprietary stack
|
//WFD on proprietary stack
|
||||||
|
|||||||
Reference in New Issue
Block a user