Enable Universal Bandwidth Compression for textures
We removed texture compression for VR display surfaces, which introduced memory
bandwidth issues on some QC platforms.
This patch reintroduces texture compression for QC devices compatible with
both gralloc0/gralloc1 implementations.
Bug: 36370337
Test: Validate VR comes up
Change-Id: Ieaaa56f67522c85913476ed0d8da04f8eedbce63
diff --git a/libs/vr/libdisplay/graphics.cpp b/libs/vr/libdisplay/graphics.cpp
index c2fbb8b..3713389 100644
--- a/libs/vr/libdisplay/graphics.cpp
+++ b/libs/vr/libdisplay/graphics.cpp
@@ -27,6 +27,7 @@
#include <private/dvr/sensor_constants.h>
#include <private/dvr/video_mesh_surface_client.h>
#include <private/dvr/vsync_client.h>
+#include <private/dvr/platform_defines.h>
#include <android/native_window.h>
@@ -43,8 +44,10 @@
namespace {
+// TODO(urbanus): revisit once we have per-platform usage config in place.
constexpr int kDefaultDisplaySurfaceUsage =
- GRALLOC_USAGE_HW_RENDER | GRALLOC_USAGE_HW_TEXTURE;
+ GRALLOC_USAGE_HW_RENDER | GRALLOC_USAGE_HW_TEXTURE |
+ GRALLOC_USAGE_QCOM_FRAMEBUFFER_COMPRESSION;
constexpr int kDefaultDisplaySurfaceFormat = HAL_PIXEL_FORMAT_RGBA_8888;
// TODO(alexst): revisit this count when HW encode is available for casting.
constexpr int kDefaultBufferCount = 4;
diff --git a/libs/vr/libdvrcommon/include/private/dvr/platform_defines.h b/libs/vr/libdvrcommon/include/private/dvr/platform_defines.h
index 71d4c8c..2176903 100644
--- a/libs/vr/libdvrcommon/include/private/dvr/platform_defines.h
+++ b/libs/vr/libdvrcommon/include/private/dvr/platform_defines.h
@@ -1,10 +1,11 @@
#ifndef ANDROID_DVR_PLATFORM_DEFINES_H_
#define ANDROID_DVR_PLATFORM_DEFINES_H_
+#include <hardware/gralloc1.h>
// Platform-specific macros and defines.
-// QCOM's GRALLOC_USAGE_PRIVATE_ALLOC_UBWC usage bit.
-#define GRALLOC_USAGE_QCOM_FRAMEBUFFER_COMPRESSION GRALLOC_USAGE_PRIVATE_1
+// QCOM's GRALLOC_USAGE_PRIVATE_ALLOC_UBWC usage bits.
+#define GRALLOC_USAGE_QCOM_FRAMEBUFFER_COMPRESSION GRALLOC_USAGE_PRIVATE_1 | GRALLOC1_PRODUCER_USAGE_PRIVATE_0
// QCOM bit to use the ADSP heap. This carveout heap is accessible to Linux,
// Hexagon DSPs, and the GPU.