OSDN Git Service

Add getPrime API to support media
authorBadiuzzaman Iskhandar <badiuzzaman.azzarfan.bin.iskhandar@intel.com>
Mon, 14 May 2018 02:42:01 +0000 (10:42 +0800)
committerKalyan Kondapally <kalyan.kondapally@intel.com>
Fri, 18 May 2018 01:44:15 +0000 (18:44 -0700)
Jira: https://jira01.devtools.intel.com/browse/OAM-62657
Tests: None
Signed-off-by: Khairul Anuar Romli <khairul.anuar.romli@intel.com>
cros_gralloc/gralloc1/cros_gralloc1_module.cc
cros_gralloc/gralloc1/cros_gralloc1_module.h
cros_gralloc/i915_private_android_types.h

index 7a82146..b7bce51 100644 (file)
@@ -198,6 +198,8 @@ gralloc1_function_pointer_t CrosGralloc1::doGetFunction(int32_t intDescriptor)
                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);
@@ -590,6 +592,17 @@ int32_t CrosGralloc1::getStride(buffer_handle_t buffer, uint32_t *outStride)
        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);
index 871a85a..4e99f6f 100644 (file)
@@ -191,6 +191,13 @@ class CrosGralloc1 : public gralloc1_device_t
                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)
index 01539e5..e756ca1 100644 (file)
@@ -66,6 +66,7 @@ enum { HAL_PIXEL_FORMAT_NV12_Y_TILED_INTEL = 0x100,
 #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)(
@@ -73,6 +74,9 @@ 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