Merge "hwc : Add hw limitation checks for MDP compposition."
This commit is contained in:
committed by
Gerrit - the friendly Code Review server
commit
23c77c865e
@@ -449,7 +449,7 @@ bool MDPComp::validateAndApplyROI(hwc_context_t *ctx,
|
|||||||
/* Reset frame ROI when any layer which needs scaling also needs ROI
|
/* Reset frame ROI when any layer which needs scaling also needs ROI
|
||||||
* cropping */
|
* cropping */
|
||||||
if((res_w != dst_w || res_h != dst_h) &&
|
if((res_w != dst_w || res_h != dst_h) &&
|
||||||
needsScaling (ctx, layer, mDpy)) {
|
needsScaling (layer)) {
|
||||||
ALOGI("%s: Resetting ROI due to scaling", __FUNCTION__);
|
ALOGI("%s: Resetting ROI due to scaling", __FUNCTION__);
|
||||||
memset(&mCurrentFrame.drop, 0, sizeof(mCurrentFrame.drop));
|
memset(&mCurrentFrame.drop, 0, sizeof(mCurrentFrame.drop));
|
||||||
mCurrentFrame.dropCount = 0;
|
mCurrentFrame.dropCount = 0;
|
||||||
@@ -530,12 +530,6 @@ bool MDPComp::isFullFrameDoable(hwc_context_t *ctx,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ctx->listStats[mDpy].needsAlphaScale
|
|
||||||
&& ctx->mMDP.version < qdutils::MDSS_V5) {
|
|
||||||
ALOGD_IF(isDebug(), "%s: frame needs alpha downscaling",__FUNCTION__);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
for(int i = 0; i < numAppLayers; ++i) {
|
for(int i = 0; i < numAppLayers; ++i) {
|
||||||
hwc_layer_1_t* layer = &list->hwLayers[i];
|
hwc_layer_1_t* layer = &list->hwLayers[i];
|
||||||
private_handle_t *hnd = (private_handle_t *)layer->handle;
|
private_handle_t *hnd = (private_handle_t *)layer->handle;
|
||||||
@@ -568,6 +562,12 @@ bool MDPComp::isFullFrameDoable(hwc_context_t *ctx,
|
|||||||
} else if(partialMDPComp(ctx, list)) {
|
} else if(partialMDPComp(ctx, list)) {
|
||||||
ret = true;
|
ret = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!hwLimitationsCheck(ctx, list)) {
|
||||||
|
ALOGD_IF(isDebug(), "%s: HW limitations",__FUNCTION__);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -593,7 +593,7 @@ bool MDPComp::fullMDPComp(hwc_context_t *ctx, hwc_display_contents_1_t* list) {
|
|||||||
//pipe and error is reported.
|
//pipe and error is reported.
|
||||||
if(qdutils::MDPVersion::getInstance().is8x26() &&
|
if(qdutils::MDPVersion::getInstance().is8x26() &&
|
||||||
mDpy >= HWC_DISPLAY_EXTERNAL &&
|
mDpy >= HWC_DISPLAY_EXTERNAL &&
|
||||||
qhwc::needsScaling(ctx, layer, mDpy))
|
qhwc::needsScaling(layer))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
mCurrentFrame.fbCount = 0;
|
mCurrentFrame.fbCount = 0;
|
||||||
@@ -1222,6 +1222,48 @@ bool MDPComp::bandwidthCheck(hwc_context_t *ctx, const double& size) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool MDPComp::hwLimitationsCheck(hwc_context_t* ctx,
|
||||||
|
hwc_display_contents_1_t* list) {
|
||||||
|
|
||||||
|
//A-family hw limitation:
|
||||||
|
//If a layer need alpha scaling, MDP can not support.
|
||||||
|
if(ctx->mMDP.version < qdutils::MDSS_V5) {
|
||||||
|
for(int i = 0; i < mCurrentFrame.layerCount; ++i) {
|
||||||
|
if(!mCurrentFrame.isFBComposed[i] &&
|
||||||
|
isAlphaScaled( &list->hwLayers[i])) {
|
||||||
|
ALOGD_IF(isDebug(), "%s:frame needs alphaScaling",__FUNCTION__);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// On 8x26 & 8974 hw, we have a limitation of downscaling+blending.
|
||||||
|
//If multiple layers requires downscaling and also they are overlapping
|
||||||
|
//fall back to GPU since MDSS can not handle it.
|
||||||
|
if(qdutils::MDPVersion::getInstance().is8x74v2() ||
|
||||||
|
qdutils::MDPVersion::getInstance().is8x26()) {
|
||||||
|
for(int i = 0; i < mCurrentFrame.layerCount-1; ++i) {
|
||||||
|
hwc_layer_1_t* botLayer = &list->hwLayers[i];
|
||||||
|
if(!mCurrentFrame.isFBComposed[i] &&
|
||||||
|
isDownscaleRequired(botLayer)) {
|
||||||
|
//if layer-i is marked for MDP and needs downscaling
|
||||||
|
//check if any MDP layer on top of i & overlaps with layer-i
|
||||||
|
for(int j = i+1; j < mCurrentFrame.layerCount; ++j) {
|
||||||
|
hwc_layer_1_t* topLayer = &list->hwLayers[j];
|
||||||
|
if(!mCurrentFrame.isFBComposed[j] &&
|
||||||
|
isDownscaleRequired(topLayer)) {
|
||||||
|
hwc_rect_t r = getIntersection(botLayer->displayFrame,
|
||||||
|
topLayer->displayFrame);
|
||||||
|
if(isValidRect(r))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
int MDPComp::prepare(hwc_context_t *ctx, hwc_display_contents_1_t* list) {
|
int MDPComp::prepare(hwc_context_t *ctx, hwc_display_contents_1_t* list) {
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
const int numLayers = ctx->listStats[mDpy].numAppLayers;
|
const int numLayers = ctx->listStats[mDpy].numAppLayers;
|
||||||
@@ -1495,7 +1537,7 @@ bool MDPCompNonSplit::allocLayerPipes(hwc_context_t *ctx,
|
|||||||
|
|
||||||
if(isYuvBuffer(hnd)) {
|
if(isYuvBuffer(hnd)) {
|
||||||
type = MDPCOMP_OV_VG;
|
type = MDPCOMP_OV_VG;
|
||||||
} else if(!qhwc::needsScaling(ctx, layer, mDpy)
|
} else if(!qhwc::needsScaling(layer)
|
||||||
&& Overlay::getDMAMode() != Overlay::DMA_BLOCK_MODE
|
&& Overlay::getDMAMode() != Overlay::DMA_BLOCK_MODE
|
||||||
&& ctx->mMDP.version >= qdutils::MDSS_V5) {
|
&& ctx->mMDP.version >= qdutils::MDSS_V5) {
|
||||||
type = MDPCOMP_OV_DMA;
|
type = MDPCOMP_OV_DMA;
|
||||||
|
|||||||
@@ -181,6 +181,9 @@ protected:
|
|||||||
hwc_display_contents_1_t* list);
|
hwc_display_contents_1_t* list);
|
||||||
/* checks if the required bandwidth exceeds a certain max */
|
/* checks if the required bandwidth exceeds a certain max */
|
||||||
bool bandwidthCheck(hwc_context_t *ctx, const double& size);
|
bool bandwidthCheck(hwc_context_t *ctx, const double& size);
|
||||||
|
/* checks if MDP/MDSS can process current list w.r.to HW limitations
|
||||||
|
* All peculiar HW limitations should go here */
|
||||||
|
bool hwLimitationsCheck(hwc_context_t* ctx, hwc_display_contents_1_t* list);
|
||||||
/* generates ROI based on the modified area of the frame */
|
/* generates ROI based on the modified area of the frame */
|
||||||
void generateROI(hwc_context_t *ctx, hwc_display_contents_1_t* list);
|
void generateROI(hwc_context_t *ctx, hwc_display_contents_1_t* list);
|
||||||
bool validateAndApplyROI(hwc_context_t *ctx, hwc_display_contents_1_t* list,
|
bool validateAndApplyROI(hwc_context_t *ctx, hwc_display_contents_1_t* list,
|
||||||
|
|||||||
@@ -607,8 +607,21 @@ int getMirrorModeOrientation(hwc_context_t *ctx) {
|
|||||||
return extOrientation;
|
return extOrientation;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool needsScaling(hwc_context_t* ctx, hwc_layer_1_t const* layer,
|
bool isDownscaleRequired(hwc_layer_1_t const* layer) {
|
||||||
const int& dpy) {
|
hwc_rect_t displayFrame = layer->displayFrame;
|
||||||
|
hwc_rect_t sourceCrop = integerizeSourceCrop(layer->sourceCropf);
|
||||||
|
int dst_w, dst_h, src_w, src_h;
|
||||||
|
dst_w = displayFrame.right - displayFrame.left;
|
||||||
|
dst_h = displayFrame.bottom - displayFrame.top;
|
||||||
|
src_w = sourceCrop.right - sourceCrop.left;
|
||||||
|
src_h = sourceCrop.bottom - sourceCrop.top;
|
||||||
|
|
||||||
|
if(((src_w > dst_w) || (src_h > dst_h)))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
bool needsScaling(hwc_layer_1_t const* layer) {
|
||||||
int dst_w, dst_h, src_w, src_h;
|
int dst_w, dst_h, src_w, src_h;
|
||||||
|
|
||||||
hwc_rect_t displayFrame = layer->displayFrame;
|
hwc_rect_t displayFrame = layer->displayFrame;
|
||||||
@@ -677,9 +690,8 @@ bool needsScalingWithSplit(hwc_context_t* ctx, hwc_layer_1_t const* layer,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isAlphaScaled(hwc_context_t* ctx, hwc_layer_1_t const* layer,
|
bool isAlphaScaled(hwc_layer_1_t const* layer) {
|
||||||
const int& dpy) {
|
if(needsScaling(layer) && isAlphaPresent(layer)) {
|
||||||
if(needsScaling(ctx, layer, dpy) && isAlphaPresent(layer)) {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -734,7 +746,6 @@ void setListStats(hwc_context_t *ctx,
|
|||||||
ctx->listStats[dpy].numAppLayers = list->numHwLayers - 1;
|
ctx->listStats[dpy].numAppLayers = list->numHwLayers - 1;
|
||||||
ctx->listStats[dpy].fbLayerIndex = list->numHwLayers - 1;
|
ctx->listStats[dpy].fbLayerIndex = list->numHwLayers - 1;
|
||||||
ctx->listStats[dpy].skipCount = 0;
|
ctx->listStats[dpy].skipCount = 0;
|
||||||
ctx->listStats[dpy].needsAlphaScale = false;
|
|
||||||
ctx->listStats[dpy].preMultipliedAlpha = false;
|
ctx->listStats[dpy].preMultipliedAlpha = false;
|
||||||
ctx->listStats[dpy].isSecurePresent = false;
|
ctx->listStats[dpy].isSecurePresent = false;
|
||||||
ctx->listStats[dpy].yuvCount = 0;
|
ctx->listStats[dpy].yuvCount = 0;
|
||||||
@@ -800,9 +811,6 @@ void setListStats(hwc_context_t *ctx,
|
|||||||
if(layer->blending == HWC_BLENDING_PREMULT)
|
if(layer->blending == HWC_BLENDING_PREMULT)
|
||||||
ctx->listStats[dpy].preMultipliedAlpha = true;
|
ctx->listStats[dpy].preMultipliedAlpha = true;
|
||||||
|
|
||||||
if(!ctx->listStats[dpy].needsAlphaScale)
|
|
||||||
ctx->listStats[dpy].needsAlphaScale =
|
|
||||||
isAlphaScaled(ctx, layer, dpy);
|
|
||||||
|
|
||||||
if(UNLIKELY(isExtOnly(hnd))){
|
if(UNLIKELY(isExtOnly(hnd))){
|
||||||
ctx->listStats[dpy].extOnlyLayerIndex = i;
|
ctx->listStats[dpy].extOnlyLayerIndex = i;
|
||||||
@@ -1057,7 +1065,7 @@ void optimizeLayerRects(hwc_context_t *ctx,
|
|||||||
hwc_rect_t& topframe =
|
hwc_rect_t& topframe =
|
||||||
(hwc_rect_t&)list->hwLayers[i].displayFrame;
|
(hwc_rect_t&)list->hwLayers[i].displayFrame;
|
||||||
while(j >= 0) {
|
while(j >= 0) {
|
||||||
if(!needsScaling(ctx, &list->hwLayers[j], dpy)) {
|
if(!needsScaling(&list->hwLayers[j])) {
|
||||||
hwc_layer_1_t* layer = (hwc_layer_1_t*)&list->hwLayers[j];
|
hwc_layer_1_t* layer = (hwc_layer_1_t*)&list->hwLayers[j];
|
||||||
hwc_rect_t& bottomframe = layer->displayFrame;
|
hwc_rect_t& bottomframe = layer->displayFrame;
|
||||||
hwc_rect_t& bottomCrop = layer->sourceCrop;
|
hwc_rect_t& bottomCrop = layer->sourceCrop;
|
||||||
|
|||||||
@@ -97,7 +97,6 @@ struct ListStats {
|
|||||||
int yuvCount;
|
int yuvCount;
|
||||||
int yuvIndices[MAX_NUM_APP_LAYERS];
|
int yuvIndices[MAX_NUM_APP_LAYERS];
|
||||||
int extOnlyLayerIndex;
|
int extOnlyLayerIndex;
|
||||||
bool needsAlphaScale;
|
|
||||||
bool preMultipliedAlpha;
|
bool preMultipliedAlpha;
|
||||||
int yuv4k2kIndices[MAX_NUM_APP_LAYERS];
|
int yuv4k2kIndices[MAX_NUM_APP_LAYERS];
|
||||||
int yuv4k2kCount;
|
int yuv4k2kCount;
|
||||||
@@ -205,8 +204,9 @@ void getNonWormholeRegion(hwc_display_contents_1_t* list,
|
|||||||
bool isSecuring(hwc_context_t* ctx, hwc_layer_1_t const* layer);
|
bool isSecuring(hwc_context_t* ctx, hwc_layer_1_t const* layer);
|
||||||
bool isSecureModePolicy(int mdpVersion);
|
bool isSecureModePolicy(int mdpVersion);
|
||||||
bool isExternalActive(hwc_context_t* ctx);
|
bool isExternalActive(hwc_context_t* ctx);
|
||||||
bool needsScaling(hwc_context_t* ctx, hwc_layer_1_t const* layer,
|
bool isAlphaScaled(hwc_layer_1_t const* layer);
|
||||||
const int& dpy);
|
bool needsScaling(hwc_layer_1_t const* layer);
|
||||||
|
bool isDownscaleRequired(hwc_layer_1_t const* layer);
|
||||||
bool needsScalingWithSplit(hwc_context_t* ctx, hwc_layer_1_t const* layer,
|
bool needsScalingWithSplit(hwc_context_t* ctx, hwc_layer_1_t const* layer,
|
||||||
const int& dpy);
|
const int& dpy);
|
||||||
void sanitizeSourceCrop(hwc_rect_t& cropL, hwc_rect_t& cropR,
|
void sanitizeSourceCrop(hwc_rect_t& cropL, hwc_rect_t& cropR,
|
||||||
|
|||||||
Reference in New Issue
Block a user