From: "Matthew W. S. Bell" Subject: [PATCH] drm_handle_t type Date: Sat, 10 Apr 2010 19:30:51 +0100 Message-ID: <1270924251.20809.33.camel@ibis.bells> References: <1270259956.4292.6.camel@ibis.bells> <1270300193.20809.13.camel@ibis.bells> Reply-To: matthew@bells23.org.uk, dri-devel@lists.sourceforge.net Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============4241804803908459824==" Return-path: In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.sourceforge.net To: Dave Airlie Cc: Dave Airlie , dri-devel@lists.sourceforge.net List-Id: dri-devel@lists.freedesktop.org --===============4241804803908459824== Content-Type: multipart/signed; micalg="pgp-sha1"; protocol="application/pgp-signature"; boundary="=-A2VqqXaTTjaWahLbC3iD" --=-A2VqqXaTTjaWahLbC3iD Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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. =46rom a92f45396cd13f91ffd0bd1ea27250e5606184f8 Mon Sep 17 00:00:00 2001 From: Matthew W. S. Bell Date: Fri, 9 Apr 2010 02:58:42 +0100 =09 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 =3D (drm_handle_t)map.handle; + *handle =3D (uintptr_t)map.handle; return 0; } =20 @@ -967,7 +967,7 @@ int drmRmMap(int fd, drm_handle_t handle) { drm_map_t map; =20 - map.handle =3D (void *)handle; + map.handle =3D (void *)(uintptr_t)handle; =20 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; =20 map.ctx_id =3D ctx_id; - map.handle =3D (void *)handle; + map.handle =3D (void *)(uintptr_t)handle; =20 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 =3D (drm_handle_t)map.handle; + *handle =3D (uintptr_t)map.handle; =20 return 0; } @@ -2138,7 +2138,7 @@ int drmGetMap(int fd, int idx, drm_handle_t *offset, = drmSize *size, *size =3D map.size; *type =3D map.type; *flags =3D map.flags; - *handle =3D (unsigned long)map.handle; + *handle =3D (uintptr_t)map.handle; *mtrr =3D map.mtrr; return 0; } --=20 1.7.0 --=-A2VqqXaTTjaWahLbC3iD Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iQEcBAABAgAGBQJLwMPQAAoJEDyn+gO8EoIoc78H+gNYg5mlNEH6kCPQqwIz+euP GEBz2wFI9hpUxEkN9f2cHzVFbNQNxJkp7SIiiidDNis4lYQdACQ3LRJQA+hOS19e MMAkeinrxnfoj1GruasMHJ/rOvIZBE4Y/ZL1pSe2d9mV7iU6SPMjhpJHYsvTI9fl K2ukrqaLrtcNGXz/rxJ+KvSkUwrO32Zey7dL65uLx3EU10Jzg2dMiQfQ8LrbDZOI orpJEvLCT0hyz8KrpeekfzlDgv1QqxFsmWQU09IdmuTASlUBGhrMUXhQhozC6t6V btZNWX9lmBYvSaGGxfb9g6g1+S+62EoN6WKisG2STyE0vxqB2qcHh1s/5ARJ1Ro= =2gYQ -----END PGP SIGNATURE----- --=-A2VqqXaTTjaWahLbC3iD-- --===============4241804803908459824== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------------ Download Intel® 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 --===============4241804803908459824== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline -- _______________________________________________ Dri-devel mailing list Dri-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dri-devel --===============4241804803908459824==--