check for __FreeBSD_kernel__ (bug 3810)
[platform/upstream/libdrm.git] / shared-core / drm.h
index 0d90762..87f8da6 100644 (file)
 #define __user
 #endif
 
+#ifdef __GNUC__
+# define DEPRECATED  __attribute__ ((deprecated))
+#else
+# define DEPRECATED
+#endif
+
 #if defined(__linux__)
+#if defined(__KERNEL__)
 #include <linux/config.h>
+#endif
 #include <asm/ioctl.h>         /* For _IO* macros */
 #define DRM_IOCTL_NR(n)                _IOC_NR(n)
 #define DRM_IOC_VOID           _IOC_NONE
@@ -71,8 +79,8 @@
 #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)
-#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
-#if defined(__FreeBSD__) && defined(IN_MODULE)
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
+#if (defined(__FreeBSD__) || defined(__FreeBSD_kernel__)) && defined(IN_MODULE)
 /* Prevent name collision when including sys/ioccom.h */
 #undef ioctl
 #include <sys/ioccom.h>
 #if defined(__linux__) || defined(__NetBSD__)
 #define DRM_MAJOR       226
 #endif
-#define DRM_MAX_MINOR   255
+#define DRM_MAX_MINOR   15
 #endif
 #define DRM_NAME       "drm"     /**< Name in kernel, /dev, and /proc */
 #define DRM_MIN_ORDER  5         /**< At least 2^5 bytes = 32 bytes */
 #define _DRM_LOCK_IS_CONT(lock)           ((lock) & _DRM_LOCK_CONT)
 #define _DRM_LOCKING_CONTEXT(lock) ((lock) & ~(_DRM_LOCK_HELD|_DRM_LOCK_CONT))
 
+#if defined(__linux__)
+typedef unsigned int drm_handle_t;
+#else
 typedef unsigned long drm_handle_t;    /**< To mapped regions */
+#endif
 typedef unsigned int drm_context_t;    /**< GLXContext handle */
 typedef unsigned int drm_drawable_t;
 typedef unsigned int drm_magic_t;      /**< Magic for authentication */
@@ -246,7 +258,8 @@ typedef enum drm_map_type {
        _DRM_REGISTERS = 1,       /**< no caching, no core dump */
        _DRM_SHM = 2,             /**< shared, cached */
        _DRM_AGP = 3,             /**< AGP/GART */
-       _DRM_SCATTER_GATHER = 4   /**< Scatter/gather memory for PCI DMA */
+       _DRM_SCATTER_GATHER = 4,  /**< Scatter/gather memory for PCI DMA */
+       _DRM_CONSISTENT = 5       /**< Consistent memory for PCI DMA */
 } drm_map_type_t;
 
 /**
@@ -394,7 +407,8 @@ typedef struct drm_buf_desc {
        enum {
                _DRM_PAGE_ALIGN = 0x01, /**< Align on page boundaries for DMA */
                _DRM_AGP_BUFFER = 0x02, /**< Buffer is in AGP space */
-               _DRM_SG_BUFFER = 0x04   /**< Scatter/gather memory buffer */
+               _DRM_SG_BUFFER  = 0x04, /**< Scatter/gather memory buffer */
+               _DRM_FB_BUFFER  = 0x08  /**< Buffer is in frame buffer */
        } flags;
        unsigned long agp_start; /**<
                                  * Start address of where the AGP buffers are
@@ -435,7 +449,11 @@ typedef struct drm_buf_pub {
  */
 typedef struct drm_buf_map {
        int count;              /**< Length of the buffer list */
+#if defined(__cplusplus)
+       void __user *c_virtual;
+#else
        void __user *virtual;           /**< Mmap'd area in user-virtual */
+#endif
        drm_buf_pub_t __user *list;     /**< Buffer information */
 } drm_buf_map_t;