OSDN Git Service

nouveau: fix bo mapping issue
[android-x86/external-libdrm.git] / shared-core / drm.h
index 7b69a63..97fab9a 100644 (file)
 # define DEPRECATED  __attribute__ ((deprecated))
 #else
 # define DEPRECATED
+# ifndef __FUNCTION__
+#  define __FUNCTION__ __func__ /* C99 */
+# endif
+# ifndef __volatile__
+#  define __volatile__ volatile
+# endif
 #endif
 
 #if defined(__linux__)
@@ -236,7 +242,8 @@ enum drm_map_type {
        _DRM_AGP = 3,             /**< AGP/GART */
        _DRM_SCATTER_GATHER = 4,  /**< Scatter/gather memory for PCI DMA */
        _DRM_CONSISTENT = 5,      /**< Consistent memory for PCI DMA */
-       _DRM_TTM = 6
+       _DRM_GEM = 6,
+       _DRM_TTM = 7,
 };
 
 /**
@@ -555,10 +562,9 @@ union drm_wait_vblank {
        struct drm_wait_vblank_reply reply;
 };
 
-enum drm_modeset_ctl_cmd {
-       _DRM_PRE_MODESET = 1,
-       _DRM_POST_MODESET = 2,
-};
+
+#define _DRM_PRE_MODESET 1
+#define _DRM_POST_MODESET 2
 
 /**
  * DRM_IOCTL_MODESET_CTL ioctl argument type
@@ -566,8 +572,8 @@ enum drm_modeset_ctl_cmd {
  * \sa drmModesetCtl().
  */
 struct drm_modeset_ctl {
-       unsigned long arg;
-       enum drm_modeset_ctl_cmd cmd;
+       uint32_t crtc;
+       uint32_t cmd;
 };
 
 /**
@@ -960,69 +966,12 @@ struct drm_mm_info_arg {
        uint64_t p_size;
 };
 
-
-struct drm_gem_create {
-       /**
-        * Requested size for the object.
-        *
-        * The (page-aligned) allocated size for the object will be returned.
-        */
-       uint64_t size;
-       /**
-        * Returned handle for the object.
-        *
-        * Object handles are nonzero.
-        */
-       uint32_t handle;
-       uint32_t pad;
-};
-
 struct drm_gem_close {
        /** Handle of the object to be closed. */
        uint32_t handle;
        uint32_t pad;
 };
 
