fix building issues of 64-bit targets
Just change the 'data' field of gralloc_drm_handle_t
to be a pointer to struct gralloc_drm_bo_t.
Fix some warnings as well.
diff --git a/gralloc_drm.c b/gralloc_drm.c
index bd38d57..31ac988 100644
--- a/gralloc_drm.c
+++ b/gralloc_drm.c
@@ -211,10 +211,10 @@
}
handle->data_owner = gralloc_drm_get_pid();
- handle->data = (int) bo;
+ handle->data = bo;
}
- return (struct gralloc_drm_bo_t *) handle->data;
+ return handle->data;
}
/*
@@ -296,7 +296,7 @@
bo->refcount = 1;
handle->data_owner = gralloc_drm_get_pid();
- handle->data = (int) bo;
+ handle->data = bo;
return bo;
}
@@ -365,7 +365,7 @@
uint32_t *pitches, uint32_t *offsets, uint32_t *handles)
{
struct gralloc_drm_handle_t *handle = gralloc_drm_handle(_handle);
- struct gralloc_drm_bo_t *bo = (struct gralloc_drm_bo_t *) handle->data;
+ struct gralloc_drm_bo_t *bo = handle->data;
struct gralloc_drm_t *drm = bo->drm;
/* if handle exists and driver implements resolve_format */
diff --git a/gralloc_drm_handle.h b/gralloc_drm_handle.h
index f7b03b2..7fc4746 100644
--- a/gralloc_drm_handle.h
+++ b/gralloc_drm_handle.h
@@ -31,6 +31,8 @@
extern "C" {
#endif
+struct gralloc_drm_bo_t;
+
struct gralloc_drm_handle_t {
native_handle_t base;
@@ -50,7 +52,7 @@
int stride; /* the stride in bytes */
int data_owner; /* owner of data (for validation) */
- int data; /* pointer to struct gralloc_drm_bo_t */
+ struct gralloc_drm_bo_t *data; /* pointer to struct gralloc_drm_bo_t */
};
static inline struct gralloc_drm_handle_t *gralloc_drm_handle(buffer_handle_t _handle)
diff --git a/gralloc_drm_kms.c b/gralloc_drm_kms.c
index 0909361..cb02a13 100644
--- a/gralloc_drm_kms.c
+++ b/gralloc_drm_kms.c
@@ -299,7 +299,7 @@
uint32_t src_w,
uint32_t src_h)
{
- unsigned int i, j;
+ int j;
struct gralloc_drm_handle_t *drm_handle =
gralloc_drm_handle(handle);
int plane_count = drm->plane_resources->count_planes;
@@ -1092,15 +1092,14 @@
if (!drm->plane_resources) {
ALOGD("no planes found from drm resources");
} else {
+ unsigned int i, j;
+
ALOGD("supported drm planes and formats");
/* fill a helper structure for hwcomposer */
drm->planes = calloc(drm->plane_resources->count_planes,
sizeof(struct gralloc_drm_plane_t));
for (i = 0; i < drm->plane_resources->count_planes; i++) {
-
- unsigned int j;
-
drm->planes[i].drm_plane = drmModeGetPlane(drm->fd,
drm->plane_resources->planes[i]);