hwc: Add support for uneven split primary displays
Add support for unevenly split primary displays.
The driver provides info about the split via msm_fb_split sysfs node
For external we assume even split. If driver doesn't specify any split
for primary, we default to even split.
Change-Id: I4d541f41de2d7a5d2b62653fa33cab079a6d5d30
diff --git a/libhwcomposer/hwc_mdpcomp.cpp b/libhwcomposer/hwc_mdpcomp.cpp
index ba6cae7..d4ce253 100644
--- a/libhwcomposer/hwc_mdpcomp.cpp
+++ b/libhwcomposer/hwc_mdpcomp.cpp
@@ -40,12 +40,12 @@
bool MDPComp::sEnableMixedMode = true;
int MDPComp::sMaxPipesPerMixer = MAX_PIPES_PER_MIXER;
-MDPComp* MDPComp::getObject(const int& width, int dpy) {
- if(width <= MAX_DISPLAY_DIM) {
- return new MDPCompLowRes(dpy);
- } else {
+MDPComp* MDPComp::getObject(const int& width, const int& rightSplit,
+ const int& dpy) {
+ if(width > MAX_DISPLAY_DIM || rightSplit) {
return new MDPCompHighRes(dpy);
}
+ return new MDPCompLowRes(dpy);
}
MDPComp::MDPComp(int dpy):mDpy(dpy){};
@@ -954,17 +954,24 @@
//=============MDPCompHighRes===================================================
int MDPCompHighRes::pipesNeeded(hwc_context_t *ctx,
- hwc_display_contents_1_t* list) {
+ hwc_display_contents_1_t* list) {
int pipesNeeded = 0;
- int hw_w = ctx->dpyAttr[mDpy].xres;
+ const int xres = ctx->dpyAttr[mDpy].xres;
+ //Default even split for all displays with high res
+ int lSplit = xres / 2;
+ if(mDpy == HWC_DISPLAY_PRIMARY &&
+ qdutils::MDPVersion::getInstance().getLeftSplit()) {
+ //Override if split published by driver for primary
+ lSplit = qdutils::MDPVersion::getInstance().getLeftSplit();
+ }
for(int i = 0; i < mCurrentFrame.layerCount; ++i) {
if(!mCurrentFrame.isFBComposed[i]) {
hwc_layer_1_t* layer = &list->hwLayers[i];
hwc_rect_t dst = layer->displayFrame;
- if(dst.left > hw_w/2) {
+ if(dst.left > lSplit) {
pipesNeeded++;
- } else if(dst.right <= hw_w/2) {
+ } else if(dst.right <= lSplit) {
pipesNeeded++;
} else {
pipesNeeded += 2;
@@ -975,17 +982,24 @@
}
bool MDPCompHighRes::acquireMDPPipes(hwc_context_t *ctx, hwc_layer_1_t* layer,
- MdpPipeInfoHighRes& pipe_info,
- ePipeType type) {
- int hw_w = ctx->dpyAttr[mDpy].xres;
+ MdpPipeInfoHighRes& pipe_info,
+ ePipeType type) {
+ const int xres = ctx->dpyAttr[mDpy].xres;
+ //Default even split for all displays with high res
+ int lSplit = xres / 2;
+ if(mDpy == HWC_DISPLAY_PRIMARY &&
+ qdutils::MDPVersion::getInstance().getLeftSplit()) {
+ //Override if split published by driver for primary
+ lSplit = qdutils::MDPVersion::getInstance().getLeftSplit();
+ }
hwc_rect_t dst = layer->displayFrame;
- if(dst.left > hw_w/2) {
+ if(dst.left > lSplit) {
pipe_info.lIndex = ovutils::OV_INVALID;
pipe_info.rIndex = getMdpPipe(ctx, type);
if(pipe_info.rIndex == ovutils::OV_INVALID)
return false;
- } else if (dst.right <= hw_w/2) {
+ } else if (dst.right <= lSplit) {
pipe_info.rIndex = ovutils::OV_INVALID;
pipe_info.lIndex = getMdpPipe(ctx, type);
if(pipe_info.lIndex == ovutils::OV_INVALID)
@@ -1035,7 +1049,7 @@
* Configures pipe(s) for MDP composition
*/
int MDPCompHighRes::configure(hwc_context_t *ctx, hwc_layer_1_t *layer,
- PipeLayerPair& PipeLayerPair) {
+ PipeLayerPair& PipeLayerPair) {
MdpPipeInfoHighRes& mdp_info =
*(static_cast<MdpPipeInfoHighRes*>(PipeLayerPair.pipeInfo));
eZorder zOrder = static_cast<eZorder>(mdp_info.zOrder);