hwc: Avoid MDP composition with alpha scaling
MDP4 supports scaling with alpha, only in RGB pipes. In some cases this scaling happened with video pipes. We now fall back to GLES composition for layers that have alpha and need scaling. Change-Id: I084355bad1cdb17c7308077b56006c59e75d2042 Signed-off-by: Jeykumar Sankaran <jsanka@codeaurora.org> Bug: 7648647
This commit is contained in:
@@ -273,6 +273,11 @@ bool MDPComp::isDoable(hwc_context_t *ctx, hwc_display_contents_1_t* list) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(ctx->listStats[HWC_DISPLAY_PRIMARY].needsAlphaScale) {
|
||||||
|
ALOGD_IF(isDebug(), "%s: frame needs alpha downscaling",__FUNCTION__);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
//FB composition on idle timeout
|
//FB composition on idle timeout
|
||||||
if(sIdleFallBack) {
|
if(sIdleFallBack) {
|
||||||
sIdleFallBack = false;
|
sIdleFallBack = false;
|
||||||
|
|||||||
@@ -110,6 +110,25 @@ void dumpLayer(hwc_layer_1_t const* l)
|
|||||||
l->displayFrame.bottom);
|
l->displayFrame.bottom);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline bool isAlphaScaled(hwc_layer_1_t const* layer) {
|
||||||
|
int dst_w, dst_h, src_w, src_h;
|
||||||
|
|
||||||
|
hwc_rect_t displayFrame = layer->displayFrame;
|
||||||
|
hwc_rect_t sourceCrop = layer->sourceCrop;
|
||||||
|
|
||||||
|
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))) {
|
||||||
|
if(layer->blending != HWC_BLENDING_NONE)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void setListStats(hwc_context_t *ctx,
|
void setListStats(hwc_context_t *ctx,
|
||||||
const hwc_display_contents_1_t *list, int dpy) {
|
const hwc_display_contents_1_t *list, int dpy) {
|
||||||
|
|
||||||
@@ -118,10 +137,11 @@ void setListStats(hwc_context_t *ctx,
|
|||||||
ctx->listStats[dpy].yuvCount = 0;
|
ctx->listStats[dpy].yuvCount = 0;
|
||||||
ctx->listStats[dpy].yuvIndex = -1;
|
ctx->listStats[dpy].yuvIndex = -1;
|
||||||
ctx->listStats[dpy].skipCount = 0;
|
ctx->listStats[dpy].skipCount = 0;
|
||||||
|
ctx->listStats[dpy].needsAlphaScale = false;
|
||||||
|
|
||||||
for (size_t i = 0; i < list->numHwLayers; i++) {
|
for (size_t i = 0; i < list->numHwLayers; i++) {
|
||||||
private_handle_t *hnd =
|
hwc_layer_1_t const* layer = &list->hwLayers[i];
|
||||||
(private_handle_t *)list->hwLayers[i].handle;
|
private_handle_t *hnd = (private_handle_t *)layer->handle;
|
||||||
|
|
||||||
if(list->hwLayers[i].compositionType == HWC_FRAMEBUFFER_TARGET) {
|
if(list->hwLayers[i].compositionType == HWC_FRAMEBUFFER_TARGET) {
|
||||||
continue;
|
continue;
|
||||||
@@ -130,6 +150,9 @@ void setListStats(hwc_context_t *ctx,
|
|||||||
ctx->listStats[dpy].skipCount++;
|
ctx->listStats[dpy].skipCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!ctx->listStats[dpy].needsAlphaScale)
|
||||||
|
ctx->listStats[dpy].needsAlphaScale = isAlphaScaled(layer);
|
||||||
|
|
||||||
if (UNLIKELY(isYuvBuffer(hnd))) {
|
if (UNLIKELY(isYuvBuffer(hnd))) {
|
||||||
ctx->listStats[dpy].yuvCount++;
|
ctx->listStats[dpy].yuvCount++;
|
||||||
ctx->listStats[dpy].yuvIndex = i;
|
ctx->listStats[dpy].yuvIndex = i;
|
||||||
@@ -137,6 +160,7 @@ void setListStats(hwc_context_t *ctx,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static inline void calc_cut(float& leftCutRatio, float& topCutRatio,
|
static inline void calc_cut(float& leftCutRatio, float& topCutRatio,
|
||||||
float& rightCutRatio, float& bottomCutRatio, int orient) {
|
float& rightCutRatio, float& bottomCutRatio, int orient) {
|
||||||
if(orient & HAL_TRANSFORM_FLIP_H) {
|
if(orient & HAL_TRANSFORM_FLIP_H) {
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ struct ListStats {
|
|||||||
//Video specific
|
//Video specific
|
||||||
int yuvCount;
|
int yuvCount;
|
||||||
int yuvIndex;
|
int yuvIndex;
|
||||||
|
bool needsAlphaScale;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user