summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gralloc/gr_utils.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/gralloc/gr_utils.cpp b/gralloc/gr_utils.cpp
index 48d8bb53..c2371575 100644
--- a/gralloc/gr_utils.cpp
+++ b/gralloc/gr_utils.cpp
@@ -558,10 +558,12 @@ bool IsUBwcEnabled(int format, uint64_t usage) {
// 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;
+ if (IsUBwcSupported(format)) {
+ bool enable =
+ (usage & GRALLOC_USAGE_PRIVATE_ALLOC_UBWC) | (usage & BufferUsage::COMPOSER_CLIENT_TARGET);
// Query GPU for UBWC only if buffer is intended to be used by GPU.
- if ((usage & BufferUsage::GPU_TEXTURE) || (usage & BufferUsage::GPU_RENDER_TARGET)) {
+ if (enable &&
+ ((usage & BufferUsage::GPU_TEXTURE) || (usage & BufferUsage::GPU_RENDER_TARGET))) {
if (AdrenoMemInfo::GetInstance()) {
enable = AdrenoMemInfo::GetInstance()->IsUBWCSupportedByGPU(format);
}
@@ -969,6 +971,8 @@ void GetGpuResourceSizeAndDimensions(const BufferInfo &info, unsigned int *size,
int is_ubwc_enabled = IsUBwcEnabled(info.format, info.usage);
if (!is_ubwc_enabled) {
adreno_usage &= ~(GRALLOC_USAGE_PRIVATE_ALLOC_UBWC);
+ } else {
+ adreno_usage |= GRALLOC_USAGE_PRIVATE_ALLOC_UBWC;
}
// Call adreno api for populating metadata blob