The version variable will be used for versioning of this
struct and the corresponding accessor functions.

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

diff --git a/android/gralloc_handle.h b/android/gralloc_handle.h
index 79c1600e6750..647351eedaf7 100644
--- a/android/gralloc_handle.h
+++ b/android/gralloc_handle.h
@@ -23,6 +23,7 @@
 #define __ANDROID_GRALLOC_HANDLE_H__
 
 #include <cutils/native_handle.h>
+#include <stdint.h>
 
 /* support users of drm_gralloc/gbm_gralloc */
 #define gralloc_gbm_handle_t gralloc_handle_t
@@ -31,8 +32,9 @@
 struct gralloc_handle_t {
        native_handle_t base;
 
-       /* integers */
+       /* api variables */
        int magic; /* differentiate between allocator impls */
+       const uint32_t version; /* api version */
 
        int prime_fd; /* dma-buf file descriptor */
        int width; /* width of buffer in pixels */
@@ -51,6 +53,7 @@ struct gralloc_handle_t {
        } __attribute__((aligned(8)));
 };
 
+#define GRALLOC_HANDLE_VERSION 1
 #define GRALLOC_HANDLE_MAGIC 0x60585350
 #define GRALLOC_HANDLE_NUM_FDS 1
 #define GRALLOC_HANDLE_NUM_INTS (      \
@@ -63,7 +66,9 @@ struct gralloc_handle_t {
 static struct gralloc_handle_t *gralloc_handle_create(int width, int height,
                                                       int format, int usage)
 {
-       struct gralloc_handle_t handle = { .magic = GRALLOC_HANDLE_MAGIC };
+       struct alloc_handle_t handle = {
+               .magic = GRALLOC_HANDLE_MAGIC,
+               .version = GRALLOC_HANDLE_VERSION };
 
        handle->base.version = sizeof(handle->base);
        handle->base.numInts = GRALLOC_HANDLE_NUM_INTS;
-- 
2.14.1

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

Reply via email to