hwc: Support for windowboxing feature on external
1. This feature is targeted to remove any window/pillar boxing on
external display when zoom mode is enabled.
2. Preserve the aspect ratio of the external display by cropping and
upscaling the tagged video layer during video playback on external.
3. User can tag the layers to be displayed on external display.
4. Set sys.hwc.windowbox_feature to true to enable this feature
Assumptions & Limitation:
1. Tagged layers for external display will also be displayed on
primary display along with untagged layers
2. When zoom in mode is enabled, source crop left and source crop
top of a tagged video layer is always assumed to be set to
positive integer value. So pinch zoom feature or zooming in top
left corner of the video use case cannot be supported.
3. Except tagged video layers, all other tagged UI layers will
use GPU for composition on external display, So all tagged UI
layers cannot be secure layer.
4. Rotation animation cannot be supported for this feature.
Change-Id: I8b934cf616ec23b4359d0120f9a291178a2781c6
diff --git a/libhwcomposer/hwc_mdpcomp.cpp b/libhwcomposer/hwc_mdpcomp.cpp
index e24925a..5bd3392 100644
--- a/libhwcomposer/hwc_mdpcomp.cpp
+++ b/libhwcomposer/hwc_mdpcomp.cpp
@@ -710,6 +710,16 @@
const int numAppLayers = ctx->listStats[mDpy].numAppLayers;
int priDispW = ctx->dpyAttr[HWC_DISPLAY_PRIMARY].xres;
+ // This is a special mode which needs to be handled separately.
+ // Only AIV tagged layers will be displayed on external in this mode.
+ // This is applicable only for external display , Return false, so that
+ // this will be handled separately
+ if(ctx->mAIVVideoMode[mDpy]) {
+ ALOGD_IF(isDebug(), "%s: AIV Video Mode enabled dpy %d",
+ __FUNCTION__, mDpy);
+ return false;
+ }
+
// No Idle fall back, if secure display or secure RGB layers are present or
// if there's only a single layer being composed
if(sIdleFallBack && (!ctx->listStats[mDpy].secureUI &&
@@ -1251,8 +1261,55 @@
return true;
}
+bool MDPComp::tryAIVVideoMode(hwc_context_t *ctx,
+ hwc_display_contents_1_t* list) {
+ if(sSimulationFlags & MDPCOMP_AVOID_AIV_VIDEO_MODE)
+ return false;
+ if(!ctx->mAIVVideoMode[mDpy]) {
+ return false;
+ }
+ int numAppLayers = ctx->listStats[mDpy].numAppLayers;
+
+ mCurrentFrame.reset(numAppLayers);
+ updateAIVLayers(ctx, list);
+ int mdpCount = mCurrentFrame.mdpCount;
+
+ if(mdpCount == 0) {
+ reset(ctx);
+ return false;
+ }
+
+ if(mCurrentFrame.fbCount) {
+ mCurrentFrame.fbZ = mCurrentFrame.mdpCount;
+ }
+
+ if(sEnableYUVsplit){
+ adjustForSourceSplit(ctx, list);
+ }
+
+ if(!postHeuristicsHandling(ctx, list)) {
+ ALOGD_IF(isDebug(), "post heuristic handling failed");
+ reset(ctx);
+ return false;
+ }
+
+ ALOGD_IF(sSimulationFlags,"%s: AIV_VIDEO_MODE_COMP SUCCEEDED",
+ __FUNCTION__);
+ return true;
+}
+
bool MDPComp::tryVideoOnly(hwc_context_t *ctx,
hwc_display_contents_1_t* list) {
+ // This is a special mode which needs to be handled separately.
+ // Only AIV tagged layers will be displayed on external in this mode.
+ // This is applicable only for external display , Return false, so that
+ // this will be handled separately
+ if(ctx->mAIVVideoMode[mDpy]) {
+ ALOGD_IF(isDebug(), "%s: AIV Video Mode enabled dpy %d",
+ __FUNCTION__, mDpy);
+ return false;
+ }
+
const bool secureOnly = true;
return videoOnlyComp(ctx, list, not secureOnly) or
videoOnlyComp(ctx, list, secureOnly);
@@ -1302,6 +1359,16 @@
/* if tryFullFrame fails, try to push all video and secure RGB layers to MDP */
bool MDPComp::tryMDPOnlyLayers(hwc_context_t *ctx,
hwc_display_contents_1_t* list) {
+ // This is a special mode which needs to be handled separately.
+ // Only AIV tagged layers will be displayed on external in this mode.
+ // This is applicable only for external display , Return false, so that
+ // this will be handled separately
+ if(ctx->mAIVVideoMode[mDpy]) {
+ ALOGD_IF(isDebug(), "%s: AIV Video Mode enabled dpy %d",
+ __FUNCTION__, mDpy);
+ return false;
+ }
+
const bool secureOnly = true;
return mdpOnlyLayersComp(ctx, list, not secureOnly) or
mdpOnlyLayersComp(ctx, list, secureOnly);
@@ -1598,6 +1665,29 @@
__FUNCTION__, frame.mdpCount, frame.fbCount, frame.dropCount);
}
+// Mark AIV layers for composition and drop other non-AIV layers.
+void MDPComp::updateAIVLayers(hwc_context_t* ctx,
+ hwc_display_contents_1_t* list) {
+ for (size_t i = 0; i < (size_t)ctx->listStats[mDpy].numAppLayers; i++) {
+ hwc_layer_1_t * layer = &list->hwLayers[i];
+ if(isAIVVideoLayer(layer)) {
+ if(isYUVDoable(ctx, layer)) {
+ mCurrentFrame.isFBComposed[i] = false;
+ mCurrentFrame.fbCount--;
+ }
+ } else if(!isAIVCCLayer(layer)) {
+ mCurrentFrame.dropCount++;
+ mCurrentFrame.drop[i] = true;
+ }
+ }
+ mCurrentFrame.fbCount -= mCurrentFrame.dropCount;
+ mCurrentFrame.mdpCount = mCurrentFrame.layerCount -
+ mCurrentFrame.fbCount - mCurrentFrame.dropCount;
+ ALOGD_IF(isDebug(),"%s: fb count: %d mdp count %d drop count %d",
+ __FUNCTION__, mCurrentFrame.fbCount, mCurrentFrame.mdpCount,
+ mCurrentFrame.dropCount);
+}
+
void MDPComp::updateYUV(hwc_context_t* ctx, hwc_display_contents_1_t* list,
bool secureOnly, FrameInfo& frame) {
int nYuvCount = ctx->listStats[mDpy].yuvCount;
@@ -1877,7 +1967,7 @@
// if tryFullFrame fails, try to push all video and secure RGB layers
// to MDP for composition.
mModeOn = tryFullFrame(ctx, list) || tryMDPOnlyLayers(ctx, list) ||
- tryVideoOnly(ctx, list);
+ tryVideoOnly(ctx, list) || tryAIVVideoMode(ctx, list);
if(mModeOn) {
setMDPCompLayerFlags(ctx, list);
} else {
@@ -2564,6 +2654,10 @@
else if (hnd->format == HAL_PIXEL_FORMAT_RGBX_8888)
whf.format = getMdpFormat(HAL_PIXEL_FORMAT_BGRX_8888);
}
+ // update source crop and destination position of AIV video layer.
+ if(ctx->mAIVVideoMode[mDpy] &&isYuvBuffer(hnd)) {
+ updateExtDisplayCoordinates(ctx, crop, dst, mDpy);
+ }
/* Calculate the external display position based on MDP downscale,
ActionSafe, and extorientation features. */
calcExtDisplayPosition(ctx, hnd, mDpy, crop, dst, transform, orient);