On Mon, 2010-04-05 at 17:46 +1000, Dave Airlie wrote:
> Its probably not documented well anywhere, though I think the handles are
> 32-bit is written down somewhere.

Ah sorry, I missed some.

From a92f45396cd13f91ffd0bd1ea27250e5606184f8 Mon Sep 17 00:00:00 2001
From: Matthew W. S. Bell <matt...@bells23.org.uk>
Date: Fri, 9 Apr 2010 02:58:42 +0100            

Add a comment about content of void* variable exchanged with kernel.
Add casts to silence warnings about pointer to integer of a different
size assignment.
---
 include/drm/drm.h |    2 ++
 xf86drm.c         |   10 +++++-----
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/include/drm/drm.h b/include/drm/drm.h
index 4822159..e74d6d6 100644
--- a/include/drm/drm.h
+++ b/include/drm/drm.h
@@ -216,6 +216,8 @@ struct drm_map {
        enum drm_map_flags flags;        /**< Flags */
        void *handle;            /**< User-space: "Handle" to pass to mmap() */
                                 /**< Kernel-space: kernel-virtual address */
+                                /**  The value herein shall be the size of */
+                                /**  drm_handle_t despite the size of void *. 
*/
        int mtrr;                /**< MTRR slot used */
        /*   Private data */
 };
diff --git a/xf86drm.c b/xf86drm.c
index 220aaa1..35576fa 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 = (uintptr_t)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 *)(uintptr_t)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 *)(uintptr_t)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 = (uintptr_t)map.handle;
 
     return 0;
 }
@@ -2138,7 +2138,7 @@ int drmGetMap(int fd, int idx, drm_handle_t *offset, 
drmSize *size,
     *size   = map.size;
     *type   = map.type;
     *flags  = map.flags;
-    *handle = (unsigned long)map.handle;
+    *handle = (uintptr_t)map.handle;
     *mtrr   = map.mtrr;
     return 0;
 }
-- 
1.7.0


Attachment: signature.asc
Description: This is a digitally signed message part

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
--
_______________________________________________
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel

Reply via email to