hwc: Refactor windowboxing feature
1. Remove AIV video mode composition stratergy and reuse video only composition stratergy to achieve the same functionality. 2. Drop all non AIV layers from the external list at the start of MDP composition prepare and fall back to video only composition. Change-Id: I34760e2df57cfbb923a6be0182e632c9ddd6aa07
This commit is contained in:
@@ -710,11 +710,8 @@ bool MDPComp::tryFullFrame(hwc_context_t *ctx,
|
|||||||
const int numAppLayers = ctx->listStats[mDpy].numAppLayers;
|
const int numAppLayers = ctx->listStats[mDpy].numAppLayers;
|
||||||
int priDispW = ctx->dpyAttr[HWC_DISPLAY_PRIMARY].xres;
|
int priDispW = ctx->dpyAttr[HWC_DISPLAY_PRIMARY].xres;
|
||||||
|
|
||||||
// This is a special mode which needs to be handled separately.
|
// Fall back to video only composition, if AIV video mode is enabled
|
||||||
// Only AIV tagged layers will be displayed on external in this mode.
|
if(ctx->listStats[mDpy].mAIVVideoMode) {
|
||||||
// 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",
|
ALOGD_IF(isDebug(), "%s: AIV Video Mode enabled dpy %d",
|
||||||
__FUNCTION__, mDpy);
|
__FUNCTION__, mDpy);
|
||||||
return false;
|
return false;
|
||||||
@@ -1261,55 +1258,8 @@ bool MDPComp::canPartialUpdate(hwc_context_t *ctx,
|
|||||||
return true;
|
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,
|
bool MDPComp::tryVideoOnly(hwc_context_t *ctx,
|
||||||
hwc_display_contents_1_t* list) {
|
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;
|
const bool secureOnly = true;
|
||||||
return videoOnlyComp(ctx, list, not secureOnly) or
|
return videoOnlyComp(ctx, list, not secureOnly) or
|
||||||
videoOnlyComp(ctx, list, secureOnly);
|
videoOnlyComp(ctx, list, secureOnly);
|
||||||
@@ -1359,11 +1309,8 @@ bool MDPComp::videoOnlyComp(hwc_context_t *ctx,
|
|||||||
/* if tryFullFrame fails, try to push all video and secure RGB layers to MDP */
|
/* if tryFullFrame fails, try to push all video and secure RGB layers to MDP */
|
||||||
bool MDPComp::tryMDPOnlyLayers(hwc_context_t *ctx,
|
bool MDPComp::tryMDPOnlyLayers(hwc_context_t *ctx,
|
||||||
hwc_display_contents_1_t* list) {
|
hwc_display_contents_1_t* list) {
|
||||||
// This is a special mode which needs to be handled separately.
|
// Fall back to video only composition, if AIV video mode is enabled
|
||||||
// Only AIV tagged layers will be displayed on external in this mode.
|
if(ctx->listStats[mDpy].mAIVVideoMode) {
|
||||||
// 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",
|
ALOGD_IF(isDebug(), "%s: AIV Video Mode enabled dpy %d",
|
||||||
__FUNCTION__, mDpy);
|
__FUNCTION__, mDpy);
|
||||||
return false;
|
return false;
|
||||||
@@ -1665,17 +1612,12 @@ void MDPComp::updateLayerCache(hwc_context_t* ctx,
|
|||||||
__FUNCTION__, frame.mdpCount, frame.fbCount, frame.dropCount);
|
__FUNCTION__, frame.mdpCount, frame.fbCount, frame.dropCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mark AIV layers for composition and drop other non-AIV layers.
|
// drop other non-AIV layers from external display list.
|
||||||
void MDPComp::updateAIVLayers(hwc_context_t* ctx,
|
void MDPComp::dropNonAIVLayers(hwc_context_t* ctx,
|
||||||
hwc_display_contents_1_t* list) {
|
hwc_display_contents_1_t* list) {
|
||||||
for (size_t i = 0; i < (size_t)ctx->listStats[mDpy].numAppLayers; i++) {
|
for (size_t i = 0; i < (size_t)ctx->listStats[mDpy].numAppLayers; i++) {
|
||||||
hwc_layer_1_t * layer = &list->hwLayers[i];
|
hwc_layer_1_t * layer = &list->hwLayers[i];
|
||||||
if(isAIVVideoLayer(layer)) {
|
if(!(isAIVVideoLayer(layer) || isAIVCCLayer(layer))) {
|
||||||
if(isYUVDoable(ctx, layer)) {
|
|
||||||
mCurrentFrame.isFBComposed[i] = false;
|
|
||||||
mCurrentFrame.fbCount--;
|
|
||||||
}
|
|
||||||
} else if(!isAIVCCLayer(layer)) {
|
|
||||||
mCurrentFrame.dropCount++;
|
mCurrentFrame.dropCount++;
|
||||||
mCurrentFrame.drop[i] = true;
|
mCurrentFrame.drop[i] = true;
|
||||||
}
|
}
|
||||||
@@ -1695,6 +1637,10 @@ void MDPComp::updateYUV(hwc_context_t* ctx, hwc_display_contents_1_t* list,
|
|||||||
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];
|
||||||
|
|
||||||
|
if(mCurrentFrame.drop[nYuvIndex]) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if(!isYUVDoable(ctx, layer)) {
|
if(!isYUVDoable(ctx, layer)) {
|
||||||
if(!frame.isFBComposed[nYuvIndex]) {
|
if(!frame.isFBComposed[nYuvIndex]) {
|
||||||
frame.isFBComposed[nYuvIndex] = true;
|
frame.isFBComposed[nYuvIndex] = true;
|
||||||
@@ -1963,11 +1909,16 @@ int MDPComp::prepare(hwc_context_t *ctx, hwc_display_contents_1_t* list) {
|
|||||||
//Hard conditions, if not met, cannot do MDP comp
|
//Hard conditions, if not met, cannot do MDP comp
|
||||||
if(isFrameDoable(ctx)) {
|
if(isFrameDoable(ctx)) {
|
||||||
generateROI(ctx, list);
|
generateROI(ctx, list);
|
||||||
|
// if AIV Video mode is enabled, drop all non AIV layers from the
|
||||||
|
// external display list.
|
||||||
|
if(ctx->listStats[mDpy].mAIVVideoMode) {
|
||||||
|
dropNonAIVLayers(ctx, list);
|
||||||
|
}
|
||||||
|
|
||||||
// if tryFullFrame fails, try to push all video and secure RGB layers
|
// if tryFullFrame fails, try to push all video and secure RGB layers
|
||||||
// to MDP for composition.
|
// to MDP for composition.
|
||||||
mModeOn = tryFullFrame(ctx, list) || tryMDPOnlyLayers(ctx, list) ||
|
mModeOn = tryFullFrame(ctx, list) || tryMDPOnlyLayers(ctx, list) ||
|
||||||
tryVideoOnly(ctx, list) || tryAIVVideoMode(ctx, list);
|
tryVideoOnly(ctx, list);
|
||||||
if(mModeOn) {
|
if(mModeOn) {
|
||||||
setMDPCompLayerFlags(ctx, list);
|
setMDPCompLayerFlags(ctx, list);
|
||||||
} else {
|
} else {
|
||||||
@@ -2655,8 +2606,8 @@ int MDPCompSrcSplit::configure(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);
|
||||||
}
|
}
|
||||||
// update source crop and destination position of AIV video layer.
|
// update source crop and destination position of AIV video layer.
|
||||||
if(ctx->mAIVVideoMode[mDpy] &&isYuvBuffer(hnd)) {
|
if(ctx->listStats[mDpy].mAIVVideoMode && isYuvBuffer(hnd)) {
|
||||||
updateExtDisplayCoordinates(ctx, crop, dst, mDpy);
|
updateCoordinates(ctx, crop, dst, mDpy);
|
||||||
}
|
}
|
||||||
/* Calculate the external display position based on MDP downscale,
|
/* Calculate the external display position based on MDP downscale,
|
||||||
ActionSafe, and extorientation features. */
|
ActionSafe, and extorientation features. */
|
||||||
|
|||||||
@@ -75,7 +75,6 @@ protected:
|
|||||||
MDPCOMP_AVOID_LOAD_MDP = 0x004,
|
MDPCOMP_AVOID_LOAD_MDP = 0x004,
|
||||||
MDPCOMP_AVOID_VIDEO_ONLY = 0x008,
|
MDPCOMP_AVOID_VIDEO_ONLY = 0x008,
|
||||||
MDPCOMP_AVOID_MDP_ONLY_LAYERS = 0x010,
|
MDPCOMP_AVOID_MDP_ONLY_LAYERS = 0x010,
|
||||||
MDPCOMP_AVOID_AIV_VIDEO_MODE = 0x020,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* mdp pipe data */
|
/* mdp pipe data */
|
||||||
@@ -188,8 +187,6 @@ protected:
|
|||||||
bool loadBasedComp(hwc_context_t *ctx, hwc_display_contents_1_t* list);
|
bool loadBasedComp(hwc_context_t *ctx, hwc_display_contents_1_t* list);
|
||||||
/* Checks if its worth doing load based partial comp */
|
/* Checks if its worth doing load based partial comp */
|
||||||
bool isLoadBasedCompDoable(hwc_context_t *ctx);
|
bool isLoadBasedCompDoable(hwc_context_t *ctx);
|
||||||
/* checks for conditions where AIV layers cannot be bypassed */
|
|
||||||
bool tryAIVVideoMode(hwc_context_t *ctx, hwc_display_contents_1_t* list);
|
|
||||||
/* checks for conditions where only video can be bypassed */
|
/* checks for conditions where only video can be bypassed */
|
||||||
bool tryVideoOnly(hwc_context_t *ctx, hwc_display_contents_1_t* list);
|
bool tryVideoOnly(hwc_context_t *ctx, hwc_display_contents_1_t* list);
|
||||||
bool videoOnlyComp(hwc_context_t *ctx, hwc_display_contents_1_t* list,
|
bool videoOnlyComp(hwc_context_t *ctx, hwc_display_contents_1_t* list,
|
||||||
@@ -225,8 +222,8 @@ protected:
|
|||||||
bool intersectingUpdatingLayers(const hwc_display_contents_1_t* list,
|
bool intersectingUpdatingLayers(const hwc_display_contents_1_t* list,
|
||||||
int fromIndex, int toIndex, int targetLayerIndex);
|
int fromIndex, int toIndex, int targetLayerIndex);
|
||||||
|
|
||||||
/* Mark AIV layers for composition and drop other non-AIV layers.*/
|
/* drop other non-AIV layers from external display list.*/
|
||||||
void updateAIVLayers(hwc_context_t* ctx, hwc_display_contents_1_t* list);
|
void dropNonAIVLayers(hwc_context_t* ctx, hwc_display_contents_1_t* list);
|
||||||
|
|
||||||
/* updates cache map with YUV info */
|
/* updates cache map with YUV info */
|
||||||
void updateYUV(hwc_context_t* ctx, hwc_display_contents_1_t* list,
|
void updateYUV(hwc_context_t* ctx, hwc_display_contents_1_t* list,
|
||||||
|
|||||||
@@ -964,7 +964,7 @@ void setListStats(hwc_context_t *ctx,
|
|||||||
uint32_t refreshRate = 0;
|
uint32_t refreshRate = 0;
|
||||||
qdutils::MDPVersion& mdpHw = qdutils::MDPVersion::getInstance();
|
qdutils::MDPVersion& mdpHw = qdutils::MDPVersion::getInstance();
|
||||||
|
|
||||||
ctx->mAIVVideoMode[dpy] = false;
|
ctx->listStats[dpy].mAIVVideoMode = false;
|
||||||
resetROI(ctx, dpy);
|
resetROI(ctx, dpy);
|
||||||
|
|
||||||
trimList(ctx, list, dpy);
|
trimList(ctx, list, dpy);
|
||||||
@@ -974,8 +974,10 @@ void setListStats(hwc_context_t *ctx,
|
|||||||
private_handle_t *hnd = (private_handle_t *)layer->handle;
|
private_handle_t *hnd = (private_handle_t *)layer->handle;
|
||||||
|
|
||||||
#ifdef QCOM_BSP
|
#ifdef QCOM_BSP
|
||||||
|
// Window boxing feature is applicable obly for external display, So
|
||||||
|
// enable mAIVVideoMode only for external display
|
||||||
if(ctx->mWindowboxFeature && dpy && isAIVVideoLayer(layer)) {
|
if(ctx->mWindowboxFeature && dpy && isAIVVideoLayer(layer)) {
|
||||||
ctx->mAIVVideoMode[dpy] = true;
|
ctx->listStats[dpy].mAIVVideoMode = true;
|
||||||
}
|
}
|
||||||
if (layer->flags & HWC_SCREENSHOT_ANIMATOR_LAYER) {
|
if (layer->flags & HWC_SCREENSHOT_ANIMATOR_LAYER) {
|
||||||
ctx->listStats[dpy].isDisplayAnimating = true;
|
ctx->listStats[dpy].isDisplayAnimating = true;
|
||||||
@@ -1880,7 +1882,7 @@ void updateDestAIVVideoMode(hwc_context_t *ctx, hwc_rect_t crop,
|
|||||||
crop.left, crop.top, crop.right, crop.bottom);
|
crop.left, crop.top, crop.right, crop.bottom);
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateExtDisplayCoordinates(hwc_context_t *ctx, hwc_rect_t& crop,
|
void updateCoordinates(hwc_context_t *ctx, hwc_rect_t& crop,
|
||||||
hwc_rect_t& dst, int dpy) {
|
hwc_rect_t& dst, int dpy) {
|
||||||
updateCropAIVVideoMode(ctx, crop, dpy);
|
updateCropAIVVideoMode(ctx, crop, dpy);
|
||||||
updateDestAIVVideoMode(ctx, crop, dst, dpy);
|
updateDestAIVVideoMode(ctx, crop, dst, dpy);
|
||||||
@@ -1919,8 +1921,8 @@ int configureNonSplit(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);
|
||||||
}
|
}
|
||||||
// update source crop and destination position of AIV video layer.
|
// update source crop and destination position of AIV video layer.
|
||||||
if(ctx->mAIVVideoMode[dpy] && isYuvBuffer(hnd)) {
|
if(ctx->listStats[dpy].mAIVVideoMode && isYuvBuffer(hnd)) {
|
||||||
updateExtDisplayCoordinates(ctx, crop, dst, dpy);
|
updateCoordinates(ctx, crop, dst, dpy);
|
||||||
}
|
}
|
||||||
calcExtDisplayPosition(ctx, hnd, dpy, crop, dst, transform, orient);
|
calcExtDisplayPosition(ctx, hnd, dpy, crop, dst, transform, orient);
|
||||||
int downscale = getRotDownscale(ctx, layer);
|
int downscale = getRotDownscale(ctx, layer);
|
||||||
@@ -2017,8 +2019,8 @@ int configureSplit(hwc_context_t *ctx, hwc_layer_1_t *layer,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// update source crop and destination position of AIV video layer.
|
// update source crop and destination position of AIV video layer.
|
||||||
if(ctx->mAIVVideoMode[dpy] && isYuvBuffer(hnd)) {
|
if(ctx->listStats[dpy].mAIVVideoMode && isYuvBuffer(hnd)) {
|
||||||
updateExtDisplayCoordinates(ctx, crop, dst, dpy);
|
updateCoordinates(ctx, crop, dst, dpy);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Calculate the external display position based on MDP downscale,
|
/* Calculate the external display position based on MDP downscale,
|
||||||
@@ -2163,8 +2165,8 @@ int configureSourceSplit(hwc_context_t *ctx, hwc_layer_1_t *layer,
|
|||||||
getMdpFormat(hnd->format), (uint32_t)hnd->size);
|
getMdpFormat(hnd->format), (uint32_t)hnd->size);
|
||||||
|
|
||||||
// update source crop and destination position of AIV video layer.
|
// update source crop and destination position of AIV video layer.
|
||||||
if(ctx->mAIVVideoMode[dpy] && isYuvBuffer(hnd)) {
|
if(ctx->listStats[dpy].mAIVVideoMode && isYuvBuffer(hnd)) {
|
||||||
updateExtDisplayCoordinates(ctx, crop, dst, dpy);
|
updateCoordinates(ctx, crop, dst, dpy);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Calculate the external display position based on MDP downscale,
|
/* Calculate the external display position based on MDP downscale,
|
||||||
|
|||||||
@@ -141,6 +141,8 @@ struct ListStats {
|
|||||||
int secureRGBIndices[MAX_NUM_APP_LAYERS];
|
int secureRGBIndices[MAX_NUM_APP_LAYERS];
|
||||||
//dyn refresh rate-Client requested refreshrate
|
//dyn refresh rate-Client requested refreshrate
|
||||||
uint32_t refreshRateRequest;
|
uint32_t refreshRateRequest;
|
||||||
|
// Flag related to windowboxing feature
|
||||||
|
bool mAIVVideoMode;
|
||||||
};
|
};
|
||||||
|
|
||||||
//PTOR Comp info
|
//PTOR Comp info
|
||||||
@@ -381,7 +383,7 @@ void updateSource(ovutils::eTransform& orient, ovutils::Whf& whf,
|
|||||||
bool isZoomModeEnabled(hwc_rect_t crop);
|
bool isZoomModeEnabled(hwc_rect_t crop);
|
||||||
void updateCropAIVVideoMode(hwc_context_t *ctx, hwc_rect_t& crop, int dpy);
|
void updateCropAIVVideoMode(hwc_context_t *ctx, hwc_rect_t& crop, int dpy);
|
||||||
void updateDestAIVVideoMode(hwc_context_t *ctx, hwc_rect_t& dst, int dpy);
|
void updateDestAIVVideoMode(hwc_context_t *ctx, hwc_rect_t& dst, int dpy);
|
||||||
void updateExtDisplayCoordinates(hwc_context_t *ctx, hwc_rect_t& crop,
|
void updateCoordinates(hwc_context_t *ctx, hwc_rect_t& crop,
|
||||||
hwc_rect_t& dst, int dpy);
|
hwc_rect_t& dst, int dpy);
|
||||||
|
|
||||||
//Routine to configure low resolution panels (<= 2048 width)
|
//Routine to configure low resolution panels (<= 2048 width)
|
||||||
@@ -618,8 +620,7 @@ struct hwc_context_t {
|
|||||||
bool mThermalBurstMode;
|
bool mThermalBurstMode;
|
||||||
//Layers out of ROI
|
//Layers out of ROI
|
||||||
bool copybitDrop[MAX_NUM_APP_LAYERS];
|
bool copybitDrop[MAX_NUM_APP_LAYERS];
|
||||||
// Flags related to windowboxing feature
|
// Flag related to windowboxing feature
|
||||||
bool mAIVVideoMode[HWC_NUM_DISPLAY_TYPES];
|
|
||||||
bool mWindowboxFeature;
|
bool mWindowboxFeature;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user