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.
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;
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 =