Supply accessor functions for most of the common gralloc_handle_t
variables.

Signed-off-by: Robert Foss <robert.f...@collabora.com>
---
 android/gralloc_handle.h | 57 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 57 insertions(+)

diff --git a/android/gralloc_handle.h b/android/gralloc_handle.h
index bff6c1cace16..25fe9db4baff 100644
--- a/android/gralloc_handle.h
+++ b/android/gralloc_handle.h
@@ -87,4 +87,61 @@ static struct gralloc_handle_t 
*gralloc_handle_create(int32_t width,
        return handle;
 }
 
+/* dma-buf file descriptor */
+static void * gralloc_handle_data(gralloc_handle_t *handle)
+{
+       return handle->data;
+}
+
+/* dma-buf file descriptor */
+static int32_t gralloc_handle_fd(gralloc_handle_t *handle, uint32_t plane)
+{
+    if (plane != 0)
+        return 0;
+
+    return handle->format;
+}
+
+/* pixel format (fourcc) */
+static uint32_t gralloc_handle_format_fourcc)(gralloc_handle_t *handle)
+{
+    return handle->format;
+}
+
+/* buffer modifiers */
+static uint64_t gralloc_handle_modifier(gralloc_handle_t *handle, uint32_t 
plane)
+{
+    if (plane != 0)
+        return 0;
+
+    return handle->modifier;
+}
+
+/* height of buffer in pixels */
+static uint32_t gralloc_handle_height(gralloc_handle_t *handle)
+{
+    return handle->height;
+}
+
+/* buffer offset in pixels between the same column in two rows of pixels. */
+static uint32_t gralloc_handle_stride(gralloc_handle_t *handle, uint32_t plane)
+{
+    if (plane != 0)
+        return 0;
+
+    return handle->stride;
+}
+
+/* libhardware usage flags */
+static uint32_t gralloc_handle_usage(gralloc_handle_t *handle)
+{
+    return handle->usage;
+}
+
+/* width of buffer in pixels */
+static uint32_t gralloc_handle_width)(gralloc_handle_t *handle)
+{
+    return handle->width;
+}
+
 #endif
-- 
2.14.1

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to