[Mesa-dev] [PATCH v1 7/7] android: Add accessor functions for gralloc_handle_t variables
Robert Foss
robert.foss at collabora.com
Tue Jan 16 17:36:12 UTC 2018
Supply accessor functions for most of the common gralloc_handle_t
variables.
Signed-off-by: Robert Foss <robert.foss at 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
More information about the mesa-dev
mailing list