Merge "Minor cleanup in gralloc" am: cb53ef7cd9
Original change: https://android-review.googlesource.com/c/device/generic/goldfish-opengl/+/2406992
Change-Id: If89c3dc973e3adaa4f33ee48949926adce53cc0d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/system/hals/allocator3.cpp b/system/hals/allocator3.cpp
index 3619d91..b968d7f 100644
--- a/system/hals/allocator3.cpp
+++ b/system/hals/allocator3.cpp
@@ -199,16 +199,14 @@
emulatorFrameworkFormat = EmulatorFrameworkFormat::YUV_420_888;
break;
- default:
- if (static_cast<android::hardware::graphics::common::V1_1::PixelFormat>(format) ==
- android::hardware::graphics::common::V1_1::PixelFormat::YCBCR_P010) {
- yuv_format = true;
- glFormat = GL_RGBA;
- glType = GL_UNSIGNED_BYTE;
- bpp = 2;
- break;
- }
+ case PixelFormat::YCBCR_P010:
+ yuv_format = true;
+ glFormat = GL_RGBA;
+ glType = GL_UNSIGNED_BYTE;
+ bpp = 2;
+ break;
+ default:
ALOGE("%s:%d Unsupported format: format=%d, frameworkFormat=%d, usage=%x",
__func__, __LINE__, format, descriptor.format, usage);
RETURN_ERROR(Error3::UNSUPPORTED);
diff --git a/system/hals/mapper3.cpp b/system/hals/mapper3.cpp
index 58c0f69..a14a0cd 100644
--- a/system/hals/mapper3.cpp
+++ b/system/hals/mapper3.cpp
@@ -351,17 +351,15 @@
cStep = 1;
break;
- default:
- if (static_cast<android::hardware::graphics::common::V1_1::PixelFormat>(cb->format) ==
- android::hardware::graphics::common::V1_1::PixelFormat::YCBCR_P010) {
- yStride = cb->width * 2;
- cStride = yStride;
- uOffset = cb->height * yStride;
- vOffset = uOffset + 2;
- cStep = 4;
- break;
- }
+ case PixelFormat::YCBCR_P010:
+ yStride = cb->width * 2;
+ cStride = yStride;
+ uOffset = cb->height * yStride;
+ vOffset = uOffset + 2;
+ cStep = 4;
+ break;
+ default:
ALOGE("%s:%d unexpected format (%d)", __func__, __LINE__, cb->format);
RETURN_ERROR(Error3::BAD_BUFFER);
}