Gralloc: Use adreno APIs for buffer size calculations
1) Add support to use adreno APIs for non video layers'
buffer size calculations.
2) Add graphics metadata field to MetaData_t structure.
3) Add bindings for newly introduced formats in
GetGpuPixelFormat.
4) Add support to retrieve the graphics metadata in
Perform API.
5) Modify BUFFER_TYPE determination logic
Change-Id: I7674209b42d7cd39bc8de39e3a10582bb216e6cf
CRs-Fixed: 2226672
diff --git a/gralloc/gr_device_impl.cpp b/gralloc/gr_device_impl.cpp
index a26ea81..61ec38b 100644
--- a/gralloc/gr_device_impl.cpp
+++ b/gralloc/gr_device_impl.cpp
@@ -510,7 +510,7 @@
gralloc1_error_t GrallocImpl::GetFlexLayout(const private_handle_t *hnd,
struct android_flex_layout *layout) {
- if (!IsYuvFormat(hnd)) {
+ if (!IsYuvFormat(hnd->format)) {
return GRALLOC1_ERROR_UNSUPPORTED;
}
@@ -560,7 +560,7 @@
gralloc1_error_t status = CheckDeviceAndHandle(device, buffer);
if (status == GRALLOC1_ERROR_NONE) {
const private_handle_t *hnd = PRIV_HANDLE_CONST(buffer);
- if (!IsYuvFormat(hnd)) {
+ if (!IsYuvFormat(hnd->format)) {
status = GRALLOC1_ERROR_UNSUPPORTED;
} else {
*out_num_planes = 3;
@@ -847,6 +847,21 @@
}
} break;
+ case GRALLOC_MODULE_PERFORM_GET_GRAPHICS_METADATA: {
+ private_handle_t* hnd = va_arg(args, private_handle_t *);
+
+ if (private_handle_t::validate(hnd) != 0) {
+ return GRALLOC1_ERROR_BAD_HANDLE;
+ }
+
+ void* graphic_metadata = va_arg(args, void*);
+
+ if (getMetaData(hnd, GET_GRAPHICS_METADATA, graphic_metadata) != 0) {
+ graphic_metadata = NULL;
+ return GRALLOC1_ERROR_UNSUPPORTED;
+ }
+ } break;
+
default:
break;
}