hwc: Don't use MDP for buffers of width less than 5
This is a software workaround for MDP hardware limitation where
DSI mode panels wont give more than 30 FPS if buffers in RGB
pipes are of width less than 5
MDP can't handle layers of width less than 3. Fail MDP
Composition for those frames.
Change-Id: If45efab19817ea9e724fd2857fcc1c5d98ce0eab
diff --git a/libhwcomposer/hwc_mdpcomp.cpp b/libhwcomposer/hwc_mdpcomp.cpp
index 760b134..c51a6aa 100644
--- a/libhwcomposer/hwc_mdpcomp.cpp
+++ b/libhwcomposer/hwc_mdpcomp.cpp
@@ -222,6 +222,45 @@
}
}
+bool MDPCompLowRes::isWidthValid(hwc_context_t *ctx, hwc_layer_1_t *layer) {
+
+ const int dpy = HWC_DISPLAY_PRIMARY;
+ private_handle_t *hnd = (private_handle_t *)layer->handle;
+
+ if(!hnd) {
+ ALOGE("%s: layer handle is NULL", __FUNCTION__);
+ return false;
+ }
+
+ int hw_w = ctx->dpyAttr[dpy].xres;
+ int hw_h = ctx->dpyAttr[dpy].yres;
+
+ hwc_rect_t sourceCrop = layer->sourceCrop;
+ hwc_rect_t displayFrame = layer->displayFrame;
+
+ hwc_rect_t crop = sourceCrop;
+ int crop_w = crop.right - crop.left;
+ int crop_h = crop.bottom - crop.top;
+
+ hwc_rect_t dst = displayFrame;
+ int dst_w = dst.right - dst.left;
+ int dst_h = dst.bottom - dst.top;
+
+ if(dst.left < 0 || dst.top < 0 || dst.right > hw_w || dst.bottom > hw_h) {
+ qhwc::calculate_crop_rects(crop, dst, hw_w, hw_h, layer->transform);
+ crop_w = crop.right - crop.left;
+ crop_h = crop.bottom - crop.top;
+ }
+
+ //Workaround for MDP HW limitation in DSI command mode panels where
+ //FPS will not go beyond 30 if buffers on RGB pipes are of width < 5
+
+ if(crop_w < 5)
+ return false;
+
+ return true;
+}
+
/*
* Configures pipe(s) for MDP composition
*/
@@ -416,6 +455,7 @@
return false;
}
+
//MDP composition is not efficient if layer needs rotator.
for(int i = 0; i < numAppLayers; ++i) {
// As MDP h/w supports flip operation, use MDP comp only for
@@ -426,6 +466,9 @@
ALOGD_IF(isDebug(), "%s: orientation involved",__FUNCTION__);
return false;
}
+
+ if(!isYuvBuffer(hnd) && !isWidthValid(ctx,layer))
+ return false;
}
return true;
}