-struct drm_gem_pread {
-       /** Handle for the object being read. */
-       uint32_t handle;
-       uint32_t pad;
-       /** Offset into the object to read from */
-       uint64_t offset;
-       /** Length of data to read */
-       uint64_t size;
-       /** Pointer to write the data into. */
-       uint64_t data_ptr;      /* void *, but pointers are not 32/64 compatible */
-};
-
-struct drm_gem_pwrite {
-       /** Handle for the object being written to. */
-       uint32_t handle;
-       uint32_t pad;
-       /** Offset into the object to write to */
-       uint64_t offset;
-       /** Length of data to write */
-       uint64_t size;
-       /** Pointer to read the data from. */
-       uint64_t data_ptr;      /* void *, but pointers are not 32/64 compatible */
-};
-
-struct drm_gem_mmap {
-       /** Handle for the object being mapped. */
-       uint32_t handle;
-       uint32_t pad;
-       /** Offset in the object to map. */
-       uint64_t offset;
-       /**
-        * Length of data to map.
-        *
-        * The value will be page-aligned.
-        */
-       uint64_t size;
-       /** Returned pointer the data was mapped at */
-       uint64_t addr_ptr;      /* void *, but pointers are not 32/64 compatible */
-};
-
 struct drm_gem_flink {
        /** Handle for the object being named */
        uint32_t handle;
@@ -1042,18 +991,7 @@ struct drm_gem_open {
        uint64_t size;
 };
 
-struct drm_gem_set_domain {
-       /** Handle for the object */
-       uint32_t handle;
-
-       /** New read domains */
-       uint32_t read_domains;
-
-       /** New write domain */
-       uint32_t write_domain;
-};
-
-#define DRM_GEM_DOMAIN_CPU             0x00000001
+#include "drm_mode.h"
 
 /**
  * \name Ioctls Definitions
@@ -1076,6 +1014,10 @@ struct drm_gem_set_domain {
 #define DRM_IOCTL_SET_VERSION          DRM_IOWR(0x07, struct drm_set_version)
 #define DRM_IOCTL_MODESET_CTL           DRM_IOW(0x08,  struct drm_modeset_ctl)
 
+#define DRM_IOCTL_GEM_CLOSE            DRM_IOW (0x09, struct drm_gem_close)
+#define DRM_IOCTL_GEM_FLINK            DRM_IOWR(0x0a, struct drm_gem_flink)
+#define DRM_IOCTL_GEM_OPEN             DRM_IOWR(0x0b, struct drm_gem_open)
+
 #define DRM_IOCTL_SET_UNIQUE           DRM_IOW( 0x10, struct drm_unique)
 #define DRM_IOCTL_AUTH_MAGIC           DRM_IOW( 0x11, struct drm_auth)
 #define DRM_IOCTL_BLOCK                        DRM_IOWR(0x12, struct drm_block)
@@ -1093,6 +1035,9 @@ struct drm_gem_set_domain {
 #define DRM_IOCTL_SET_SAREA_CTX                DRM_IOW( 0x1c, struct drm_ctx_priv_map)
 #define DRM_IOCTL_GET_SAREA_CTX                DRM_IOWR(0x1d, struct drm_ctx_priv_map)
 
+#define DRM_IOCTL_SET_MASTER            DRM_IO(0x1e)
+#define DRM_IOCTL_DROP_MASTER           DRM_IO(0x1f)
+
 #define DRM_IOCTL_ADD_CTX              DRM_IOWR(0x20, struct drm_ctx)
 #define DRM_IOCTL_RM_CTX               DRM_IOWR(0x21, struct drm_ctx)
 #define DRM_IOCTL_MOD_CTX              DRM_IOW( 0x22, struct drm_ctx)
@@ -1116,22 +1061,13 @@ struct drm_gem_set_domain {
 #define DRM_IOCTL_AGP_BIND             DRM_IOW( 0x36, struct drm_agp_binding)
 #define DRM_IOCTL_AGP_UNBIND           DRM_IOW( 0x37, struct drm_agp_binding)
 
-#define DRM_IOCTL_SG_ALLOC             DRM_IOW0x38, struct drm_scatter_gather)
+#define DRM_IOCTL_SG_ALLOC             DRM_IOWR(0x38, struct drm_scatter_gather)
 #define DRM_IOCTL_SG_FREE              DRM_IOW( 0x39, struct drm_scatter_gather)
 
 #define DRM_IOCTL_WAIT_VBLANK          DRM_IOWR(0x3a, union drm_wait_vblank)
 
 #define DRM_IOCTL_UPDATE_DRAW           DRM_IOW(0x3f, struct drm_update_draw)
 
-#define DRM_IOCTL_GEM_CREATE           DRM_IOWR(0x09, struct drm_gem_create)
-#define DRM_IOCTL_GEM_CLOSE            DRM_IOW (0x0a, struct drm_gem_close)
-#define DRM_IOCTL_GEM_PREAD            DRM_IOW (0x0b, struct drm_gem_pread)
-#define DRM_IOCTL_GEM_PWRITE           DRM_IOW (0x0c, struct drm_gem_pwrite)
-#define DRM_IOCTL_GEM_MMAP             DRM_IOWR(0x0d, struct drm_gem_mmap)
-#define DRM_IOCTL_GEM_FLINK            DRM_IOWR(0x0e, struct drm_gem_flink)
-#define DRM_IOCTL_GEM_OPEN             DRM_IOWR(0x0f, struct drm_gem_open)
-#define DRM_IOCTL_GEM_SET_DOMAIN       DRM_IOW (0xb7, struct drm_gem_set_domain)
-
 #define DRM_IOCTL_MM_INIT               DRM_IOWR(0xc0, struct drm_mm_init_arg)
 #define DRM_IOCTL_MM_TAKEDOWN           DRM_IOWR(0xc1, struct drm_mm_type_arg)
 #define DRM_IOCTL_MM_LOCK               DRM_IOWR(0xc2, struct drm_mm_type_arg)
@@ -1157,6 +1093,28 @@ struct drm_gem_set_domain {
 #define DRM_IOCTL_BO_VERSION          DRM_IOR(0xd6, struct drm_bo_version_arg)
 #define DRM_IOCTL_MM_INFO               DRM_IOWR(0xd7, struct drm_mm_info_arg)
 
+#define DRM_IOCTL_MODE_GETRESOURCES     DRM_IOWR(0xA0, struct drm_mode_card_res)
+
+#define DRM_IOCTL_MODE_GETCRTC          DRM_IOWR(0xA1, struct drm_mode_crtc)
+#define DRM_IOCTL_MODE_SETCRTC         DRM_IOWR(0xA2, struct drm_mode_crtc)
+#define DRM_IOCTL_MODE_CURSOR          DRM_IOWR(0xA3, struct drm_mode_cursor)
+#define DRM_IOCTL_MODE_GETGAMMA                DRM_IOWR(0xA4, struct drm_mode_crtc_lut)
+#define DRM_IOCTL_MODE_SETGAMMA                DRM_IOWR(0xA5, struct drm_mode_crtc_lut)
+
+#define DRM_IOCTL_MODE_GETENCODER      DRM_IOWR(0xA6, struct drm_mode_get_encoder)
+
+#define DRM_IOCTL_MODE_GETCONNECTOR    DRM_IOWR(0xA7, struct drm_mode_get_connector)
+#define DRM_IOCTL_MODE_ATTACHMODE      DRM_IOWR(0xA8, struct drm_mode_mode_cmd)
+#define DRM_IOCTL_MODE_DETACHMODE      DRM_IOWR(0xA9, struct drm_mode_mode_cmd)
+#define DRM_IOCTL_MODE_GETPROPERTY     DRM_IOWR(0xAA, struct drm_mode_get_property)
+#define DRM_IOCTL_MODE_SETPROPERTY     DRM_IOWR(0xAB, struct drm_mode_connector_set_property)
+#define DRM_IOCTL_MODE_GETPROPBLOB     DRM_IOWR(0xAC, struct drm_mode_get_blob)
+
+#define DRM_IOCTL_MODE_GETFB           DRM_IOWR(0xAD, struct drm_mode_fb_cmd)
+#define DRM_IOCTL_MODE_ADDFB           DRM_IOWR(0xAE, struct drm_mode_fb_cmd)
+#define DRM_IOCTL_MODE_RMFB            DRM_IOWR(0xAF, uint32_t)
+#define DRM_IOCTL_MODE_REPLACEFB       DRM_IOWR(0xB0, struct drm_mode_fb_cmd)
+
 /*@}*/
 
 /**
@@ -1171,7 +1129,7 @@ struct drm_gem_set_domain {
 #define DRM_COMMAND_END                 0xA0
 
 /* typedef area */
-#if !defined(__KERNEL__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)
+#ifndef __KERNEL__
 typedef struct drm_clip_rect drm_clip_rect_t;
 typedef struct drm_tex_region drm_tex_region_t;
 typedef struct drm_hw_lock drm_hw_lock_t;