hwc: Add support for Macro Tile feature
Macro tile is enabled only if all the conditions are met:
1. GPU hardware should support Macro Tiling.
2. MDSS hardware should support Macro Tiling.
3. USAGE flags shouldnt contain GRALLOC_USAGE_SW_READ_OFTEN and
GRALLOC_USAGE_SW_WRITE_OFTEN.
4. RGB 16bit and 32bit formats.
5. persist.hwc.macro_tile_enable flag should be enabled.
PRIV_FLAGS_TILE_RENDERED flag is added to indicate whether the layer
is rendered/composited in Macro Tiling or Linear format.
Change-Id: Ie3139839c84d76c5d1a2300f33910a09eb7336f4
diff --git a/libhwcomposer/hwc_fbupdate.cpp b/libhwcomposer/hwc_fbupdate.cpp
index d601f8f..6bc2e75 100644
--- a/libhwcomposer/hwc_fbupdate.cpp
+++ b/libhwcomposer/hwc_fbupdate.cpp
@@ -45,11 +45,14 @@
}
IFBUpdate::IFBUpdate(hwc_context_t *ctx, const int& dpy) : mDpy(dpy) {
- getBufferSizeAndDimensions(ctx->dpyAttr[dpy].xres,
- ctx->dpyAttr[dpy].yres,
+ size_t size;
+ getBufferAttributes(ctx->dpyAttr[mDpy].xres,
+ ctx->dpyAttr[mDpy].yres,
HAL_PIXEL_FORMAT_RGBA_8888,
+ 0,
mAlignedFBWidth,
- mAlignedFBHeight);
+ mAlignedFBHeight,
+ mTileEnabled, size);
}
void IFBUpdate::reset() {
@@ -121,9 +124,9 @@
}
overlay::Overlay& ov = *(ctx->mOverlay);
- ovutils::Whf info(mAlignedFBWidth,
- mAlignedFBHeight,
- ovutils::getMdpFormat(HAL_PIXEL_FORMAT_RGBA_8888));
+ ovutils::Whf info(mAlignedFBWidth, mAlignedFBHeight,
+ ovutils::getMdpFormat(HAL_PIXEL_FORMAT_RGBA_8888,
+ mTileEnabled));
//Request a pipe
ovutils::eMdpPipeType type = ovutils::OV_MDP_PIPE_ANY;
@@ -269,8 +272,8 @@
ovutils::Whf info(mAlignedFBWidth,
mAlignedFBHeight,
- ovutils::getMdpFormat(HAL_PIXEL_FORMAT_RGBA_8888));
-
+ ovutils::getMdpFormat(HAL_PIXEL_FORMAT_RGBA_8888,
+ mTileEnabled));
//Request left pipe
ovutils::eDest destL = ov.nextPipe(ovutils::OV_MDP_PIPE_ANY, mDpy,
Overlay::MIXER_LEFT);
diff --git a/libhwcomposer/hwc_fbupdate.h b/libhwcomposer/hwc_fbupdate.h
index 355e429..4b449c8 100644
--- a/libhwcomposer/hwc_fbupdate.h
+++ b/libhwcomposer/hwc_fbupdate.h
@@ -53,6 +53,7 @@
overlay::Rotator *mRot;
int mAlignedFBWidth;
int mAlignedFBHeight;
+ int mTileEnabled;
};
//Non-Split panel handler.
diff --git a/libhwcomposer/hwc_utils.cpp b/libhwcomposer/hwc_utils.cpp
index 0663f67..bb12c4e 100644
--- a/libhwcomposer/hwc_utils.cpp
+++ b/libhwcomposer/hwc_utils.cpp
@@ -1476,8 +1476,8 @@
eTransform orient = static_cast<eTransform>(transform);
int downscale = 0;
int rotFlags = ovutils::ROT_FLAGS_NONE;
- Whf whf(getWidth(hnd), getHeight(hnd),
- getMdpFormat(hnd->format), hnd->size);
+ uint32_t format = ovutils::getMdpFormat(hnd->format, isTileRendered(hnd));
+ Whf whf(getWidth(hnd), getHeight(hnd), format, hnd->size);
// Handle R/B swap
if (layer->flags & HWC_FORMAT_RB_SWAP) {
@@ -1583,9 +1583,8 @@
eTransform orient = static_cast<eTransform>(transform);
const int downscale = 0;
int rotFlags = ROT_FLAGS_NONE;
-
- Whf whf(getWidth(hnd), getHeight(hnd),
- getMdpFormat(hnd->format), hnd->size);
+ uint32_t format = ovutils::getMdpFormat(hnd->format, isTileRendered(hnd));
+ Whf whf(getWidth(hnd), getHeight(hnd), format, hnd->size);
// Handle R/B swap
if (layer->flags & HWC_FORMAT_RB_SWAP) {
diff --git a/libhwcomposer/hwc_utils.h b/libhwcomposer/hwc_utils.h
index cd84f73..0b41a02 100644
--- a/libhwcomposer/hwc_utils.h
+++ b/libhwcomposer/hwc_utils.h
@@ -334,6 +334,11 @@
static inline bool isSecureBuffer(const private_handle_t* hnd) {
return (hnd && (private_handle_t::PRIV_FLAGS_SECURE_BUFFER & hnd->flags));
}
+
+static inline bool isTileRendered(const private_handle_t* hnd) {
+ return (hnd && (private_handle_t::PRIV_FLAGS_TILE_RENDERED & hnd->flags));
+}
+
//Return true if buffer is marked locked
static inline bool isBufferLocked(const private_handle_t* hnd) {
return (hnd && (private_handle_t::PRIV_FLAGS_HWC_LOCK & hnd->flags));