gralloc: Change private usage flags from enums to defines

1. It helps in checking gralloc private usage flags at compile time.
2. Define GRALLOC_MODULE_PERFORM_GET_UBWC_FLAG to enable client to
   query the value of "PRIV_FLAGS_UBWC_ALIGNED" flag at run time.
3. Add ADRENO_PIXELFORMAT_NV12_EXT in defined Adreno Pixel formats
   to fix NV12_UBWC HAL pixel format conversion to Adreno format.

Change-Id: I78ccac98f1bd1bfbd2aa596ceb7a293f3d2e5f6e
This commit is contained in:
Sushil Chauhan
2015-02-18 14:55:03 -08:00
parent 92fff34247
commit a9d47001c9
4 changed files with 42 additions and 30 deletions

View File

@@ -36,6 +36,7 @@ typedef enum {
ADRENO_PIXELFORMAT_NV12 = 103,
ADRENO_PIXELFORMAT_YUY2 = 107,
ADRENO_PIXELFORMAT_B4G4R4A4 = 115,
ADRENO_PIXELFORMAT_NV12_EXT = 506, // NV12 with non-std alignment and offsets
ADRENO_PIXELFORMAT_R8G8B8 = 508, // GL_RGB8
ADRENO_PIXELFORMAT_A1B5G5R5 = 519, // GL_RGB5_A1
ADRENO_PIXELFORMAT_R8G8B8X8_SRGB = 520, // GL_SRGB8

View File

@@ -308,9 +308,10 @@ ADRENOPIXELFORMAT AdrenoMemInfo::getGpuPixelFormat(int hal_format)
case HAL_PIXEL_FORMAT_sRGB_A_8888:
return ADRENO_PIXELFORMAT_R8G8B8A8_SRGB;
case HAL_PIXEL_FORMAT_NV12_ENCODEABLE:
return ADRENO_PIXELFORMAT_NV12;
case HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS:
case HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS_UBWC:
return ADRENO_PIXELFORMAT_NV12;
return ADRENO_PIXELFORMAT_NV12_EXT;
default:
ALOGE("%s: No map for format: 0x%x", __FUNCTION__, hal_format);
break;

View File

@@ -33,44 +33,42 @@
#define ROUND_UP_PAGESIZE(x) ( (((unsigned long)(x)) + PAGE_SIZE-1) & \
(~(PAGE_SIZE-1)) )
enum {
/* gralloc usage bits indicating the type
* of allocation that should be used */
/* SYSTEM heap comes from kernel vmalloc,
* can never be uncached, is not secured*/
GRALLOC_USAGE_PRIVATE_SYSTEM_HEAP = GRALLOC_USAGE_PRIVATE_0,
/* Gralloc usage bits indicating the type of allocation that should be used */
/* SYSTEM heap comes from kernel vmalloc, can never be uncached,
* is not secured */
#define GRALLOC_USAGE_PRIVATE_SYSTEM_HEAP GRALLOC_USAGE_PRIVATE_0
/* Non linear, Universal Bandwidth Compression */
GRALLOC_USAGE_PRIVATE_ALLOC_UBWC = GRALLOC_USAGE_PRIVATE_1,
#define GRALLOC_USAGE_PRIVATE_ALLOC_UBWC GRALLOC_USAGE_PRIVATE_1
/* IOMMU heap comes from manually allocated pages, can be cached/uncached,
* is not secured */
#define GRALLOC_USAGE_PRIVATE_IOMMU_HEAP GRALLOC_USAGE_PRIVATE_2
/* IOMMU heap comes from manually allocated pages,
* can be cached/uncached, is not secured */
GRALLOC_USAGE_PRIVATE_IOMMU_HEAP = GRALLOC_USAGE_PRIVATE_2,
/* MM heap is a carveout heap for video, can be secured */
GRALLOC_USAGE_PRIVATE_MM_HEAP = GRALLOC_USAGE_PRIVATE_3,
/* ADSP heap is a carveout heap, is not secured*/
GRALLOC_USAGE_PRIVATE_ADSP_HEAP = 0x01000000,
#define GRALLOC_USAGE_PRIVATE_MM_HEAP GRALLOC_USAGE_PRIVATE_3
/* Set this for allocating uncached memory (using O_DSYNC)
/* ADSP heap is a carveout heap, is not secured */
#define GRALLOC_USAGE_PRIVATE_ADSP_HEAP 0x01000000
/* Set this for allocating uncached memory (using O_DSYNC),
* cannot be used with noncontiguous heaps */
GRALLOC_USAGE_PRIVATE_UNCACHED = 0x02000000,
#define GRALLOC_USAGE_PRIVATE_UNCACHED 0x02000000
/* Buffer content should be displayed on an primary display only */
GRALLOC_USAGE_PRIVATE_INTERNAL_ONLY = 0x04000000,
#define GRALLOC_USAGE_PRIVATE_INTERNAL_ONLY 0x04000000
/* Buffer content should be displayed on an external display only */
GRALLOC_USAGE_PRIVATE_EXTERNAL_ONLY = 0x08000000,
#define GRALLOC_USAGE_PRIVATE_EXTERNAL_ONLY 0x08000000
/* This flag is set for WFD usecase */
GRALLOC_USAGE_PRIVATE_WFD = 0x00200000,
#define GRALLOC_USAGE_PRIVATE_WFD 0x00200000
/* CAMERA heap is a carveout heap for camera, is not secured */
GRALLOC_USAGE_PRIVATE_CAMERA_HEAP = 0x00400000,
#define GRALLOC_USAGE_PRIVATE_CAMERA_HEAP 0x00400000
/* This flag is used for SECURE display usecase */
GRALLOC_USAGE_PRIVATE_SECURE_DISPLAY = 0x00800000,
};
#define GRALLOC_USAGE_PRIVATE_SECURE_DISPLAY 0x00800000
/* define Gralloc perform */
#define GRALLOC_MODULE_PERFORM_CREATE_HANDLE_FROM_BUFFER 1
@@ -84,6 +82,7 @@ enum {
#define GRALLOC_MODULE_PERFORM_GET_COLOR_SPACE_FROM_HANDLE 6
#define GRALLOC_MODULE_PERFORM_GET_YUV_PLANE_INFO 7
#define GRALLOC_MODULE_PERFORM_GET_MAP_SECURE_BUFFER_INFO 8
#define GRALLOC_MODULE_PERFORM_GET_UBWC_FLAG 9
#define GRALLOC_HEAP_MASK (GRALLOC_USAGE_PRIVATE_SYSTEM_HEAP |\
GRALLOC_USAGE_PRIVATE_IOMMU_HEAP |\

View File

@@ -447,6 +447,17 @@ int gralloc_perform(struct gralloc_module_t const* module,
}
} break;
case GRALLOC_MODULE_PERFORM_GET_UBWC_FLAG:
{
private_handle_t* hnd = va_arg(args, private_handle_t*);
int *flag = va_arg(args, int *);
if (private_handle_t::validate(hnd)) {
return res;
}
*flag = hnd->flags & private_handle_t::PRIV_FLAGS_UBWC_ALIGNED;
res = 0;
} break;
default:
break;
}