Skip to content

Commit 054951a

Browse files
committed
Add the HAL_PIXEL_FORMAT_RGBA_10101010 format support
There is no DRM_FORMAT_ABGR10101010 defined. Transfer the HAL_PIXEL_FORMAT_RGBA_10101010 to DRM_FORMAT_ABGR2101010 so far. Tracked-On: OAM-134109 Signed-off-by: HeYue <yue.he@intel.com>
1 parent 67e267f commit 054951a

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

cros_gralloc/cros_gralloc_helpers.cc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
/* Define to match AIDL PixelFormat::R_8. */
2727
#define HAL_PIXEL_FORMAT_R8 0x38
28+
#define HAL_PIXEL_FORMAT_RGBA_10101010 0x3B
2829

2930
const char *drmFormat2Str(int drm_format)
3031
{
@@ -91,6 +92,16 @@ uint32_t cros_gralloc_convert_format(int format)
9192
#if ANDROID_API_LEVEL >= 30
9293
case HAL_PIXEL_FORMAT_YCBCR_P010:
9394
return DRM_FORMAT_P010;
95+
#endif
96+
#if ANDROID_API_LEVEL >= 35
97+
case HAL_PIXEL_FORMAT_RGBA_10101010:
98+
/*
99+
* There is no DRM_FORMAT_ABGR10101010 defined.
100+
* Transfer RGBA_10101010 to DRM_FORMAT_ABGR2101010,
101+
* alpha value is cut from 10 bit to 2 bit.
102+
*/
103+
ALOGW("RGBA_10101010 format, alpha value is cut from 10 bit to 2 bit\n");
104+
return DRM_FORMAT_ABGR2101010;
94105
#endif
95106
case HAL_PIXEL_FORMAT_NV12:
96107
return DRM_FORMAT_NV12;

0 commit comments

Comments
 (0)