return asFP<GRALLOC1_PFN_GET_STRIDE>(getStrideHook);
case GRALLOC1_FUNCTION_GET_BYTE_STRIDE:
return asFP<GRALLOC1_PFN_GET_BYTE_STRIDE>(getByteStrideHook);
+ case GRALLOC1_FUNCTION_GET_PRIME:
+ return asFP<GRALLOC1_PFN_GET_PRIME>(getPrimeHook);
case GRALLOC1_FUNCTION_ALLOCATE:
if (driver) {
return asFP<GRALLOC1_PFN_ALLOCATE>(allocateBuffers);
return CROS_GRALLOC_ERROR_NONE;
}
+int32_t CrosGralloc1::getPrime(buffer_handle_t buffer, uint32_t *prime)
+{
+ auto hnd = cros_gralloc_convert_handle(buffer);
+ if (!hnd) {
+ return CROS_GRALLOC_ERROR_BAD_HANDLE;
+ }
+
+ *prime = hnd->fds[0];
+ return CROS_GRALLOC_ERROR_NONE;
+}
+
int32_t CrosGralloc1::getByteStride(buffer_handle_t buffer, uint32_t *outStride, uint32_t size)
{
auto hnd = cros_gralloc_convert_handle(buffer);
return getAdapter(device)->getStride(buffer, outStride);
}
+ int32_t getPrime(buffer_handle_t buffer, uint32_t *prime);
+ static int32_t getPrimeHook(gralloc1_device_t *device, buffer_handle_t buffer,
+ uint32_t *prime)
+ {
+ return getAdapter(device)->getPrime(buffer, prime);
+ }
+
int32_t getByteStride(buffer_handle_t buffer, uint32_t *outStride, uint32_t size);
static int32_t getByteStrideHook(gralloc1_device_t *device, buffer_handle_t buffer,
uint32_t *outStride, uint32_t size)
#ifdef USE_GRALLOC1
enum { GRALLOC1_FUNCTION_SET_MODIFIER = 101,
GRALLOC1_FUNCTION_GET_BYTE_STRIDE = 102,
+ GRALLOC1_FUNCTION_GET_PRIME = 103,
GRALLOC1_LAST_CUSTOM = 500 };
typedef int32_t /*gralloc1_error_t*/ (*GRALLOC1_PFN_SET_MODIFIER)(
typedef int32_t /*gralloc1_error_t*/ (*GRALLOC1_PFN_GET_BYTE_STRIDE)(
gralloc1_device_t *device, buffer_handle_t buffer, uint32_t *outStride, uint32_t size);
+
+typedef int32_t /*gralloc1_error_t*/ (*GRALLOC1_PFN_GET_PRIME)(
+ gralloc1_device_t *device, buffer_handle_t buffer, uint32_t *prime);
#endif
#endif