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,12 +836,18 @@ bool isUBwcEnabled(int format, int usage)
if (isUBwcFormat(format))
return true;
// Allow UBWC, if client sets UBWC gralloc usage flag & GPU supports format.
if ((usage & GRALLOC_USAGE_PRIVATE_ALLOC_UBWC) && isUBwcSupported(format) &&
AdrenoMemInfo::getInstance().isUBWCSupportedByGPU(format)) {
// 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.
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
if (!(usage & (GRALLOC_USAGE_SW_READ_MASK |
GRALLOC_USAGE_SW_WRITE_MASK))) {
if (enable && !(usage & (GRALLOC_USAGE_SW_READ_MASK |
GRALLOC_USAGE_SW_WRITE_MASK))) {
return true;
}
}