summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMauro Rossi <issor.oruam@gmail.com>2015-11-08 16:29:34 +0100
committerChih-Wei Huang <cwhuang@linux.org.tw>2015-11-14 00:18:41 +0800
commit9b65142921951368fa53e48508b388cadeb55854 (patch)
tree62390844e5c85f2e1c71635f762b49358e1893b9
parent08a2f0784724205c457e357a75636c04a83a99bd (diff)
downloadexternal_drm_gralloc-9b65142921951368fa53e48508b388cadeb55854.zip
external_drm_gralloc-9b65142921951368fa53e48508b388cadeb55854.tar.gz
external_drm_gralloc-9b65142921951368fa53e48508b388cadeb55854.tar.bz2
fix GRALLOC_DRM_HANDLE_NUM_INTS definition for 64-bit
As highlighted by pstglia current definition of GRALLOC_DRM_HANDLE_NUM_INTS causes issues with 64-bit, because a pointer is accounted as having size of an integer, which is not applicable to 64-bit pointer The same definition adopted in AOSP hardware/drm_gralloc master branch has been used, without changing the structure of gralloc_drm_handle_t.
-rw-r--r--gralloc_drm_handle.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/gralloc_drm_handle.h b/gralloc_drm_handle.h
index 7fc4746..201716e 100644
--- a/gralloc_drm_handle.h
+++ b/gralloc_drm_handle.h
@@ -36,9 +36,6 @@ struct gralloc_drm_bo_t;
struct gralloc_drm_handle_t {
native_handle_t base;
-#define GRALLOC_DRM_HANDLE_MAGIC 0x12345678
-#define GRALLOC_DRM_HANDLE_NUM_INTS 10
-#define GRALLOC_DRM_HANDLE_NUM_FDS 0
int magic;
int width;
@@ -55,6 +52,12 @@ struct gralloc_drm_handle_t {
struct gralloc_drm_bo_t *data; /* pointer to struct gralloc_drm_bo_t */
};
+#define GRALLOC_DRM_HANDLE_MAGIC 0x12345678
+#define GRALLOC_DRM_HANDLE_NUM_FDS 0
+#define GRALLOC_DRM_HANDLE_NUM_INTS ( \
+ ((sizeof(struct gralloc_drm_handle_t) - sizeof(native_handle_t))/sizeof(int)) \
+ - GRALLOC_DRM_HANDLE_NUM_FDS)
+
static inline struct gralloc_drm_handle_t *gralloc_drm_handle(buffer_handle_t _handle)
{
struct gralloc_drm_handle_t *handle =