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)
This commit is contained in:
Naseer Ahmed
2013-09-20 01:31:37 -07:00
committed by Arun Kumar K.R
parent 2c215298e1
commit 82fc4b733f
2 changed files with 5 additions and 2 deletions

View File

@@ -104,7 +104,7 @@ int AdrenoMemInfo::getStride(int width, int format)
{
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 @@ int AdrenoMemInfo::getStride(int width, int format)
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 @@ size_t getBufferSizeAndDimensions(int width, int height, int format,
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: