summaryrefslogtreecommitdiffstats
path: root/libgralloc/alloc_controller.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libgralloc/alloc_controller.cpp')
-rw-r--r--libgralloc/alloc_controller.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/libgralloc/alloc_controller.cpp b/libgralloc/alloc_controller.cpp
index 01d0798eb..fd98154c3 100644
--- a/libgralloc/alloc_controller.cpp
+++ b/libgralloc/alloc_controller.cpp
@@ -774,12 +774,15 @@ static bool isUBwcSupported(int format)
bool isUBwcEnabled(int format, int usage)
{
- if (isUBwcFormat(format) ||
- ((usage & GRALLOC_USAGE_PRIVATE_ALLOC_UBWC) && isUBwcSupported(format)))
- {
- // Allow UBWC, only if GPU supports it and CPU usage flags are not set
- if (AdrenoMemInfo::getInstance().isUBWCSupportedByGPU(format) &&
- !(usage & (GRALLOC_USAGE_SW_READ_MASK |
+ // Allow UBWC, if client is using an explicitly defined UBWC pixel format.
+ 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, only if CPU usage flags are not set
+ if (!(usage & (GRALLOC_USAGE_SW_READ_MASK |
GRALLOC_USAGE_SW_WRITE_MASK))) {
return true;
}