summaryrefslogtreecommitdiffstats
path: root/libgralloc
diff options
context:
space:
mode:
authorSushil Chauhan <sushilchauhan@codeaurora.org>2015-08-13 10:10:48 -0700
committerSushil Chauhan <sushilchauhan@codeaurora.org>2015-08-13 10:40:25 -0700
commit7807d19bfe7243e6ade312343b79f8fc52a65d2f (patch)
tree67618887e1ed23045ab392e26682521c473b9e4b /libgralloc
parent65c64f4e9ed36d6a0478a81f3447fad1be88c203 (diff)
downloadhardware_qcom_display-7807d19bfe7243e6ade312343b79f8fc52a65d2f.tar.gz
hardware_qcom_display-7807d19bfe7243e6ade312343b79f8fc52a65d2f.tar.bz2
hardware_qcom_display-7807d19bfe7243e6ade312343b79f8fc52a65d2f.zip
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
Diffstat (limited to 'libgralloc')
-rw-r--r--libgralloc/alloc_controller.cpp16
-rw-r--r--libgralloc/gpu.cpp3
2 files changed, 12 insertions, 7 deletions
diff --git a/libgralloc/alloc_controller.cpp b/libgralloc/alloc_controller.cpp
index a7e00c5d1..33eca48f2 100644
--- a/libgralloc/alloc_controller.cpp
+++ b/libgralloc/alloc_controller.cpp
@@ -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;
}
}
diff --git a/libgralloc/gpu.cpp b/libgralloc/gpu.cpp
index 98ae919e8..13b063896 100644
--- a/libgralloc/gpu.cpp
+++ b/libgralloc/gpu.cpp
@@ -145,8 +145,7 @@ int gpu_context_t::gralloc_alloc_buffer(unsigned int size, int usage,
flags |= private_handle_t::PRIV_FLAGS_TILE_RENDERED;
}
- if (isUBwcEnabled(format, usage) &&
- AdrenoMemInfo::getInstance().isUBWCSupportedByGPU(format)) {
+ if (isUBwcEnabled(format, usage)) {
flags |= private_handle_t::PRIV_FLAGS_UBWC_ALIGNED;
}