On Wed, 2009-12-23 at 21:36 +0100, Luca Tettamanti wrote: > 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 :)
It's size varies with architecture on non-linux. This patch shouldn't cause issues, however I would personally really like to see drm_handle_t used consistently and correctly. If handle were declared as drm_handle_t it would avoid a lot of casting in libdrm and would have allowed me to reliably use arbitrary handles for maps on both i386 and amd64, by defining drm_handle_t to off_t. As it happens, that requires minor touching of some of the DDX drivers though. robert. > 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 -- Robert Noland <rnol...@2hip.net> 2Hip Networks ------------------------------------------------------------------------------ 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