A drm_handle_t can be safely converted to a pointer and back even on a
64bit platform (where the size is not the same).

Signed-off-by: Luca Tettamanti <kronos...@gmail.com>
---
I looked at the kernel part of the ioctl and it seems that the handle is
always a 32bit quantity, but please double check this patch :)

 xf86drm.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/xf86drm.c b/xf86drm.c
index 220aaa1..fcaf3f5 100644
--- a/xf86drm.c
+++ b/xf86drm.c
@@ -959,7 +959,7 @@ int drmAddMap(int fd, drm_handle_t offset, drmSize size, 
drmMapType type,
     if (drmIoctl(fd, DRM_IOCTL_ADD_MAP, &map))
        return -errno;
     if (handle)
-       *handle = (drm_handle_t)map.handle;
+       *handle = (drm_handle_t)(unsigned long)map.handle;
     return 0;
 }
 
@@ -967,7 +967,7 @@ int drmRmMap(int fd, drm_handle_t handle)
 {
     drm_map_t map;
 
-    map.handle = (void *)handle;
+    map.handle = (void *)(unsigned long)handle;
 
     if(drmIoctl(fd, DRM_IOCTL_RM_MAP, &map))
        return -errno;
@@ -2103,7 +2103,7 @@ int drmAddContextPrivateMapping(int fd, drm_context_t 
ctx_id,
     drm_ctx_priv_map_t map;
 
     map.ctx_id = ctx_id;
-    map.handle = (void *)handle;
+    map.handle = (void *)(unsigned long)handle;
 
     if (drmIoctl(fd, DRM_IOCTL_SET_SAREA_CTX, &map))
        return -errno;
@@ -2120,7 +2120,7 @@ int drmGetContextPrivateMapping(int fd, drm_context_t 
ctx_id,
     if (drmIoctl(fd, DRM_IOCTL_GET_SAREA_CTX, &map))
        return -errno;
     if (handle)
-       *handle = (drm_handle_t)map.handle;
+       *handle = (drm_handle_t)(unsigned long)map.handle;
 
     return 0;
 }


Luca
-- 
La mia opinione puo` essere cambiata, ma non il fatto che ho ragione.

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
--
_______________________________________________
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel

Reply via email to