hwc: Add API to find if a display is split
A display could be split if its dimensions exceed 2048 or in case
of primary if we make it so via device tree property.
Add an API to find if a display is split. Use this API instead of
going through a set of conditions in various use cases.
Rename the HighRes, LowRes objects to a more appropriate Split and
NonSplit respectively
Change-Id: Id847c2bf36ea9250e1cdbc0259fdec64bd124537
diff --git a/libhwcomposer/hwc_fbupdate.cpp b/libhwcomposer/hwc_fbupdate.cpp
index 2337b2a..53b3d18 100644
--- a/libhwcomposer/hwc_fbupdate.cpp
+++ b/libhwcomposer/hwc_fbupdate.cpp
@@ -37,12 +37,11 @@
namespace ovutils = overlay::utils;
-IFBUpdate* IFBUpdate::getObject(const int& width, const int& rightSplit,
- const int& dpy) {
- if(width > MAX_DISPLAY_DIM || rightSplit) {
- return new FBUpdateHighRes(dpy);
+IFBUpdate* IFBUpdate::getObject(hwc_context_t *ctx, const int& dpy) {
+ if(isDisplaySplit(ctx, dpy)) {
+ return new FBUpdateSplit(dpy);
}
- return new FBUpdateLowRes(dpy);
+ return new FBUpdateNonSplit(dpy);
}
inline void IFBUpdate::reset() {
@@ -51,14 +50,14 @@
}
//================= Low res====================================
-FBUpdateLowRes::FBUpdateLowRes(const int& dpy): IFBUpdate(dpy) {}
+FBUpdateNonSplit::FBUpdateNonSplit(const int& dpy): IFBUpdate(dpy) {}
-inline void FBUpdateLowRes::reset() {
+inline void FBUpdateNonSplit::reset() {
IFBUpdate::reset();
mDest = ovutils::OV_INVALID;
}
-bool FBUpdateLowRes::preRotateExtDisplay(hwc_context_t *ctx,
+bool FBUpdateNonSplit::preRotateExtDisplay(hwc_context_t *ctx,
ovutils::Whf &info,
hwc_rect_t& sourceCrop,
ovutils::eMdpFlags& mdpFlags,
@@ -82,7 +81,7 @@
return true;
}
-bool FBUpdateLowRes::prepare(hwc_context_t *ctx, hwc_display_contents_1 *list,
+bool FBUpdateNonSplit::prepare(hwc_context_t *ctx, hwc_display_contents_1 *list,
int fbZorder) {
if(!ctx->mMDP.hasOverlay) {
ALOGD_IF(DEBUG_FBUPDATE, "%s, this hw doesnt support overlays",
@@ -94,7 +93,7 @@
}
// Configure
-bool FBUpdateLowRes::configure(hwc_context_t *ctx, hwc_display_contents_1 *list,
+bool FBUpdateNonSplit::configure(hwc_context_t *ctx, hwc_display_contents_1 *list,
int fbZorder) {
bool ret = false;
hwc_layer_1_t *layer = &list->hwLayers[list->numHwLayers - 1];
@@ -186,7 +185,7 @@
return ret;
}
-bool FBUpdateLowRes::draw(hwc_context_t *ctx, private_handle_t *hnd)
+bool FBUpdateNonSplit::draw(hwc_context_t *ctx, private_handle_t *hnd)
{
if(!mModeOn) {
return true;
@@ -210,16 +209,16 @@
}
//================= High res====================================
-FBUpdateHighRes::FBUpdateHighRes(const int& dpy): IFBUpdate(dpy) {}
+FBUpdateSplit::FBUpdateSplit(const int& dpy): IFBUpdate(dpy) {}
-inline void FBUpdateHighRes::reset() {
+inline void FBUpdateSplit::reset() {
IFBUpdate::reset();
mDestLeft = ovutils::OV_INVALID;
mDestRight = ovutils::OV_INVALID;
mRot = NULL;
}
-bool FBUpdateHighRes::prepare(hwc_context_t *ctx, hwc_display_contents_1 *list,
+bool FBUpdateSplit::prepare(hwc_context_t *ctx, hwc_display_contents_1 *list,
int fbZorder) {
if(!ctx->mMDP.hasOverlay) {
ALOGD_IF(DEBUG_FBUPDATE, "%s, this hw doesnt support overlays",
@@ -232,7 +231,7 @@
}
// Configure
-bool FBUpdateHighRes::configure(hwc_context_t *ctx,
+bool FBUpdateSplit::configure(hwc_context_t *ctx,
hwc_display_contents_1 *list, int fbZorder) {
bool ret = false;
hwc_layer_1_t *layer = &list->hwLayers[list->numHwLayers - 1];
@@ -355,7 +354,7 @@
return ret;
}
-bool FBUpdateHighRes::draw(hwc_context_t *ctx, private_handle_t *hnd)
+bool FBUpdateSplit::draw(hwc_context_t *ctx, private_handle_t *hnd)
{
if(!mModeOn) {
return true;