OSDN Git Service

i915 make relocs use copy from user
[android-x86/external-libdrm.git] / shared-core / drm.h
index a9882d4..52de596 100644 (file)
@@ -135,14 +135,6 @@ struct drm_clip_rect {
 };
 
 /**
- * Drawable information.
- */
-struct drm_drawable_info {
-       unsigned int num_rects;
-       struct drm_clip_rect *rects;
-};
-
-/**
  * Texture region,
  */
 struct drm_tex_region {
@@ -257,7 +249,8 @@ enum drm_map_flags {
        _DRM_KERNEL = 0x08,          /**< kernel requires access */
        _DRM_WRITE_COMBINING = 0x10, /**< use write-combining if available */
        _DRM_CONTAINS_LOCK = 0x20,   /**< SHM page that contains lock */
-       _DRM_REMOVABLE = 0x40        /**< Removable mapping */
+       _DRM_REMOVABLE = 0x40,       /**< Removable mapping */
+       _DRM_DRIVER = 0x80           /**< Managed by driver */
 };
 
 struct drm_ctx_priv_map {
@@ -562,6 +555,21 @@ union drm_wait_vblank {
        struct drm_wait_vblank_reply reply;
 };
 
+typedef enum {
+       _DRM_PRE_MODESET = 1,
+       _DRM_POST_MODESET = 2,
+} drm_modeset_ctl_cmd_t;
+
+/**
+ * DRM_IOCTL_MODESET_CTL ioctl argument type
+ *
+ * \sa drmModesetCtl().
+ */
+typedef struct drm_modeset_ctl {
+       unsigned long arg;
+       drm_modeset_ctl_cmd_t cmd;
+} drm_modeset_ctl_t;
+
 /**
  * DRM_IOCTL_AGP_ENABLE ioctl argument type.
  *
@@ -639,6 +647,7 @@ struct drm_set_version {
 #define DRM_FENCE_FLAG_SHAREABLE           0x00000002
 #define DRM_FENCE_FLAG_WAIT_LAZY           0x00000004
 #define DRM_FENCE_FLAG_WAIT_IGNORE_SIGNALS 0x00000008
+#define DRM_FENCE_FLAG_NO_USER             0x00000010
 
 /* Reserved for driver use */
 #define DRM_FENCE_MASK_DRIVER              0xFF000000
@@ -647,12 +656,14 @@ struct drm_set_version {
 
 struct drm_fence_arg {
        unsigned int handle;
-       unsigned int class;
+       unsigned int fence_class;
        unsigned int type;
        unsigned int flags;
        unsigned int signaled;
+       unsigned int error;
+       unsigned int sequence;
        unsigned int pad64;
-       uint64_t expand_pad[3]; /*Future expansion */
+       uint64_t expand_pad[2]; /*Future expansion */
 };
 
 /* Buffer permissions, referring to how the GPU uses the buffers.
@@ -666,6 +677,10 @@ struct drm_fence_arg {
 #define DRM_BO_FLAG_EXE         (1ULL << 2)
 
 /*
+ * All of the bits related to access mode
+ */
+#define DRM_BO_MASK_ACCESS     (DRM_BO_FLAG_READ | DRM_BO_FLAG_WRITE | DRM_BO_FLAG_EXE)
+/*
  * Status flags. Can be read to determine the actual state of a buffer.
  * Can also be set in the buffer mask before validation.
  */
@@ -705,10 +720,21 @@ struct drm_fence_arg {
  */
 #define DRM_BO_FLAG_NO_MOVE     (1ULL << 8)
 
-/* Mask: Make sure the buffer is in cached memory when mapped for reading.
+/* Mask: Make sure the buffer is in cached memory when mapped.  In conjunction
+ * with DRM_BO_FLAG_CACHED it also allows the buffer to be bound into the GART
+ * with unsnooped PTEs instead of snooped, by using chipset-specific cache
+ * flushing at bind time.  A better name might be DRM_BO_FLAG_TT_UNSNOOPED,
+ * as the eviction to local memory (TTM unbind) on map is just a side effect
+ * to prevent aggressive cache prefetch from the GPU disturbing the cache
+ * management that the DRM is doing.
+ *
  * Flags: Acknowledge.
+ * Buffers allocated with this flag should not be used for suballocators
+ * This type may have issues on CPUs with over-aggressive caching
+ * http://marc.info/?l=linux-kernel&m=102376926732464&w=2
  */
-#define DRM_BO_FLAG_READ_CACHED    (1ULL << 19)
+#define DRM_BO_FLAG_CACHED_MAPPED    (1ULL << 19)
+
 
 /* Mask: Force DRM_BO_FLAG_CACHED flag strictly also if it is set.
  * Flags: Acknowledge.
@@ -720,6 +746,7 @@ struct drm_fence_arg {
  * Flags: Acknowledge.
  */
 #define DRM_BO_FLAG_FORCE_MAPPABLE (1ULL << 14)
+#define DRM_BO_FLAG_TILE           (1ULL << 15)
 
 /*
  * Memory type flags that can be or'ed together in the mask, but only
@@ -740,31 +767,56 @@ struct drm_fence_arg {
 #define DRM_BO_FLAG_MEM_PRIV4  (1ULL << 31)
 /* We can add more of these now with a 64-bit flag type */
 
-/* Memory flag mask */
+/*
+ * This is a mask covering all of the memory type flags; easier to just
+ * use a single constant than a bunch of | values. It covers
+ * DRM_BO_FLAG_MEM_LOCAL through DRM_BO_FLAG_MEM_PRIV4
+ */
 #define DRM_BO_MASK_MEM         0x00000000FF000000ULL
-#define DRM_BO_MASK_MEMTYPE     0x00000000FF0000A0ULL
-
+/*
+ * This adds all of the CPU-mapping options in with the memory
+ * type to label all bits which change how the page gets mapped
+ */
+#define DRM_BO_MASK_MEMTYPE     (DRM_BO_MASK_MEM | \
+                                DRM_BO_FLAG_CACHED_MAPPED | \
+                                DRM_BO_FLAG_CACHED | \
+                                DRM_BO_FLAG_MAPPABLE)
+                                
 /* Driver-private flags */
 #define DRM_BO_MASK_DRIVER      0xFFFF000000000000ULL
 
-/* Don't block on validate and map */
+/*
+ * Don't block on validate and map. Instead, return EBUSY.
+ */
 #define DRM_BO_HINT_DONT_BLOCK  0x00000002
-/* Don't place this buffer on the unfenced list.*/
+/*
+ * Don't place this buffer on the unfenced list. This means
+ * that the buffer will not end up having a fence associated
+ * with it as a result of this operation
+ */
 #define DRM_BO_HINT_DONT_FENCE  0x00000004
+/*
+ * Sleep while waiting for the operation to complete.
+ * Without this flag, the kernel will, instead, spin
+ * until this operation has completed. I'm not sure
+ * why you would ever want this, so please always
+ * provide DRM_BO_HINT_WAIT_LAZY to any operation
+ * which may block
+ */
 #define DRM_BO_HINT_WAIT_LAZY   0x00000008
-#define DRM_BO_HINT_ALLOW_UNFENCED_MAP 0x00000010
+/*
+ * The client has compute relocations refering to this buffer using the
+ * offset in the presumed_offset field. If that offset ends up matching
+ * where this buffer lands, the kernel is free to skip executing those
+ * relocations
+ */
+#define DRM_BO_HINT_PRESUMED_OFFSET 0x00000010
 
 #define DRM_BO_INIT_MAGIC 0xfe769812
-#define DRM_BO_INIT_MAJOR 0
-#define DRM_BO_INIT_MINOR 1
-
+#define DRM_BO_INIT_MAJOR 1
+#define DRM_BO_INIT_MINOR 0
+#define DRM_BO_INIT_PATCH 0
 
-enum drm_bo_type {
-       drm_bo_type_dc,
-       drm_bo_type_user,
-       drm_bo_type_fake,
-       drm_bo_type_kernel, /* for initial kernel allocations */
-};
 
 struct drm_bo_info_req {
        uint64_t mask;
@@ -772,28 +824,20 @@ struct drm_bo_info_req {
        unsigned int handle;
        unsigned int hint;
        unsigned int fence_class;
+       unsigned int desired_tile_stride;
+       unsigned int tile_info;
        unsigned int pad64;
+       uint64_t presumed_offset;
 };
 
 struct drm_bo_create_req {
-       uint64_t mask;
+       uint64_t flags;
        uint64_t size;
        uint64_t buffer_start;
        unsigned int hint;
        unsigned int page_alignment;
-       enum drm_bo_type type;
-       unsigned int pad64;
 };
 
-struct drm_bo_op_req {
-       enum {
-               drm_bo_validate,
-               drm_bo_fence,
-               drm_bo_ref_fence,
-       } op;
-       unsigned int arg_handle;
-       struct drm_bo_info_req bo_req;
-};
 
 /*
  * Reply flags
@@ -803,7 +847,7 @@ struct drm_bo_op_req {
 
 struct drm_bo_info_rep {
        uint64_t flags;
-       uint64_t mask;
+       uint64_t proposed_flags;
        uint64_t size;
        uint64_t offset;
        uint64_t arg_handle;
@@ -850,6 +894,17 @@ struct drm_bo_map_wait_idle_arg {
        } d;
 };
 
+struct drm_bo_op_req {
+       enum {
+               drm_bo_validate,
+               drm_bo_fence,
+               drm_bo_ref_fence,
+       } op;
+       unsigned int arg_handle;
+       struct drm_bo_info_req bo_req;
+};
+
+
 struct drm_bo_op_arg {
        uint64_t next;
        union {
@@ -860,6 +915,7 @@ struct drm_bo_op_arg {
        unsigned int pad64;
 };
 
+
 #define DRM_BO_MEM_LOCAL 0
 #define DRM_BO_MEM_TT 1
 #define DRM_BO_MEM_VRAM 2
@@ -871,8 +927,18 @@ struct drm_bo_op_arg {
 
 #define DRM_BO_MEM_TYPES 8 /* For now. */
 
+#define DRM_BO_LOCK_UNLOCK_BM       (1 << 0)
+#define DRM_BO_LOCK_IGNORE_NO_EVICT (1 << 1)
+
+struct drm_bo_version_arg {
+       uint32_t major;
+       uint32_t minor;
+       uint32_t patchlevel;
+};
+
 struct drm_mm_type_arg {
        unsigned int mem_type;
+       unsigned int lock_flags;
 };
 
 struct drm_mm_init_arg {
@@ -919,7 +985,7 @@ struct drm_mm_init_arg {
 #define DRM_IOCTL_RM_MAP               DRM_IOW( 0x1b, struct drm_map)
 
 #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_GET_SAREA_CTX                DRM_IOWR(0x1d, struct drm_ctx_priv_map)
 
 #define DRM_IOCTL_ADD_CTX              DRM_IOWR(0x20, struct drm_ctx)
 #define DRM_IOCTL_RM_CTX               DRM_IOWR(0x21, struct drm_ctx)
@@ -957,7 +1023,6 @@ struct drm_mm_init_arg {
 #define DRM_IOCTL_MM_UNLOCK             DRM_IOWR(0xc3, struct drm_mm_type_arg)
 
 #define DRM_IOCTL_FENCE_CREATE          DRM_IOWR(0xc4, struct drm_fence_arg)
-#define DRM_IOCTL_FENCE_DESTROY         DRM_IOWR(0xc5, struct drm_fence_arg)
 #define DRM_IOCTL_FENCE_REFERENCE       DRM_IOWR(0xc6, struct drm_fence_arg)
 #define DRM_IOCTL_FENCE_UNREFERENCE     DRM_IOWR(0xc7, struct drm_fence_arg)
 #define DRM_IOCTL_FENCE_SIGNALED        DRM_IOWR(0xc8, struct drm_fence_arg)
@@ -967,15 +1032,17 @@ struct drm_mm_init_arg {
 #define DRM_IOCTL_FENCE_BUFFERS         DRM_IOWR(0xcc, struct drm_fence_arg)
 
 #define DRM_IOCTL_BO_CREATE             DRM_IOWR(0xcd, struct drm_bo_create_arg)
-#define DRM_IOCTL_BO_DESTROY            DRM_IOWR(0xce, struct drm_bo_handle_arg)
 #define DRM_IOCTL_BO_MAP                DRM_IOWR(0xcf, struct drm_bo_map_wait_idle_arg)
 #define DRM_IOCTL_BO_UNMAP              DRM_IOWR(0xd0, struct drm_bo_handle_arg)
 #define DRM_IOCTL_BO_REFERENCE          DRM_IOWR(0xd1, struct drm_bo_reference_info_arg)
 #define DRM_IOCTL_BO_UNREFERENCE        DRM_IOWR(0xd2, struct drm_bo_handle_arg)
-#define DRM_IOCTL_BO_OP                 DRM_IOWR(0xd3, struct drm_bo_op_arg)
+#define DRM_IOCTL_BO_SETSTATUS          DRM_IOWR(0xd3, struct drm_bo_map_wait_idle_arg)
 #define DRM_IOCTL_BO_INFO               DRM_IOWR(0xd4, struct drm_bo_reference_info_arg)
 #define DRM_IOCTL_BO_WAIT_IDLE          DRM_IOWR(0xd5, struct drm_bo_map_wait_idle_arg)
+#define DRM_IOCTL_BO_VERSION          DRM_IOR(0xd6, struct drm_bo_version_arg)
+
 
+#define DRM_IOCTL_MODESET_CTL           DRM_IOW(0xa0, drm_modeset_ctl_t)
 
 /*@}*/
 
@@ -993,7 +1060,6 @@ struct drm_mm_init_arg {
 /* typedef area */
 #if !defined(__KERNEL__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)
 typedef struct drm_clip_rect drm_clip_rect_t;
-typedef struct drm_drawable_info drm_drawable_info_t;
 typedef struct drm_tex_region drm_tex_region_t;
 typedef struct drm_hw_lock drm_hw_lock_t;
 typedef struct drm_version drm_version_t;