From 166da9355d95affe427a6cff3525df60e80a99df Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Mon, 21 Aug 2006 21:02:08 +0200 Subject: User / Kernel space fence objects (device-independent part). --- shared-core/drm.h | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'shared-core/drm.h') diff --git a/shared-core/drm.h b/shared-core/drm.h index 87f8da6b..65d04b72 100644 --- a/shared-core/drm.h +++ b/shared-core/drm.h @@ -259,7 +259,7 @@ typedef enum drm_map_type { _DRM_SHM = 2, /**< shared, cached */ _DRM_AGP = 3, /**< AGP/GART */ _DRM_SCATTER_GATHER = 4, /**< Scatter/gather memory for PCI DMA */ - _DRM_CONSISTENT = 5 /**< Consistent memory for PCI DMA */ + _DRM_CONSISTENT = 5, /**< Consistent memory for PCI DMA */ } drm_map_type_t; /** @@ -629,6 +629,31 @@ typedef struct drm_set_version { int drm_dd_minor; } drm_set_version_t; +#define DRM_FENCE_FLAG_EMIT 0x00000001 +#define DRM_FENCE_FLAG_SHAREABLE 0x00000002 +#define DRM_FENCE_FLAG_WAIT_LAZY 0x00000004 +#define DRM_FENCE_FLAG_WAIT_IGNORE_SIGNALS 0x00000008 + +#define DRM_FENCE_EXE 0x00000001 + +typedef struct drm_fence_arg { + unsigned handle; + unsigned type; + unsigned flags; + unsigned signaled; + enum { + drm_fence_create, + drm_fence_destroy, + drm_fence_reference, + drm_fence_unreference, + drm_fence_signaled, + drm_fence_flush, + drm_fence_wait, + drm_fence_emit + } op; +} drm_fence_arg_t; + + /** * \name Ioctls Definitions */ @@ -694,6 +719,9 @@ typedef struct drm_set_version { #define DRM_IOCTL_WAIT_VBLANK DRM_IOWR(0x3a, drm_wait_vblank_t) +#define DRM_IOCTL_FENCE DRM_IOWR(0x3b, drm_fence_arg_t) + + /*@}*/ /** -- cgit v1.2.3 From 700bf80ca9fadf2c1404c220addebd92d9ad799d Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Tue, 22 Aug 2006 09:47:33 +0200 Subject: Bring in stripped TTM functionality. --- shared-core/drm.h | 1 + 1 file changed, 1 insertion(+) (limited to 'shared-core/drm.h') diff --git a/shared-core/drm.h b/shared-core/drm.h index 65d04b72..b588b15c 100644 --- a/shared-core/drm.h +++ b/shared-core/drm.h @@ -260,6 +260,7 @@ typedef 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_map_type_t; /** -- cgit v1.2.3 From a6535c8db4614376ce8ecb7d889b92db066a96cc Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Tue, 22 Aug 2006 10:44:09 +0200 Subject: Add a fence object class field for future use (For example VSYNC fence objects) --- shared-core/drm.h | 1 + 1 file changed, 1 insertion(+) (limited to 'shared-core/drm.h') diff --git a/shared-core/drm.h b/shared-core/drm.h index b588b15c..cd2b1907 100644 --- a/shared-core/drm.h +++ b/shared-core/drm.h @@ -639,6 +639,7 @@ typedef struct drm_set_version { typedef struct drm_fence_arg { unsigned handle; + int class; unsigned type; unsigned flags; unsigned signaled; -- cgit v1.2.3 From 4c03030b12bae28dad50d69bd271de632c43ff13 Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Fri, 25 Aug 2006 18:05:35 +0200 Subject: Checkpoint commit Buffer object code. --- shared-core/drm.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'shared-core/drm.h') diff --git a/shared-core/drm.h b/shared-core/drm.h index cd2b1907..bda565b3 100644 --- a/shared-core/drm.h +++ b/shared-core/drm.h @@ -655,6 +655,23 @@ typedef struct drm_fence_arg { } op; } drm_fence_arg_t; +#define DRM_BO_FLAG_READ 0x00000001 +#define DRM_BO_FLAG_WRITE 0x00000002 +#define DRM_BO_FLAG_EXE 0x00000004 +#define DRM_BO_FLAG_NO_MOVE 0x00000008 +#define DRM_BO_FLAG_NO_EVICT 0x00000010 +#define DRM_BO_FLAG_SHADOW_VRAM 0x00000020 +#define DRM_BO_FLAG_READ_LOCAL 0x00000040 +#define DRM_BO_FLAG_UNCACHED 0x00000080 + + +#define DRM_BO_FLAG_MEM_TT 0x01000000 +#define DRM_BO_FLAG_MEM_VRAM 0x02000000 +#define DRM_BO_FLAG_MEM_LOCAL 0x04000000 +#define DRM_BO_MASK_MEM 0xFFFFFFFF + +#define DRM_BO_HINT_PREFER_VRAM 0x00000001 +#define DRM_BO_HINT_AVOID_LOCAL 0x00000002 /** * \name Ioctls Definitions -- cgit v1.2.3 From 35c8ce6c2945ff09dc52dbc2a7382798ba64c1da Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Fri, 25 Aug 2006 19:03:42 +0200 Subject: ttm and buffer objects ioctl stubs. --- shared-core/drm.h | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 75 insertions(+), 2 deletions(-) (limited to 'shared-core/drm.h') diff --git a/shared-core/drm.h b/shared-core/drm.h index bda565b3..fb18b5c5 100644 --- a/shared-core/drm.h +++ b/shared-core/drm.h @@ -671,7 +671,80 @@ typedef struct drm_fence_arg { #define DRM_BO_MASK_MEM 0xFFFFFFFF #define DRM_BO_HINT_PREFER_VRAM 0x00000001 -#define DRM_BO_HINT_AVOID_LOCAL 0x00000002 +#define DRM_BO_HINT_AVOID_LOCAL 0x00000002 +#define DRM_BO_HINT_DONT_BLOCK 0x00000004 + +/* + * Multiplexing ioctl argument. + */ + +typedef struct drm_bo_arg { + unsigned num_requests; + enum { + drm_op_bo, + drm_op_ttm + } op; + unsigned data_lo; + unsigned data_hi; +} drm_bo_arg_t; + +typedef struct drm_ttm_arg { + enum { + drm_ttm_create, + drm_ttm_destroy, + drm_ttm_reference, + drm_ttm_unreference + } op; + unsigned handle; + unsigned size_lo; + unsigned size_hi; +}drm_ttm_arg_t; + + +typedef struct drm_bo_arg_request { + unsigned handle; /* User space handle */ + unsigned mask; + unsigned hint; + unsigned size_lo; + unsigned size_hi; + + enum { + drm_bo_type_ttm, + drm_bo_type_dc, + drm_bo_type_user + }type; + unsigned arg_handle; + unsigned user_pointer_lo; + unsigned user_pointer_hi; + enum { + drm_bo_create, + drm_bo_validate, + drm_bo_map, + drm_bo_fence, + drm_bo_destroy, + drm_bo_reference, + drm_bo_unreference + } op; +} drm_bo_arg_request_t; + +typedef struct drm_bo_arg_reply { + int ret; + unsigned handle; + unsigned flags; + unsigned size_lo; + unsigned size_hi; + unsigned offset_lo; + unsigned offset_hi; + unsigned arg_handle; + unsigned map_flags; +}drm_bo_arg_reply_t; + + +typedef union { + drm_bo_arg_request_t bo_req; + drm_bo_arg_reply_t bo_rep; +}drm_bo_arg_data; + /** * \name Ioctls Definitions @@ -739,7 +812,7 @@ typedef struct drm_fence_arg { #define DRM_IOCTL_WAIT_VBLANK DRM_IOWR(0x3a, drm_wait_vblank_t) #define DRM_IOCTL_FENCE DRM_IOWR(0x3b, drm_fence_arg_t) - +#define DRM_IOCTL_BUFFER_OBJECT DRM_IOWR(0x3c, drm_buffer_arg_t) /*@}*/ -- cgit v1.2.3 From c488e25ceb421c6f84f110d786d9814ac4dba1b2 Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Fri, 25 Aug 2006 20:03:39 +0200 Subject: More ioctl stubs. Buffer object locking order documentation. --- shared-core/drm.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'shared-core/drm.h') diff --git a/shared-core/drm.h b/shared-core/drm.h index fb18b5c5..feadfc67 100644 --- a/shared-core/drm.h +++ b/shared-core/drm.h @@ -740,10 +740,10 @@ typedef struct drm_bo_arg_reply { }drm_bo_arg_reply_t; -typedef union { - drm_bo_arg_request_t bo_req; - drm_bo_arg_reply_t bo_rep; -}drm_bo_arg_data; +typedef union drm_bo_arg_data { + drm_bo_arg_request_t req; + drm_bo_arg_reply_t rep; +} drm_bo_arg_data_t; /** -- cgit v1.2.3 From 65e7274008446d2059b7fd7cd6d7b1d6b04da0ce Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Sun, 27 Aug 2006 19:03:20 +0200 Subject: ttm create / destroy / ref / unref ioctl. --- shared-core/drm.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'shared-core/drm.h') diff --git a/shared-core/drm.h b/shared-core/drm.h index feadfc67..450864bc 100644 --- a/shared-core/drm.h +++ b/shared-core/drm.h @@ -688,6 +688,8 @@ typedef struct drm_bo_arg { unsigned data_hi; } drm_bo_arg_t; +#define DRM_TTM_FLAG_SHAREABLE 0x00000001 + typedef struct drm_ttm_arg { enum { drm_ttm_create, @@ -696,8 +698,10 @@ typedef struct drm_ttm_arg { drm_ttm_unreference } op; unsigned handle; + unsigned user_token; unsigned size_lo; unsigned size_hi; + unsigned flags; }drm_ttm_arg_t; -- cgit v1.2.3 From b4b7b997605f88f3ffdcb0cc7cd1271e0cb24073 Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Sun, 27 Aug 2006 21:16:13 +0200 Subject: Remove the ioctl multiplexing, and instead allow for generic drm ioctls 0x80 - 0xFF. --- shared-core/drm.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'shared-core/drm.h') diff --git a/shared-core/drm.h b/shared-core/drm.h index 450864bc..726a5140 100644 --- a/shared-core/drm.h +++ b/shared-core/drm.h @@ -816,7 +816,7 @@ typedef union drm_bo_arg_data { #define DRM_IOCTL_WAIT_VBLANK DRM_IOWR(0x3a, drm_wait_vblank_t) #define DRM_IOCTL_FENCE DRM_IOWR(0x3b, drm_fence_arg_t) -#define DRM_IOCTL_BUFFER_OBJECT DRM_IOWR(0x3c, drm_buffer_arg_t) +#define DRM_IOCTL_TTM DRM_IOWR(0x3c, drm_ttm_arg_t) /*@}*/ @@ -828,5 +828,6 @@ typedef union drm_bo_arg_data { * drmCommandReadWrite(). */ #define DRM_COMMAND_BASE 0x40 +#define DRM_COMMAND_END 0x80 #endif -- cgit v1.2.3 From e181f594a4a75790ce1d2a8e907f9fcc5e88b419 Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Mon, 28 Aug 2006 09:49:09 +0200 Subject: Add a 64-bit drm unsigned type for 64-bit clean IOCTLS. Conversion functions in drmP.h and xf86drm.c. --- shared-core/drm.h | 69 +++++++++++++++++++++++-------------------------------- 1 file changed, 29 insertions(+), 40 deletions(-) (limited to 'shared-core/drm.h') diff --git a/shared-core/drm.h b/shared-core/drm.h index 726a5140..7133eb8f 100644 --- a/shared-core/drm.h +++ b/shared-core/drm.h @@ -630,6 +630,11 @@ typedef struct drm_set_version { int drm_dd_minor; } drm_set_version_t; +typedef struct drm_u64{ + unsigned lo; + unsigned hi; +}drm_u64_t; + #define DRM_FENCE_FLAG_EMIT 0x00000001 #define DRM_FENCE_FLAG_SHAREABLE 0x00000002 #define DRM_FENCE_FLAG_WAIT_LAZY 0x00000004 @@ -655,6 +660,22 @@ typedef struct drm_fence_arg { } op; } drm_fence_arg_t; +#define DRM_TTM_FLAG_SHAREABLE 0x00000001 + +typedef struct drm_ttm_arg { + enum { + drm_ttm_create, + drm_ttm_destroy, + drm_ttm_reference, + drm_ttm_unreference + } op; + unsigned handle; + unsigned user_token; + drm_u64_t size; + unsigned flags; +}drm_ttm_arg_t; + + #define DRM_BO_FLAG_READ 0x00000001 #define DRM_BO_FLAG_WRITE 0x00000002 #define DRM_BO_FLAG_EXE 0x00000004 @@ -674,43 +695,12 @@ typedef struct drm_fence_arg { #define DRM_BO_HINT_AVOID_LOCAL 0x00000002 #define DRM_BO_HINT_DONT_BLOCK 0x00000004 -/* - * Multiplexing ioctl argument. - */ - -typedef struct drm_bo_arg { - unsigned num_requests; - enum { - drm_op_bo, - drm_op_ttm - } op; - unsigned data_lo; - unsigned data_hi; -} drm_bo_arg_t; - -#define DRM_TTM_FLAG_SHAREABLE 0x00000001 - -typedef struct drm_ttm_arg { - enum { - drm_ttm_create, - drm_ttm_destroy, - drm_ttm_reference, - drm_ttm_unreference - } op; - unsigned handle; - unsigned user_token; - unsigned size_lo; - unsigned size_hi; - unsigned flags; -}drm_ttm_arg_t; - typedef struct drm_bo_arg_request { unsigned handle; /* User space handle */ unsigned mask; unsigned hint; - unsigned size_lo; - unsigned size_hi; + drm_u64_t size; enum { drm_bo_type_ttm, @@ -718,8 +708,8 @@ typedef struct drm_bo_arg_request { drm_bo_type_user }type; unsigned arg_handle; - unsigned user_pointer_lo; - unsigned user_pointer_hi; + drm_u64_t user_pointer; + drm_u64_t next; enum { drm_bo_create, drm_bo_validate, @@ -733,21 +723,20 @@ typedef struct drm_bo_arg_request { typedef struct drm_bo_arg_reply { int ret; + int handled; unsigned handle; unsigned flags; - unsigned size_lo; - unsigned size_hi; - unsigned offset_lo; - unsigned offset_hi; + drm_u64_t size; + drm_u64_t offset; unsigned arg_handle; unsigned map_flags; }drm_bo_arg_reply_t; -typedef union drm_bo_arg_data { +typedef union drm_bo_arg{ drm_bo_arg_request_t req; drm_bo_arg_reply_t rep; -} drm_bo_arg_data_t; +} drm_bo_arg_t; /** -- cgit v1.2.3 From 0d67356de4e0c9e0d068ea9c16cf33df4fd13776 Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Mon, 28 Aug 2006 16:36:37 +0200 Subject: Proper TTM dereferencing Initial buffer object creation. --- shared-core/drm.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'shared-core/drm.h') diff --git a/shared-core/drm.h b/shared-core/drm.h index 7133eb8f..14b1741f 100644 --- a/shared-core/drm.h +++ b/shared-core/drm.h @@ -695,18 +695,19 @@ typedef struct drm_ttm_arg { #define DRM_BO_HINT_AVOID_LOCAL 0x00000002 #define DRM_BO_HINT_DONT_BLOCK 0x00000004 +typedef enum { + drm_bo_type_ttm, + drm_bo_type_dc, + drm_bo_type_user +}drm_bo_type_t; + typedef struct drm_bo_arg_request { unsigned handle; /* User space handle */ unsigned mask; unsigned hint; drm_u64_t size; - - enum { - drm_bo_type_ttm, - drm_bo_type_dc, - drm_bo_type_user - }type; + drm_bo_type_t type; unsigned arg_handle; drm_u64_t user_pointer; drm_u64_t next; @@ -714,6 +715,7 @@ typedef struct drm_bo_arg_request { drm_bo_create, drm_bo_validate, drm_bo_map, + drm_bo_unmap, drm_bo_fence, drm_bo_destroy, drm_bo_reference, -- cgit v1.2.3 From 205740647060bc3bdec2b4402a666eb1015932ff Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Mon, 28 Aug 2006 17:51:53 +0200 Subject: Buffer object creation. --- shared-core/drm.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'shared-core/drm.h') diff --git a/shared-core/drm.h b/shared-core/drm.h index 14b1741f..d03eebcb 100644 --- a/shared-core/drm.h +++ b/shared-core/drm.h @@ -684,7 +684,7 @@ typedef struct drm_ttm_arg { #define DRM_BO_FLAG_SHADOW_VRAM 0x00000020 #define DRM_BO_FLAG_READ_LOCAL 0x00000040 #define DRM_BO_FLAG_UNCACHED 0x00000080 - +#define DRM_BO_FLAG_SHAREABLE 0x00000100 #define DRM_BO_FLAG_MEM_TT 0x01000000 #define DRM_BO_FLAG_MEM_VRAM 0x02000000 @@ -709,7 +709,7 @@ typedef struct drm_bo_arg_request { drm_u64_t size; drm_bo_type_t type; unsigned arg_handle; - drm_u64_t user_pointer; + drm_u64_t buffer_start; drm_u64_t next; enum { drm_bo_create, -- cgit v1.2.3 From 279e8d26c6cf7347aa9cb6d50d025a41dff9a5be Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Tue, 29 Aug 2006 10:45:34 +0200 Subject: =?UTF-8?q?64-bit=20IOCTL=20integer=20(Michel=20D=E4nzer=20&=20Bri?= =?UTF-8?q?an=20Paul)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- shared-core/drm.h | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'shared-core/drm.h') diff --git a/shared-core/drm.h b/shared-core/drm.h index d03eebcb..f8479dd0 100644 --- a/shared-core/drm.h +++ b/shared-core/drm.h @@ -134,6 +134,12 @@ #define _DRM_LOCKING_CONTEXT(lock) ((lock) & ~(_DRM_LOCK_HELD|_DRM_LOCK_CONT)) #if defined(__linux__) +#if defined(__KERNEL__) +typedef __u64 drm_u64_t; +#else +typedef unsigned long long drm_u64_t; +#endif + typedef unsigned int drm_handle_t; #else typedef unsigned long drm_handle_t; /**< To mapped regions */ @@ -630,10 +636,7 @@ typedef struct drm_set_version { int drm_dd_minor; } drm_set_version_t; -typedef struct drm_u64{ - unsigned lo; - unsigned hi; -}drm_u64_t; +#ifdef __linux__ #define DRM_FENCE_FLAG_EMIT 0x00000001 #define DRM_FENCE_FLAG_SHAREABLE 0x00000002 @@ -739,7 +742,7 @@ typedef union drm_bo_arg{ drm_bo_arg_request_t req; drm_bo_arg_reply_t rep; } drm_bo_arg_t; - +#endif /** * \name Ioctls Definitions @@ -806,8 +809,10 @@ typedef union drm_bo_arg{ #define DRM_IOCTL_WAIT_VBLANK DRM_IOWR(0x3a, drm_wait_vblank_t) +#ifdef __linux__ #define DRM_IOCTL_FENCE DRM_IOWR(0x3b, drm_fence_arg_t) #define DRM_IOCTL_TTM DRM_IOWR(0x3c, drm_ttm_arg_t) +#endif /*@}*/ -- cgit v1.2.3 From 0dedfc2cd03f50b435476e56637b333d345fddbd Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Tue, 29 Aug 2006 14:52:02 +0200 Subject: Checkpoint ttm addition to buffer objects. --- shared-core/drm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'shared-core/drm.h') diff --git a/shared-core/drm.h b/shared-core/drm.h index f8479dd0..e50ebfe2 100644 --- a/shared-core/drm.h +++ b/shared-core/drm.h @@ -686,7 +686,7 @@ typedef struct drm_ttm_arg { #define DRM_BO_FLAG_NO_EVICT 0x00000010 #define DRM_BO_FLAG_SHADOW_VRAM 0x00000020 #define DRM_BO_FLAG_READ_LOCAL 0x00000040 -#define DRM_BO_FLAG_UNCACHED 0x00000080 +#define DRM_BO_FLAG_CACHED 0x00000080 #define DRM_BO_FLAG_SHAREABLE 0x00000100 #define DRM_BO_FLAG_MEM_TT 0x01000000 -- cgit v1.2.3 From 23f01c9fe8e6170459fe46ad5fc9757bbe967d96 Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Tue, 29 Aug 2006 18:40:08 +0200 Subject: Checkpoint commit. Buffer object flags and IOCTL argument list. --- shared-core/drm.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'shared-core/drm.h') diff --git a/shared-core/drm.h b/shared-core/drm.h index e50ebfe2..5888c9be 100644 --- a/shared-core/drm.h +++ b/shared-core/drm.h @@ -685,7 +685,7 @@ typedef struct drm_ttm_arg { #define DRM_BO_FLAG_NO_MOVE 0x00000008 #define DRM_BO_FLAG_NO_EVICT 0x00000010 #define DRM_BO_FLAG_SHADOW_VRAM 0x00000020 -#define DRM_BO_FLAG_READ_LOCAL 0x00000040 +#define DRM_BO_FLAG_READ_CACHED 0x00000040 #define DRM_BO_FLAG_CACHED 0x00000080 #define DRM_BO_FLAG_SHAREABLE 0x00000100 @@ -697,6 +697,7 @@ typedef struct drm_ttm_arg { #define DRM_BO_HINT_PREFER_VRAM 0x00000001 #define DRM_BO_HINT_AVOID_LOCAL 0x00000002 #define DRM_BO_HINT_DONT_BLOCK 0x00000004 +#define DRM_BO_HINT_BIND_CACHED 0x00000008 typedef enum { drm_bo_type_ttm, -- cgit v1.2.3 From de144ba23c1245cf021a63cc739c7c9903568272 Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Tue, 29 Aug 2006 21:57:37 +0200 Subject: Part of buffer object libdrm interface. --- shared-core/drm.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'shared-core/drm.h') diff --git a/shared-core/drm.h b/shared-core/drm.h index 5888c9be..c65ecc00 100644 --- a/shared-core/drm.h +++ b/shared-core/drm.h @@ -736,6 +736,9 @@ typedef struct drm_bo_arg_reply { drm_u64_t offset; unsigned arg_handle; unsigned map_flags; + unsigned mask; + unsigned hint; + drm_u64_t buffer_start; }drm_bo_arg_reply_t; @@ -813,6 +816,7 @@ typedef union drm_bo_arg{ #ifdef __linux__ #define DRM_IOCTL_FENCE DRM_IOWR(0x3b, drm_fence_arg_t) #define DRM_IOCTL_TTM DRM_IOWR(0x3c, drm_ttm_arg_t) +#define DRM_IOCTL_BUFOBJ DRM_IOWR(0x3d, drm_bo_arg_t) #endif /*@}*/ -- cgit v1.2.3 From 033bda07e9a4eab5058fb919b375deb57b08b5be Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Wed, 30 Aug 2006 09:57:35 +0200 Subject: Buffer object reply fill in. Lindent of drm_bo.c drm_ttm.c --- shared-core/drm.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'shared-core/drm.h') diff --git a/shared-core/drm.h b/shared-core/drm.h index c65ecc00..f6abfeb9 100644 --- a/shared-core/drm.h +++ b/shared-core/drm.h @@ -702,7 +702,8 @@ typedef struct drm_ttm_arg { typedef enum { drm_bo_type_ttm, drm_bo_type_dc, - drm_bo_type_user + drm_bo_type_user, + drm_bo_type_fake }drm_bo_type_t; @@ -823,12 +824,13 @@ typedef union drm_bo_arg{ /** * Device specific ioctls should only be in their respective headers - * The device specific ioctl range is from 0x40 to 0x79. + * The device specific ioctl range is from 0x40 to 0x99. + * Generic IOCTLS restart at 0xA0. * * \sa drmCommandNone(), drmCommandRead(), drmCommandWrite(), and * drmCommandReadWrite(). */ #define DRM_COMMAND_BASE 0x40 -#define DRM_COMMAND_END 0x80 +#define DRM_COMMAND_END 0xA0 #endif -- cgit v1.2.3 From e47a4fda2ef7aada45b7799ad20e8012102dc12e Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Wed, 30 Aug 2006 13:04:08 +0200 Subject: Memory manager init and takedown. --- shared-core/drm.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'shared-core/drm.h') diff --git a/shared-core/drm.h b/shared-core/drm.h index f6abfeb9..f900dd51 100644 --- a/shared-core/drm.h +++ b/shared-core/drm.h @@ -747,8 +747,26 @@ typedef union drm_bo_arg{ drm_bo_arg_request_t req; drm_bo_arg_reply_t rep; } drm_bo_arg_t; + +typedef union drm_mm_init_arg{ + struct { + enum { + mm_init, + mm_takedown, + mm_query + } op; + drm_u64_t vr_p_offset; + drm_u64_t vr_p_size; + drm_u64_t tt_p_offset; + drm_u64_t tt_p_size; + } req; + struct { + drm_handle_t mm_sarea; + } rep; +} drm_mm_init_arg_t; #endif + /** * \name Ioctls Definitions */ @@ -818,6 +836,7 @@ typedef union drm_bo_arg{ #define DRM_IOCTL_FENCE DRM_IOWR(0x3b, drm_fence_arg_t) #define DRM_IOCTL_TTM DRM_IOWR(0x3c, drm_ttm_arg_t) #define DRM_IOCTL_BUFOBJ DRM_IOWR(0x3d, drm_bo_arg_t) +#define DRM_IOCTL_MM_INIT DRM_IOWR(0x3e, drm_mm_init_arg_t) #endif /*@}*/ -- cgit v1.2.3 From d39055174b5a487f0d848e1af4c3459fb4261bf1 Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Wed, 30 Aug 2006 17:40:07 +0200 Subject: Remove the buffer object hint field and use it only as an argument. Validate stub. --- shared-core/drm.h | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) (limited to 'shared-core/drm.h') diff --git a/shared-core/drm.h b/shared-core/drm.h index f900dd51..d992621b 100644 --- a/shared-core/drm.h +++ b/shared-core/drm.h @@ -679,25 +679,45 @@ typedef struct drm_ttm_arg { }drm_ttm_arg_t; +/* Buffer permissions, referring to how the GPU uses the buffers. + these translate to fence types used for the buffers. + Typically a texture buffer is read, A destination buffer is write and + a command (batch-) buffer is exe. Can be or-ed together. */ + #define DRM_BO_FLAG_READ 0x00000001 #define DRM_BO_FLAG_WRITE 0x00000002 #define DRM_BO_FLAG_EXE 0x00000004 -#define DRM_BO_FLAG_NO_MOVE 0x00000008 + +/* Pinned buffer. */ #define DRM_BO_FLAG_NO_EVICT 0x00000010 +/* Always keep a system memory shadow to a vram buffer */ #define DRM_BO_FLAG_SHADOW_VRAM 0x00000020 +/* When mapped for reading, make sure the buffer is cached even + if it means moving the buffer to system memory */ #define DRM_BO_FLAG_READ_CACHED 0x00000040 +/* The buffer is currently cached */ #define DRM_BO_FLAG_CACHED 0x00000080 +/* The buffer is shareable with other processes */ #define DRM_BO_FLAG_SHAREABLE 0x00000100 +/* When there is a choice between VRAM and TT, prefer VRAM. + The default behaviour is to prefer TT. */ +#define DRM_BO_FLAG_PREFER_VRAM 0x00000200 +/* Bind this buffer cached if the hardware supports it. */ +#define DRM_BO_FLAG_BIND_CACHED 0x00000400 +/* Translation table aperture */ #define DRM_BO_FLAG_MEM_TT 0x01000000 +/* On-card VRAM */ #define DRM_BO_FLAG_MEM_VRAM 0x02000000 +/* System memory */ #define DRM_BO_FLAG_MEM_LOCAL 0x04000000 -#define DRM_BO_MASK_MEM 0xFFFFFFFF +/* Memory flag mask */ +#define DRM_BO_MASK_MEM 0xFF000000 -#define DRM_BO_HINT_PREFER_VRAM 0x00000001 -#define DRM_BO_HINT_AVOID_LOCAL 0x00000002 -#define DRM_BO_HINT_DONT_BLOCK 0x00000004 -#define DRM_BO_HINT_BIND_CACHED 0x00000008 +/* When creating a buffer, Avoid system storage even if allowed */ +#define DRM_BO_HINT_AVOID_LOCAL 0x00000001 +/* Don't block on validate and map */ +#define DRM_BO_HINT_DONT_BLOCK 0x00000002 typedef enum { drm_bo_type_ttm, @@ -738,7 +758,6 @@ typedef struct drm_bo_arg_reply { unsigned arg_handle; unsigned map_flags; unsigned mask; - unsigned hint; drm_u64_t buffer_start; }drm_bo_arg_reply_t; -- cgit v1.2.3 From ec8c79b79de6544cc09b5a2c85213a5f30e0d906 Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Thu, 31 Aug 2006 14:10:13 +0200 Subject: More mapping synchronization. libdrm validate and fencing functions. --- shared-core/drm.h | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) (limited to 'shared-core/drm.h') diff --git a/shared-core/drm.h b/shared-core/drm.h index d992621b..9640855c 100644 --- a/shared-core/drm.h +++ b/shared-core/drm.h @@ -688,22 +688,28 @@ typedef struct drm_ttm_arg { #define DRM_BO_FLAG_WRITE 0x00000002 #define DRM_BO_FLAG_EXE 0x00000004 +/* + * Status flags. Can be read to determine the actual state of a buffer. + */ + /* Pinned buffer. */ -#define DRM_BO_FLAG_NO_EVICT 0x00000010 +#define DRM_BO_FLAG_NO_EVICT 0x00000001 /* Always keep a system memory shadow to a vram buffer */ -#define DRM_BO_FLAG_SHADOW_VRAM 0x00000020 +#define DRM_BO_FLAG_SHADOW_VRAM 0x00000002 /* When mapped for reading, make sure the buffer is cached even if it means moving the buffer to system memory */ -#define DRM_BO_FLAG_READ_CACHED 0x00000040 -/* The buffer is currently cached */ -#define DRM_BO_FLAG_CACHED 0x00000080 -/* The buffer is shareable with other processes */ -#define DRM_BO_FLAG_SHAREABLE 0x00000100 +#define DRM_BO_FLAG_SHAREABLE 0x00000004 /* When there is a choice between VRAM and TT, prefer VRAM. The default behaviour is to prefer TT. */ -#define DRM_BO_FLAG_PREFER_VRAM 0x00000200 +#define DRM_BO_FLAG_CACHED 0x00000008 +/* The buffer is shareable with other processes */ + + +#define DRM_BO_FLAG_READ_CACHED 0x00001000 +/* The buffer is currently cached */ +#define DRM_BO_FLAG_PREFER_VRAM 0x00002000 /* Bind this buffer cached if the hardware supports it. */ -#define DRM_BO_FLAG_BIND_CACHED 0x00000400 +#define DRM_BO_FLAG_BIND_CACHED 0x00004000 /* Translation table aperture */ #define DRM_BO_FLAG_MEM_TT 0x01000000 @@ -750,21 +756,22 @@ typedef struct drm_bo_arg_request { typedef struct drm_bo_arg_reply { int ret; - int handled; unsigned handle; unsigned flags; drm_u64_t size; drm_u64_t offset; unsigned arg_handle; - unsigned map_flags; unsigned mask; drm_u64_t buffer_start; }drm_bo_arg_reply_t; -typedef union drm_bo_arg{ - drm_bo_arg_request_t req; - drm_bo_arg_reply_t rep; +typedef struct drm_bo_arg{ + int handled; + union { + drm_bo_arg_request_t req; + drm_bo_arg_reply_t rep; + }; } drm_bo_arg_t; typedef union drm_mm_init_arg{ -- cgit v1.2.3 From 44f6d08988a77a640bea40d09cb61eec7566a5ce Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Thu, 31 Aug 2006 21:42:29 +0200 Subject: Validation and fencing. --- shared-core/drm.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'shared-core/drm.h') diff --git a/shared-core/drm.h b/shared-core/drm.h index 9640855c..f76fd86f 100644 --- a/shared-core/drm.h +++ b/shared-core/drm.h @@ -723,7 +723,15 @@ typedef struct drm_ttm_arg { /* When creating a buffer, Avoid system storage even if allowed */ #define DRM_BO_HINT_AVOID_LOCAL 0x00000001 /* Don't block on validate and map */ -#define DRM_BO_HINT_DONT_BLOCK 0x00000002 +#define DRM_BO_HINT_DONT_BLOCK 0x00000002 +/* Don't place this buffer on the unfenced list.*/ +#define DRM_BO_HINT_DONT_FENCE 0x00000004 + + + + +/* Driver specific flags. Could be for example rendering engine */ +#define DRM_BO_MASK_DRIVER 0x00F00000 typedef enum { drm_bo_type_ttm, @@ -779,7 +787,9 @@ typedef union drm_mm_init_arg{ enum { mm_init, mm_takedown, - mm_query + mm_query, + mm_lock, + mm_unlock } op; drm_u64_t vr_p_offset; drm_u64_t vr_p_size; -- cgit v1.2.3 From ef8e618cf30ab7dcbe8c7211e0c2508c5520a669 Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Fri, 1 Sep 2006 16:38:06 +0200 Subject: Export buffer info on map and validate ioctls. Add an info ioctl operation. --- shared-core/drm.h | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'shared-core/drm.h') diff --git a/shared-core/drm.h b/shared-core/drm.h index f76fd86f..f781abc6 100644 --- a/shared-core/drm.h +++ b/shared-core/drm.h @@ -758,10 +758,18 @@ typedef struct drm_bo_arg_request { drm_bo_fence, drm_bo_destroy, drm_bo_reference, - drm_bo_unreference + drm_bo_unreference, + drm_bo_info } op; } drm_bo_arg_request_t; + +/* + * Reply flags + */ + +#define DRM_BO_REP_BUSY 0x00000001 + typedef struct drm_bo_arg_reply { int ret; unsigned handle; @@ -771,6 +779,8 @@ typedef struct drm_bo_arg_reply { unsigned arg_handle; unsigned mask; drm_u64_t buffer_start; + unsigned fence_flags; + unsigned rep_flags; }drm_bo_arg_reply_t; -- cgit v1.2.3 From 405b5d9ca8cc9f6c5c7bb764c684bf74ba7660c6 Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Fri, 1 Sep 2006 18:11:05 +0200 Subject: Flag bit pattern bugfixes. Remove some error messages. --- shared-core/drm.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'shared-core/drm.h') diff --git a/shared-core/drm.h b/shared-core/drm.h index f781abc6..a7d778ce 100644 --- a/shared-core/drm.h +++ b/shared-core/drm.h @@ -693,23 +693,23 @@ typedef struct drm_ttm_arg { */ /* Pinned buffer. */ -#define DRM_BO_FLAG_NO_EVICT 0x00000001 +#define DRM_BO_FLAG_NO_EVICT 0x00000010 /* Always keep a system memory shadow to a vram buffer */ -#define DRM_BO_FLAG_SHADOW_VRAM 0x00000002 +#define DRM_BO_FLAG_SHADOW_VRAM 0x00000020 /* When mapped for reading, make sure the buffer is cached even if it means moving the buffer to system memory */ -#define DRM_BO_FLAG_SHAREABLE 0x00000004 +#define DRM_BO_FLAG_SHAREABLE 0x00000040 /* When there is a choice between VRAM and TT, prefer VRAM. The default behaviour is to prefer TT. */ -#define DRM_BO_FLAG_CACHED 0x00000008 +#define DRM_BO_FLAG_CACHED 0x00000080 /* The buffer is shareable with other processes */ -#define DRM_BO_FLAG_READ_CACHED 0x00001000 +#define DRM_BO_FLAG_READ_CACHED 0x00080000 /* The buffer is currently cached */ -#define DRM_BO_FLAG_PREFER_VRAM 0x00002000 +#define DRM_BO_FLAG_PREFER_VRAM 0x00040000 /* Bind this buffer cached if the hardware supports it. */ -#define DRM_BO_FLAG_BIND_CACHED 0x00004000 +#define DRM_BO_FLAG_BIND_CACHED 0x0002000 /* Translation table aperture */ #define DRM_BO_FLAG_MEM_TT 0x01000000 -- cgit v1.2.3 From 550f51b4bf9920718aab2c611b15de3020537f92 Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Mon, 4 Sep 2006 21:50:12 +0200 Subject: Buffer object wait IOCTL operation. Remove option to wait for fence / buffers and block signals. --- shared-core/drm.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'shared-core/drm.h') diff --git a/shared-core/drm.h b/shared-core/drm.h index a7d778ce..1a43e0af 100644 --- a/shared-core/drm.h +++ b/shared-core/drm.h @@ -726,7 +726,7 @@ typedef struct drm_ttm_arg { #define DRM_BO_HINT_DONT_BLOCK 0x00000002 /* Don't place this buffer on the unfenced list.*/ #define DRM_BO_HINT_DONT_FENCE 0x00000004 - +#define DRM_BO_HINT_WAIT_LAZY 0x00000008 @@ -759,7 +759,9 @@ typedef struct drm_bo_arg_request { drm_bo_destroy, drm_bo_reference, drm_bo_unreference, - drm_bo_info + drm_bo_info, + drm_bo_wait_idle, + drm_bo_ref_fence } op; } drm_bo_arg_request_t; -- cgit v1.2.3 From 604215396847a7964fd7d68aa89d4f778b3bf22b Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Tue, 5 Sep 2006 18:00:25 +0200 Subject: Fence all unfenced buffers function. --- shared-core/drm.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'shared-core/drm.h') diff --git a/shared-core/drm.h b/shared-core/drm.h index 1a43e0af..e39f888a 100644 --- a/shared-core/drm.h +++ b/shared-core/drm.h @@ -659,7 +659,8 @@ typedef struct drm_fence_arg { drm_fence_signaled, drm_fence_flush, drm_fence_wait, - drm_fence_emit + drm_fence_emit, + drm_fence_buffers } op; } drm_fence_arg_t; -- cgit v1.2.3 From 99acb7936660843090ea8a9f22d2d50d9433e0de Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Fri, 8 Sep 2006 17:24:38 +0200 Subject: Various bugfixes. --- shared-core/drm.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'shared-core/drm.h') diff --git a/shared-core/drm.h b/shared-core/drm.h index e39f888a..bed55173 100644 --- a/shared-core/drm.h +++ b/shared-core/drm.h @@ -728,7 +728,7 @@ typedef struct drm_ttm_arg { /* Don't place this buffer on the unfenced list.*/ #define DRM_BO_HINT_DONT_FENCE 0x00000004 #define DRM_BO_HINT_WAIT_LAZY 0x00000008 - +#define DRM_BO_HINT_ALLOW_UNFENCED_MAP 0x00000010 /* Driver specific flags. Could be for example rendering engine */ @@ -792,7 +792,7 @@ typedef struct drm_bo_arg{ union { drm_bo_arg_request_t req; drm_bo_arg_reply_t rep; - }; + } d; } drm_bo_arg_t; typedef union drm_mm_init_arg{ -- cgit v1.2.3 From 191e284709ee792a32124e96e43d5876406b93dc Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Tue, 12 Sep 2006 12:01:00 +0200 Subject: More bugfixes. Disable the i915 IRQ turnoff for now since it seems to be causing problems. --- shared-core/drm.h | 1 + 1 file changed, 1 insertion(+) (limited to 'shared-core/drm.h') diff --git a/shared-core/drm.h b/shared-core/drm.h index bed55173..d10b713b 100644 --- a/shared-core/drm.h +++ b/shared-core/drm.h @@ -808,6 +808,7 @@ typedef union drm_mm_init_arg{ drm_u64_t vr_p_size; drm_u64_t tt_p_offset; drm_u64_t tt_p_size; + drm_u64_t max_locked_pages; } req; struct { drm_handle_t mm_sarea; -- cgit v1.2.3 From 49fbeb339c232804866cd548d6023fe559597353 Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Fri, 15 Sep 2006 11:18:35 +0200 Subject: Some bugfixes. Change the fence object interface somewhat to allow some more flexibility. Make list IOCTLS really restartable. Try to avoid busy-waits in the kernel using immediate return to user-space with an -EAGAIN. --- shared-core/drm.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'shared-core/drm.h') diff --git a/shared-core/drm.h b/shared-core/drm.h index d10b713b..b4dd61cb 100644 --- a/shared-core/drm.h +++ b/shared-core/drm.h @@ -643,7 +643,10 @@ typedef struct drm_set_version { #define DRM_FENCE_FLAG_WAIT_LAZY 0x00000004 #define DRM_FENCE_FLAG_WAIT_IGNORE_SIGNALS 0x00000008 -#define DRM_FENCE_EXE 0x00000001 +/* Reserved for driver use */ +#define DRM_FENCE_MASK_DRIVER 0xFF000000 + +#define DRM_FENCE_TYPE_EXE 0x00000001 typedef struct drm_fence_arg { unsigned handle; @@ -750,7 +753,6 @@ typedef struct drm_bo_arg_request { drm_bo_type_t type; unsigned arg_handle; drm_u64_t buffer_start; - drm_u64_t next; enum { drm_bo_create, drm_bo_validate, @@ -789,6 +791,7 @@ typedef struct drm_bo_arg_reply { typedef struct drm_bo_arg{ int handled; + drm_u64_t next; union { drm_bo_arg_request_t req; drm_bo_arg_reply_t rep; -- cgit v1.2.3 From fa511a3ff5150d932fd963594d1ef67a94bb8b1f Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Wed, 20 Sep 2006 16:31:15 +0200 Subject: Allow for 64-bit map handles of ttms and buffer objects. --- shared-core/drm.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'shared-core/drm.h') diff --git a/shared-core/drm.h b/shared-core/drm.h index b4dd61cb..8ac5a31e 100644 --- a/shared-core/drm.h +++ b/shared-core/drm.h @@ -677,7 +677,7 @@ typedef struct drm_ttm_arg { drm_ttm_unreference } op; unsigned handle; - unsigned user_token; + drm_u64_t user_token; drm_u64_t size; unsigned flags; }drm_ttm_arg_t; @@ -781,7 +781,7 @@ typedef struct drm_bo_arg_reply { unsigned flags; drm_u64_t size; drm_u64_t offset; - unsigned arg_handle; + drm_u64_t arg_handle; unsigned mask; drm_u64_t buffer_start; unsigned fence_flags; -- cgit v1.2.3 From ae96e264198323916ee58e293468c9b924feca75 Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Fri, 29 Sep 2006 11:46:45 +0200 Subject: Add a new buffer flag. Fix up some comments. --- shared-core/drm.h | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'shared-core/drm.h') diff --git a/shared-core/drm.h b/shared-core/drm.h index 8ac5a31e..095823b7 100644 --- a/shared-core/drm.h +++ b/shared-core/drm.h @@ -696,21 +696,28 @@ typedef struct drm_ttm_arg { * Status flags. Can be read to determine the actual state of a buffer. */ -/* Pinned buffer. */ +/* + * Cannot evict this buffer. Not even with force. This type of buffer should + * only be available for root, and must be manually removed before buffer + * manager shutdown or swapout. + */ #define DRM_BO_FLAG_NO_EVICT 0x00000010 /* Always keep a system memory shadow to a vram buffer */ #define DRM_BO_FLAG_SHADOW_VRAM 0x00000020 -/* When mapped for reading, make sure the buffer is cached even - if it means moving the buffer to system memory */ +/* The buffer is shareable with other processes */ #define DRM_BO_FLAG_SHAREABLE 0x00000040 -/* When there is a choice between VRAM and TT, prefer VRAM. - The default behaviour is to prefer TT. */ +/* The buffer is currently cached */ #define DRM_BO_FLAG_CACHED 0x00000080 -/* The buffer is shareable with other processes */ - +/* Make sure that every time this buffer is validated, it ends up on the same + * location. The buffer will also not be evicted when claiming space for + * other buffers. Basically a pinned buffer but it may be thrown out as + * part of buffer manager shutdown or swapout. Not supported yet.*/ +#define DRM_BO_FLAG_NO_MOVE 0x00000100 +/* Make sure the buffer is in cached memory when mapped for reading */ #define DRM_BO_FLAG_READ_CACHED 0x00080000 -/* The buffer is currently cached */ +/* When there is a choice between VRAM and TT, prefer VRAM. + The default behaviour is to prefer TT. */ #define DRM_BO_FLAG_PREFER_VRAM 0x00040000 /* Bind this buffer cached if the hardware supports it. */ #define DRM_BO_FLAG_BIND_CACHED 0x0002000 -- cgit v1.2.3 From 2735f9e2908b786586d18f6384371b991bdce430 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Fri, 11 Aug 2006 17:57:59 +0200 Subject: Add support for secondary vertical blank interrupt to DRM core. (cherry picked from ab351505f36a6c66405ea7604378268848340a42 commit) --- shared-core/drm.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'shared-core/drm.h') diff --git a/shared-core/drm.h b/shared-core/drm.h index 095823b7..c2bcf62c 100644 --- a/shared-core/drm.h +++ b/shared-core/drm.h @@ -536,10 +536,12 @@ typedef struct drm_irq_busid { typedef enum { _DRM_VBLANK_ABSOLUTE = 0x0, /**< Wait for specific vblank sequence number */ _DRM_VBLANK_RELATIVE = 0x1, /**< Wait for given number of vblanks */ + _DRM_VBLANK_SECONDARY = 0x20000000, /**< Secondary display controller */ _DRM_VBLANK_SIGNAL = 0x40000000 /**< Send signal instead of blocking */ } drm_vblank_seq_type_t; -#define _DRM_VBLANK_FLAGS_MASK _DRM_VBLANK_SIGNAL +#define _DRM_VBLANK_TYPES_MASK (_DRM_VBLANK_ABSOLUTE | _DRM_VBLANK_RELATIVE) +#define _DRM_VBLANK_FLAGS_MASK (_DRM_VBLANK_SIGNAL | _DRM_VBLANK_SECONDARY) struct drm_wait_vblank_request { drm_vblank_seq_type_t type; -- cgit v1.2.3 From 9810ec2737de6aa81e764225f580e4ea39de437a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Tue, 22 Aug 2006 16:40:07 +0200 Subject: Add support for tracking drawable information to core Actually make the existing ioctls for adding and removing drawables do something useful, and add another ioctl for the X server to update drawable information. The only kind of drawable information tracked so far is cliprects. (cherry picked from 29598e5253ff5c085ccf63580fd24b84db848424 commit) --- shared-core/drm.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'shared-core/drm.h') diff --git a/shared-core/drm.h b/shared-core/drm.h index c2bcf62c..0b241117 100644 --- a/shared-core/drm.h +++ b/shared-core/drm.h @@ -164,6 +164,14 @@ typedef struct drm_clip_rect { unsigned short y2; } drm_clip_rect_t; +/** + * Drawable information. + */ +typedef struct drm_drawable_info { + unsigned int num_rects; + drm_clip_rect_t *rects; +} drm_drawable_info_t; + /** * Texture region, */ @@ -514,6 +522,20 @@ typedef struct drm_draw { drm_drawable_t handle; } drm_draw_t; +/** + * DRM_IOCTL_UPDATE_DRAW ioctl argument type. + */ +typedef enum { + DRM_DRAWABLE_CLIPRECTS, +} drm_drawable_info_type_t; + +typedef struct drm_update_draw { + drm_drawable_t handle; + unsigned int type; + unsigned int num; + unsigned long long data; +} drm_update_draw_t; + /** * DRM_IOCTL_GET_MAGIC and DRM_IOCTL_AUTH_MAGIC ioctl argument type. */ @@ -901,6 +923,8 @@ typedef union drm_mm_init_arg{ #define DRM_IOCTL_MM_INIT DRM_IOWR(0x3e, drm_mm_init_arg_t) #endif +#define DRM_IOCTL_UPDATE_DRAW DRM_IOW(0x3f, drm_update_draw_t) + /*@}*/ /** -- cgit v1.2.3 From ed82172378666d35ca60e6094fdecb59511a135f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Fri, 1 Sep 2006 11:27:14 +0200 Subject: Core vsync: Add flag DRM_VBLANK_NEXTONMISS. When this flag is set and the target sequence is missed, wait for the next vertical blank instead of returning immediately. (cherry picked from 89e323e4900af84cc33219ad24eb0b435a039d23 commit) --- shared-core/drm.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'shared-core/drm.h') diff --git a/shared-core/drm.h b/shared-core/drm.h index 0b241117..17bf993b 100644 --- a/shared-core/drm.h +++ b/shared-core/drm.h @@ -558,12 +558,14 @@ typedef struct drm_irq_busid { typedef enum { _DRM_VBLANK_ABSOLUTE = 0x0, /**< Wait for specific vblank sequence number */ _DRM_VBLANK_RELATIVE = 0x1, /**< Wait for given number of vblanks */ + _DRM_VBLANK_NEXTONMISS = 0x10000000, /**< If missed, wait for next vblank */ _DRM_VBLANK_SECONDARY = 0x20000000, /**< Secondary display controller */ _DRM_VBLANK_SIGNAL = 0x40000000 /**< Send signal instead of blocking */ } drm_vblank_seq_type_t; #define _DRM_VBLANK_TYPES_MASK (_DRM_VBLANK_ABSOLUTE | _DRM_VBLANK_RELATIVE) -#define _DRM_VBLANK_FLAGS_MASK (_DRM_VBLANK_SIGNAL | _DRM_VBLANK_SECONDARY) +#define _DRM_VBLANK_FLAGS_MASK (_DRM_VBLANK_SIGNAL | _DRM_VBLANK_SECONDARY | \ + _DRM_VBLANK_NEXTONMISS) struct drm_wait_vblank_request { drm_vblank_seq_type_t type; -- cgit v1.2.3 From f2db76e2f206d2017f710eaddc4b33add4498898 Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Wed, 11 Oct 2006 13:40:35 +0200 Subject: Big update: Adapt for new functions in the 2.6.19 kernel. Remove the ability to have multiple regions in one TTM. This simplifies a lot of code. Remove the ability to access TTMs from user space. We don't need it anymore without ttm regions. Don't change caching policy for evicted buffers. Instead change it only when the buffer is accessed by the CPU (on the first page fault). This tremendously speeds up eviction rates. Current code is safe for kernels <= 2.6.14. Should also be OK with 2.6.19 and above. --- shared-core/drm.h | 18 ------------------ 1 file changed, 18 deletions(-) (limited to 'shared-core/drm.h') diff --git a/shared-core/drm.h b/shared-core/drm.h index 17bf993b..32cad3bc 100644 --- a/shared-core/drm.h +++ b/shared-core/drm.h @@ -693,22 +693,6 @@ typedef struct drm_fence_arg { } op; } drm_fence_arg_t; -#define DRM_TTM_FLAG_SHAREABLE 0x00000001 - -typedef struct drm_ttm_arg { - enum { - drm_ttm_create, - drm_ttm_destroy, - drm_ttm_reference, - drm_ttm_unreference - } op; - unsigned handle; - drm_u64_t user_token; - drm_u64_t size; - unsigned flags; -}drm_ttm_arg_t; - - /* Buffer permissions, referring to how the GPU uses the buffers. these translate to fence types used for the buffers. Typically a texture buffer is read, A destination buffer is write and @@ -771,7 +755,6 @@ typedef struct drm_ttm_arg { #define DRM_BO_MASK_DRIVER 0x00F00000 typedef enum { - drm_bo_type_ttm, drm_bo_type_dc, drm_bo_type_user, drm_bo_type_fake @@ -920,7 +903,6 @@ typedef union drm_mm_init_arg{ #ifdef __linux__ #define DRM_IOCTL_FENCE DRM_IOWR(0x3b, drm_fence_arg_t) -#define DRM_IOCTL_TTM DRM_IOWR(0x3c, drm_ttm_arg_t) #define DRM_IOCTL_BUFOBJ DRM_IOWR(0x3d, drm_bo_arg_t) #define DRM_IOCTL_MM_INIT DRM_IOWR(0x3e, drm_mm_init_arg_t) #endif -- cgit v1.2.3 From 5881ce1b91034fbdf81dda37a23215cfc1310cdf Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Tue, 17 Oct 2006 11:05:37 +0200 Subject: Extend generality for more memory types. Fix up init and destruction code. --- shared-core/drm.h | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) (limited to 'shared-core/drm.h') diff --git a/shared-core/drm.h b/shared-core/drm.h index 32cad3bc..915befba 100644 --- a/shared-core/drm.h +++ b/shared-core/drm.h @@ -680,6 +680,7 @@ typedef struct drm_fence_arg { unsigned type; unsigned flags; unsigned signaled; + unsigned expand_pad[4]; /*Future expansion */ enum { drm_fence_create, drm_fence_destroy, @@ -732,12 +733,14 @@ typedef struct drm_fence_arg { /* Bind this buffer cached if the hardware supports it. */ #define DRM_BO_FLAG_BIND_CACHED 0x0002000 -/* Translation table aperture */ -#define DRM_BO_FLAG_MEM_TT 0x01000000 -/* On-card VRAM */ -#define DRM_BO_FLAG_MEM_VRAM 0x02000000 -/* System memory */ -#define DRM_BO_FLAG_MEM_LOCAL 0x04000000 +/* System Memory */ +#define DRM_BO_FLAG_MEM_LOCAL 0x01000000 +/* Translation table memory */ +#define DRM_BO_FLAG_MEM_TT 0x02000000 +/* Vram memory */ +#define DRM_BO_FLAG_MEM_VRAM 0x04000000 +/* Unmappable Vram memory */ +#define DRM_BO_FLAG_MEM_VRAM_NM 0x08000000 /* Memory flag mask */ #define DRM_BO_MASK_MEM 0xFF000000 @@ -769,6 +772,7 @@ typedef struct drm_bo_arg_request { drm_bo_type_t type; unsigned arg_handle; drm_u64_t buffer_start; + unsigned expand_pad[4]; /*Future expansion */ enum { drm_bo_create, drm_bo_validate, @@ -802,6 +806,7 @@ typedef struct drm_bo_arg_reply { drm_u64_t buffer_start; unsigned fence_flags; unsigned rep_flags; + unsigned expand_pad[4]; /*Future expansion */ }drm_bo_arg_reply_t; @@ -814,23 +819,30 @@ typedef struct drm_bo_arg{ } d; } drm_bo_arg_t; +#define DRM_BO_MEM_LOCAL 0 +#define DRM_BO_MEM_TT 1 +#define DRM_BO_MEM_VRAM 2 +#define DRM_BO_MEM_VRAM_NM 3 +#define DRM_BO_MEM_TYPES 2 /* For now. */ + typedef union drm_mm_init_arg{ struct { enum { mm_init, + mm_set_max_pages, mm_takedown, mm_query, mm_lock, mm_unlock } op; - drm_u64_t vr_p_offset; - drm_u64_t vr_p_size; - drm_u64_t tt_p_offset; - drm_u64_t tt_p_size; - drm_u64_t max_locked_pages; + drm_u64_t p_offset; + drm_u64_t p_size; + unsigned mem_type; + unsigned expand_pad[8]; /*Future expansion */ } req; struct { drm_handle_t mm_sarea; + unsigned expand_pad[8]; /*Future expansion */ } rep; } drm_mm_init_arg_t; #endif -- cgit v1.2.3 From c34faf224b959bf61e4c3eb29c66a12edbd31841 Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Tue, 17 Oct 2006 20:03:26 +0200 Subject: Remove max number of locked pages check and call, since that is now handled by the memory accounting. --- shared-core/drm.h | 1 - 1 file changed, 1 deletion(-) (limited to 'shared-core/drm.h') diff --git a/shared-core/drm.h b/shared-core/drm.h index 915befba..4a6a370e 100644 --- a/shared-core/drm.h +++ b/shared-core/drm.h @@ -829,7 +829,6 @@ typedef union drm_mm_init_arg{ struct { enum { mm_init, - mm_set_max_pages, mm_takedown, mm_query, mm_lock, -- cgit v1.2.3