summaryrefslogtreecommitdiff
path: root/xf86drm.h
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@bitplanet.net>2009-11-23 18:25:08 -0500
committerKristian Høgsberg <krh@bitplanet.net>2009-11-23 18:25:11 -0500
commit500f5b524000ed5930301f4303744cb4c0a19b75 (patch)
treee115cebce78de39efee4a26faa14b39748862784 /xf86drm.h
parent863e39b56eea0ef95f9bde648fe4868d0b8e3f11 (diff)
downloadlibdrm-500f5b524000ed5930301f4303744cb4c0a19b75.tar.gz
libdrm-500f5b524000ed5930301f4303744cb4c0a19b75.tar.bz2
libdrm-500f5b524000ed5930301f4303744cb4c0a19b75.zip
Fix build on *BSD
This adds a minimal #ifdef clause to drm.h that we'll push upstream. Once that goes in we can share drm.h between linux, libdrm, and the bsd's.
Diffstat (limited to 'xf86drm.h')
-rw-r--r--xf86drm.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/xf86drm.h b/xf86drm.h
index 2cb9c9e9..cf7d1329 100644
--- a/xf86drm.h
+++ b/xf86drm.h
@@ -39,6 +39,28 @@
#include <stdint.h>
#include <drm.h>
+#if defined(__linux__)
+
+#define DRM_IOCTL_NR(n) _IOC_NR(n)
+#define DRM_IOC_VOID _IOC_NONE
+#define DRM_IOC_READ _IOC_READ
+#define DRM_IOC_WRITE _IOC_WRITE
+#define DRM_IOC_READWRITE _IOC_READ|_IOC_WRITE
+#define DRM_IOC(dir, group, nr, size) _IOC(dir, group, nr, size)
+#define DRM_MAJOR 226
+
+#else /* One of the *BSDs */
+
+#include <sys/ioccom.h>
+#define DRM_IOCTL_NR(n) ((n) & 0xff)
+#define DRM_IOC_VOID IOC_VOID
+#define DRM_IOC_READ IOC_OUT
+#define DRM_IOC_WRITE IOC_IN
+#define DRM_IOC_READWRITE IOC_INOUT
+#define DRM_IOC(dir, group, nr, size) _IOC(dir, group, nr, size)
+
+#endif
+
/* Defaults, if nothing set in xf86config */
#define DRM_DEV_UID 0
#define DRM_DEV_GID 0