mapper: support new usage and format
Update Gralloc3 to use usage and format from
android.hardware.graphics.common@1.2. This enables support for
the usage HW_IMAGE_ENCODER and the format HSV_888.
Test: IMapper and AHardwareBuffer tests
Bug: 79465976
Change-Id: I91562c609299829d9c33980a59cdf5adfc6596a9
diff --git a/libs/ui/Gralloc3.cpp b/libs/ui/Gralloc3.cpp
index 7f8e57c..eb43765 100644
--- a/libs/ui/Gralloc3.cpp
+++ b/libs/ui/Gralloc3.cpp
@@ -28,7 +28,7 @@
#pragma clang diagnostic pop
using android::hardware::graphics::allocator::V3_0::IAllocator;
-using android::hardware::graphics::common::V1_1::BufferUsage;
+using android::hardware::graphics::common::V1_2::BufferUsage;
using android::hardware::graphics::mapper::V3_0::BufferDescriptor;
using android::hardware::graphics::mapper::V3_0::Error;
using android::hardware::graphics::mapper::V3_0::IMapper;
@@ -44,11 +44,7 @@
static const uint64_t validUsageBits = []() -> uint64_t {
uint64_t bits = 0;
for (const auto bit :
- hardware::hidl_enum_range<hardware::graphics::common::V1_0::BufferUsage>()) {
- bits = bits | bit;
- }
- for (const auto bit :
- hardware::hidl_enum_range<hardware::graphics::common::V1_1::BufferUsage>()) {
+ hardware::hidl_enum_range<hardware::graphics::common::V1_2::BufferUsage>()) {
bits = bits | bit;
}
return bits;
@@ -71,7 +67,7 @@
outDescriptorInfo->width = width;
outDescriptorInfo->height = height;
outDescriptorInfo->layerCount = layerCount;
- outDescriptorInfo->format = static_cast<hardware::graphics::common::V1_1::PixelFormat>(format);
+ outDescriptorInfo->format = static_cast<hardware::graphics::common::V1_2::PixelFormat>(format);
outDescriptorInfo->usage = usage;
}