summaryrefslogtreecommitdiff
path: root/android
diff options
context:
space:
mode:
authorRobert Foss <robert.foss@collabora.com>2018-01-16 14:36:13 +0100
committerRobert Foss <robert.foss@collabora.com>2018-02-14 17:33:57 +0100
commit76cd0af39960d0c36e7aacd4fe8d6a08f4af8ecc (patch)
treee097741a140aeac81590d68acdaa90a43293ceee /android
parenta4b6fd651f1b34f13eb3a3bc101a34adfa3b54a5 (diff)
android: Add version variable to gralloc_handle_t
The version variable will be used for versioning of this struct and the corresponding accessor functions. Signed-off-by: Robert Foss <robert.foss@collabora.com> Reviewed-by: Rob Herring <robh@kernel.org>
Diffstat (limited to 'android')
-rw-r--r--android/gralloc_handle.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/android/gralloc_handle.h b/android/gralloc_handle.h
index 45b9f2e9..7cbc8ee7 100644
--- a/android/gralloc_handle.h
+++ b/android/gralloc_handle.h
@@ -27,6 +27,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
@@ -49,7 +50,9 @@ struct gralloc_handle_t {
*/
int prime_fd;
+ /* api variables */
int magic; /* differentiate between allocator impls */
+ const uint32_t version; /* api version */
int width; /* width of buffer in pixels */
int height; /* height of buffer in pixels */
@@ -67,6 +70,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 ( \
@@ -79,7 +83,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 };
native_handle_t *nhandle = native_handle_create(GRALLOC_HANDLE_NUM_FDS,
GRALLOC_HANDLE_NUM_INTS);