summaryrefslogtreecommitdiff
path: root/gralloc
diff options
context:
space:
mode:
authorAlec Mouri <alecmouri@google.com>2018-11-08 12:34:17 -0800
committerAlec Mouri <alecmouri@google.com>2018-11-08 12:36:35 -0800
commitf04c4c02559224c7d6e2e15b10e8b1de3d1e77f8 (patch)
treea51716e3e9e7479ca1d94096209536ad552779d4 /gralloc
parentcb8ad10ab1625be985aff72073764db39d3e834c (diff)
downloaddisplay-f04c4c02559224c7d6e2e15b10e8b1de3d1e77f8.tar.gz
Allow GRALLOC_USAGE_HW_FB as usage hint for UBWC.
Rollforward of I7cec70f463f6045116b78d6ccb1caf2a4c7023a3, but without accidentally enabling UBWC if render target flags are set. Bug: 118690958 Test: boots, manual tests, camera preview works. Change-Id: I84a1af4ff4a6c2177102f07d04f1e9ab85187fc0
Diffstat (limited to 'gralloc')
-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