display: Add support for UBWC in display hal
1. Add support for UBWC allocation in the Gralloc APIs for aligned
width, aligned height and buffer size. A client can request for UBWC
allocation by sending UBWC specific HAL pixel format or by setting
GRALLOC_USAGE_PRIVATE_ALLOC_UBWC flag in the usage flags.
2. Gralloc allocates UBWC aligned buffer, only if format is supported
by GPU and MDP and no CPU usage flags are set. Otherwise it allocates
linear buffer.
3. If UBWC conditions are met, gralloc sets PRIV_FLAGS_UBWC_ALIGNED
in private handle flags to tell client that allocated buffer has UBWC
alignment. This flag remains unset by default.
4. Add helper functions in gralloc to calculate UBWC meta buffer size
for RGB* formats.
5. Add UBWC HAL pixel format HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS_UBWC
which has been defined by Video module.
6. Add AdrenoMemInfo api to query, if GPU supports UBWC for a format.
7.MDP driver expects UBWC specific pixel format defined by MDP header.
Change-Id: I5b4344bc90aa498dbdb7bb8100e70ed7728e6ea5
diff --git a/libhwcomposer/hwc_utils.cpp b/libhwcomposer/hwc_utils.cpp
index adb3b9c..8139013 100644
--- a/libhwcomposer/hwc_utils.cpp
+++ b/libhwcomposer/hwc_utils.cpp
@@ -1793,7 +1793,7 @@
int dst_w = dst.right - dst.left;
int dst_h = dst.bottom - dst.top;
uint32_t color = layer->transform;
- Whf whf(w, h, getMdpFormat(HAL_PIXEL_FORMAT_RGBA_8888), 0);
+ Whf whf(w, h, getMdpFormat(HAL_PIXEL_FORMAT_RGBA_8888));
ovutils::setMdpFlags(mdpFlags, ovutils::OV_MDP_SOLID_FILL);
if (layer->blending == HWC_BLENDING_PREMULT)
@@ -1860,7 +1860,7 @@
bool isInterlaced = metadata && (metadata->operation & PP_PARAM_INTERLACED)
&& metadata->interlaced;
int transform = layer->transform;
- uint32_t format = ovutils::getMdpFormat(hnd->format, isTileRendered(hnd));
+ uint32_t format = ovutils::getMdpFormat(hnd->format, hnd->flags);
if(isYuvBuffer(hnd)) {
if(ctx->mMDP.version >= qdutils::MDP_V4_2 &&
@@ -1970,7 +1970,7 @@
int transform = layer->transform;
eTransform orient = static_cast<eTransform>(transform);
int rotFlags = ovutils::ROT_FLAGS_NONE;
- uint32_t format = ovutils::getMdpFormat(hnd->format, isTileRendered(hnd));
+ uint32_t format = ovutils::getMdpFormat(hnd->format, hnd->flags);
Whf whf(getWidth(hnd), getHeight(hnd), format, (uint32_t)hnd->size);
// Handle R/B swap
@@ -2066,7 +2066,7 @@
int transform = layer->transform;
eTransform orient = static_cast<eTransform>(transform);
int rotFlags = ROT_FLAGS_NONE;
- uint32_t format = ovutils::getMdpFormat(hnd->format, isTileRendered(hnd));
+ uint32_t format = ovutils::getMdpFormat(hnd->format, hnd->flags);
Whf whf(getWidth(hnd), getHeight(hnd), format, (uint32_t)hnd->size);
// Handle R/B swap