gralloc: De-couple the UBWC decision for GPU and Rotator

Allow UBWC, if an OpenGL client sets UBWC usage flag and GPU plus MDP
support the format. OR if a non-OpenGL client like Rotator, sets UBWC
usage flag and MDP supports the format. It de-couples the UBWC decision
for Rotator output buffer format from GPU.

Change-Id: I5e78b615f71c1781a40b8c137a37b111eb786323
This commit is contained in:
Sushil Chauhan
2015-08-13 10:10:48 -07:00
parent 65c64f4e9e
commit 7807d19bfe
2 changed files with 12 additions and 7 deletions

View File

@@ -836,11 +836,17 @@ bool isUBwcEnabled(int format, int usage)
if (isUBwcFormat(format)) if (isUBwcFormat(format))
return true; return true;
// Allow UBWC, if client sets UBWC gralloc usage flag & GPU supports format. // Allow UBWC, if an OpenGL client sets UBWC usage flag and GPU plus MDP
if ((usage & GRALLOC_USAGE_PRIVATE_ALLOC_UBWC) && isUBwcSupported(format) && // support the format. OR if a non-OpenGL client like Rotator, sets UBWC
AdrenoMemInfo::getInstance().isUBWCSupportedByGPU(format)) { // usage flag and MDP supports the format.
if ((usage & GRALLOC_USAGE_PRIVATE_ALLOC_UBWC) && isUBwcSupported(format)) {
bool enable = true;
// Query GPU for UBWC only if buffer is intended to be used by GPU.
if (usage & (GRALLOC_USAGE_HW_TEXTURE | GRALLOC_USAGE_HW_RENDER)) {
enable = AdrenoMemInfo::getInstance().isUBWCSupportedByGPU(format);
}
// Allow UBWC, only if CPU usage flags are not set // Allow UBWC, only if CPU usage flags are not set
if (!(usage & (GRALLOC_USAGE_SW_READ_MASK | if (enable && !(usage & (GRALLOC_USAGE_SW_READ_MASK |
GRALLOC_USAGE_SW_WRITE_MASK))) { GRALLOC_USAGE_SW_WRITE_MASK))) {
return true; return true;
} }

View File

@@ -145,8 +145,7 @@ int gpu_context_t::gralloc_alloc_buffer(unsigned int size, int usage,
flags |= private_handle_t::PRIV_FLAGS_TILE_RENDERED; flags |= private_handle_t::PRIV_FLAGS_TILE_RENDERED;
} }
if (isUBwcEnabled(format, usage) && if (isUBwcEnabled(format, usage)) {
AdrenoMemInfo::getInstance().isUBWCSupportedByGPU(format)) {
flags |= private_handle_t::PRIV_FLAGS_UBWC_ALIGNED; flags |= private_handle_t::PRIV_FLAGS_UBWC_ALIGNED;
} }