[Mesa-dev] [RFC libdrm 2/5] android: Add version variable to alloc_handle_t

Robert Foss robert.foss at collabora.com
Wed Dec 13 17:30:11 UTC 2017


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

Signed-off-by: Robert Foss <robert.foss at collabora.com>
---
 android/alloc_handle.h | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/android/alloc_handle.h b/android/alloc_handle.h
index 75cb895a962a..b722615638e7 100644
--- a/android/alloc_handle.h
+++ b/android/alloc_handle.h
@@ -30,9 +30,10 @@
 
 struct alloc_handle_t {
 	native_handle_t base;
-	
-	/* integers */
+
+	/* api variables */
 	int magic; /* differentiate between allocator impls */
+	const int version; /* api version */
 
 	int prime_fd; /* dma-buf file descriptor */
 	int width; /* width of buffer in pixels */
@@ -51,6 +52,7 @@ struct alloc_handle_t {
 	} __attribute__((aligned(8)));
 };
 
+#define ALLOC_HANDLE_VERSION 1
 #define ALLOC_HANDLE_MAGIC 0x60585350
 #define ALLOC_HANDLE_NUM_FDS 1
 #define ALLOC_HANDLE_NUM_INTS (	\
@@ -63,7 +65,9 @@ struct alloc_handle_t {
 struct alloc_handle_t *alloc_handle_create(int width, int height, int format,
 	                                       int usage)
 {
-	struct alloc_handle_t handle = { .magic = ALLOC_HANDLE_MAGIC };
+	struct alloc_handle_t handle = {
+		.magic = ALLOC_HANDLE_MAGIC,
+		.version = ALLOC_HANDLE_VERSION };
 
 	handle->base.version = sizeof(handle->base);
 	handle->base.numInts = ALLOC_HANDLE_NUM_INTS;
-- 
2.14.1



More information about the mesa-dev mailing list