gralloc: Add allocation support for sRGB formats
Refer to graphics.h for the definition of these new formats.
The HWC doesn't yet support output to these formats.
Change-Id: I14dade3412d262d853d3783ba77d559c76d331bf
(cherry picked from commit 3a63837a3d006aee3d176d379409bf3134f6189b)
diff --git a/libgralloc/alloc_controller.cpp b/libgralloc/alloc_controller.cpp
index 4daadb6..5a6fe6e 100644
--- a/libgralloc/alloc_controller.cpp
+++ b/libgralloc/alloc_controller.cpp
@@ -104,7 +104,7 @@
{
int stride = ALIGN(width, 32);
// Currently surface padding is only computed for RGB* surfaces.
- if (format < 0x7) {
+ if (format <= HAL_PIXEL_FORMAT_sRGB_888) {
// Don't add any additional padding if debug.gralloc.map_fb_memory
// is enabled
char property[PROPERTY_VALUE_MAX];
@@ -118,6 +118,7 @@
switch(format)
{
case HAL_PIXEL_FORMAT_RGB_888:
+ case HAL_PIXEL_FORMAT_sRGB_888:
bpp = 3;
break;
case HAL_PIXEL_FORMAT_RGB_565:
@@ -280,9 +281,11 @@
case HAL_PIXEL_FORMAT_RGBA_8888:
case HAL_PIXEL_FORMAT_RGBX_8888:
case HAL_PIXEL_FORMAT_BGRA_8888:
+ case HAL_PIXEL_FORMAT_sRGB_A_8888:
size = alignedw * alignedh * 4;
break;
case HAL_PIXEL_FORMAT_RGB_888:
+ case HAL_PIXEL_FORMAT_sRGB_888:
size = alignedw * alignedh * 3;
break;
case HAL_PIXEL_FORMAT_RGB_565: