From 9c0bd9687fe7d20f2f0793332ae0db06f035eb23 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Wed, 30 Nov 2005 22:59:22 +0000 Subject: Import libdrm 2.0 --- hw/xfree86/os-support/drm/xf86drm.c | 30 +++++++++++++++++------------- hw/xfree86/os-support/drm/xf86drmHash.c | 4 ++++ hw/xfree86/os-support/drm/xf86drmRandom.c | 4 ++++ hw/xfree86/os-support/drm/xf86drmSL.c | 4 ++++ hw/xfree86/os-support/xf86drm.h | 12 ++++++------ 5 files changed, 35 insertions(+), 19 deletions(-) diff --git a/hw/xfree86/os-support/drm/xf86drm.c b/hw/xfree86/os-support/drm/xf86drm.c index 1082f225a..0980e7884 100644 --- a/hw/xfree86/os-support/drm/xf86drm.c +++ b/hw/xfree86/os-support/drm/xf86drm.c @@ -33,6 +33,10 @@ /* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c,v 1.36 2003/08/24 17:35:35 tsi Exp $ */ +#ifdef HAVE_XORG_CONFIG_H +#include +#endif + #ifdef XFree86Server # include "xf86.h" # include "xf86_OSproc.h" @@ -83,7 +87,7 @@ extern unsigned long _bus_base(void); #include "xf86drm.h" -#ifdef __FreeBSD__ +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) #define DRM_MAJOR 145 #endif @@ -887,7 +891,7 @@ int drmAddMap(int fd, map.type = type; map.flags = flags; if (ioctl(fd, DRM_IOCTL_ADD_MAP, &map)) return -errno; - if (handle) *handle = (drm_handle_t)map.handle; + if (handle) *handle = (drm_handle_t)(unsigned long)map.handle; return 0; } @@ -895,7 +899,7 @@ int drmRmMap(int fd, drm_handle_t handle) { drm_map_t map; - map.handle = (void *)handle; + map.handle = (void *)(unsigned long)handle; if(ioctl(fd, DRM_IOCTL_RM_MAP, &map)) return -errno; return 0; @@ -1498,7 +1502,7 @@ int drmAgpEnable(int fd, unsigned long mode) * arguments in a drm_agp_buffer structure. */ int drmAgpAlloc(int fd, unsigned long size, unsigned long type, - unsigned long *address, unsigned long *handle) + unsigned long *address, drm_handle_t *handle) { drm_agp_buffer_t b; @@ -1525,7 +1529,7 @@ int drmAgpAlloc(int fd, unsigned long size, unsigned long type, * This function is a wrapper around the DRM_IOCTL_AGP_FREE ioctl, passing the * argument in a drm_agp_buffer structure. */ -int drmAgpFree(int fd, unsigned long handle) +int drmAgpFree(int fd, drm_handle_t handle) { drm_agp_buffer_t b; @@ -1549,7 +1553,7 @@ int drmAgpFree(int fd, unsigned long handle) * This function is a wrapper around the DRM_IOCTL_AGP_BIND ioctl, passing the * argument in a drm_agp_binding structure. */ -int drmAgpBind(int fd, unsigned long handle, unsigned long offset) +int drmAgpBind(int fd, drm_handle_t handle, unsigned long offset) { drm_agp_binding_t b; @@ -1572,7 +1576,7 @@ int drmAgpBind(int fd, unsigned long handle, unsigned long offset) * This function is a wrapper around the DRM_IOCTL_AGP_UNBIND ioctl, passing * the argument in a drm_agp_binding structure. */ -int drmAgpUnbind(int fd, unsigned long handle) +int drmAgpUnbind(int fd, drm_handle_t handle) { drm_agp_binding_t b; @@ -1762,7 +1766,7 @@ unsigned int drmAgpDeviceId(int fd) return i.id_device; } -int drmScatterGatherAlloc(int fd, unsigned long size, unsigned long *handle) +int drmScatterGatherAlloc(int fd, unsigned long size, drm_handle_t *handle) { drm_scatter_gather_t sg; @@ -1774,7 +1778,7 @@ int drmScatterGatherAlloc(int fd, unsigned long size, unsigned long *handle) return 0; } -int drmScatterGatherFree(int fd, unsigned long handle) +int drmScatterGatherFree(int fd, drm_handle_t handle) { drm_scatter_gather_t sg; @@ -1941,7 +1945,7 @@ int drmAddContextPrivateMapping(int fd, drm_context_t ctx_id, drm_handle_t handl drm_ctx_priv_map_t map; map.ctx_id = ctx_id; - map.handle = (void *)handle; + map.handle = (void *)(unsigned long)handle; if (ioctl(fd, DRM_IOCTL_SET_SAREA_CTX, &map)) return -errno; return 0; @@ -1954,7 +1958,7 @@ int drmGetContextPrivateMapping(int fd, drm_context_t ctx_id, drm_handle_t * han map.ctx_id = ctx_id; if (ioctl(fd, DRM_IOCTL_GET_SAREA_CTX, &map)) return -errno; - if (handle) *handle = (drm_handle_t)map.handle; + if (handle) *handle = (drm_handle_t)(unsigned long)map.handle; return 0; } @@ -1971,7 +1975,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 = (drm_handle_t)(unsigned long)map.handle; *mtrr = map.mtrr; return 0; } @@ -1994,7 +1998,7 @@ int drmGetClient(int fd, int idx, int *auth, int *pid, int *uid, int drmGetStats(int fd, drmStatsT *stats) { drm_stats_t s; - int i; + unsigned int i; if (ioctl(fd, DRM_IOCTL_GET_STATS, &s)) return -errno; diff --git a/hw/xfree86/os-support/drm/xf86drmHash.c b/hw/xfree86/os-support/drm/xf86drmHash.c index 368dfe214..4fbc88a12 100644 --- a/hw/xfree86/os-support/drm/xf86drmHash.c +++ b/hw/xfree86/os-support/drm/xf86drmHash.c @@ -70,6 +70,10 @@ * */ +#ifdef HAVE_XORG_CONFIG_H +#include +#endif + #define HASH_MAIN 0 #if HASH_MAIN diff --git a/hw/xfree86/os-support/drm/xf86drmRandom.c b/hw/xfree86/os-support/drm/xf86drmRandom.c index 8db57a506..301aaf4c2 100644 --- a/hw/xfree86/os-support/drm/xf86drmRandom.c +++ b/hw/xfree86/os-support/drm/xf86drmRandom.c @@ -73,6 +73,10 @@ * */ +#ifdef HAVE_XORG_CONFIG_H +#include +#endif + #define RANDOM_MAIN 0 #if RANDOM_MAIN diff --git a/hw/xfree86/os-support/drm/xf86drmSL.c b/hw/xfree86/os-support/drm/xf86drmSL.c index 41e36a735..5f3c88d23 100644 --- a/hw/xfree86/os-support/drm/xf86drmSL.c +++ b/hw/xfree86/os-support/drm/xf86drmSL.c @@ -40,6 +40,10 @@ * */ +#ifdef HAVE_XORG_CONFIG_H +#include +#endif + #define SL_MAIN 0 #if SL_MAIN diff --git a/hw/xfree86/os-support/xf86drm.h b/hw/xfree86/os-support/xf86drm.h index 30496d0d4..4be417a62 100644 --- a/hw/xfree86/os-support/xf86drm.h +++ b/hw/xfree86/os-support/xf86drm.h @@ -577,11 +577,11 @@ extern int drmAgpRelease(int fd); extern int drmAgpEnable(int fd, unsigned long mode); extern int drmAgpAlloc(int fd, unsigned long size, unsigned long type, unsigned long *address, - unsigned long *handle); -extern int drmAgpFree(int fd, unsigned long handle); -extern int drmAgpBind(int fd, unsigned long handle, + drm_handle_t *handle); +extern int drmAgpFree(int fd, drm_handle_t handle); +extern int drmAgpBind(int fd, drm_handle_t handle, unsigned long offset); -extern int drmAgpUnbind(int fd, unsigned long handle); +extern int drmAgpUnbind(int fd, drm_handle_t handle); /* AGP/GART info: authenticated client and/or X */ extern int drmAgpVersionMajor(int fd); @@ -596,8 +596,8 @@ extern unsigned int drmAgpDeviceId(int fd); /* PCI scatter/gather support: X server (root) only */ extern int drmScatterGatherAlloc(int fd, unsigned long size, - unsigned long *handle); -extern int drmScatterGatherFree(int fd, unsigned long handle); + drm_handle_t *handle); +extern int drmScatterGatherFree(int fd, drm_handle_t handle); extern int drmWaitVBlank(int fd, drmVBlankPtr vbl); -- cgit v1.2.3