From ca47fa90b73d0eac73fb7d1ba712d81e180eae7d Mon Sep 17 00:00:00 2001 From: Jesse Barnes Date: Tue, 12 Jun 2007 13:35:41 -0700 Subject: Update vblank code: - move pre/post modeset ioctl to core - fixup i915 buffer swap - fix outstanding signal count code - create new core vblank init routine - test (works with glxgears) - simplify i915 interrupt handler --- 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 b4195419..15081f92 100644 --- a/shared-core/drm.h +++ b/shared-core/drm.h @@ -587,6 +587,21 @@ typedef union drm_wait_vblank { struct drm_wait_vblank_reply reply; } drm_wait_vblank_t; +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 { + drm_modeset_ctl_cmd_t cmd; + unsigned long arg; +} drm_modeset_ctl_t; + /** * DRM_IOCTL_AGP_ENABLE ioctl argument type. * @@ -953,6 +968,8 @@ typedef union drm_mm_init_arg{ #define DRM_IOCTL_UPDATE_DRAW DRM_IOW(0x3f, drm_update_draw_t) +#define DRM_IOCTL_MODESET_CTL DRM_IOW(0x40, drm_modeset_ctl_t) + /*@}*/ /** -- cgit v1.2.3 From b06268294afb47e62949984d73905344dd160262 Mon Sep 17 00:00:00 2001 From: Jesse Barnes Date: Thu, 14 Jun 2007 11:32:31 -0700 Subject: Comment new vblank routines and fixup several issues: - use correct refcount variable in get/put routines - extract counter update from drm_vblank_get - make signal handling callback per-crtc - update interrupt handling logic, drivers should use drm_handle_vblank - move wakeup and counter update logic to new drm_handle_vblank routine - fixup usage of get/put in light of counter update extraction - fix longstanding bug in signal code, update pending counter only *after* we're sure we'll setup signal handling --- 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 15081f92..3cd6d500 100644 --- a/shared-core/drm.h +++ b/shared-core/drm.h @@ -599,7 +599,7 @@ typedef enum { */ typedef struct drm_modeset_ctl { drm_modeset_ctl_cmd_t cmd; - unsigned long arg; + u64 arg; } drm_modeset_ctl_t; /** @@ -968,7 +968,7 @@ typedef union drm_mm_init_arg{ #define DRM_IOCTL_UPDATE_DRAW DRM_IOW(0x3f, drm_update_draw_t) -#define DRM_IOCTL_MODESET_CTL DRM_IOW(0x40, drm_modeset_ctl_t) +#define DRM_IOCTL_MODESET_CTL DRM_IOW(0xa0, drm_modeset_ctl_t) /*@}*/ -- cgit v1.2.3 From 6e2cd7c16331b07c395732d132a6a4cdc1fad481 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Fri, 22 Jun 2007 11:44:19 +0200 Subject: drm_modeset_ctl_t fixes. s/u64/drm_u64_t/ to allow userspace code using drm.h to compile. Move 64 bit arg member to the beginning to avoid alignment issues with 32 bit userspace on 64 bit kernels. --- 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 3cd6d500..eae25c64 100644 --- a/shared-core/drm.h +++ b/shared-core/drm.h @@ -598,8 +598,8 @@ typedef enum { * \sa drmModesetCtl(). */ typedef struct drm_modeset_ctl { + drm_u64_t arg; drm_modeset_ctl_cmd_t cmd; - u64 arg; } drm_modeset_ctl_t; /** -- cgit v1.2.3 From 128a8f7ea20af2549e448157b431d5c1f90f37c3 Mon Sep 17 00:00:00 2001 From: Jesse Barnes Date: Thu, 1 Nov 2007 15:02:26 -0700 Subject: Use unsigned long instead of u64 in drm_modeset_ctl_t A bad idea, ABI-wise, but we're going to be changing this structure anyway before we merge upstream, so just fix the build for now. --- 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 3092e536..cbd6a941 100644 --- a/shared-core/drm.h +++ b/shared-core/drm.h @@ -565,7 +565,7 @@ typedef enum { * \sa drmModesetCtl(). */ typedef struct drm_modeset_ctl { - u64 arg; + unsigned long arg; drm_modeset_ctl_cmd_t cmd; } drm_modeset_ctl_t; -- cgit v1.2.3 From b5181d2506be332db8b07c02cdf37c6e25545c4d Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Fri, 14 Dec 2007 12:33:35 -0800 Subject: Document drm_bo_do_validate. Remove spurious 'do_wait' parameter. Add comments about the parameters to drm_bo_do_validate, along with comments for the DRM_BO_HINT options. Remove the 'do_wait' parameter as it is duplicated by DRM_BO_HINT_DONT_BLOCK. --- shared-core/drm.h | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'shared-core/drm.h') diff --git a/shared-core/drm.h b/shared-core/drm.h index 70a25b24..6f6f2386 100644 --- a/shared-core/drm.h +++ b/shared-core/drm.h @@ -748,11 +748,31 @@ struct drm_fence_arg { /* 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 +/* + * 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 -- cgit v1.2.3 From d1187641d64f442968a3b9ea6a19de6cdd45acd4 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sun, 16 Dec 2007 20:16:50 -0800 Subject: Rename inappropriately named 'mask' fields to 'proposed_flags' instead. Flags pending validation were stored in a misleadingly named field, 'mask'. As 'mask' is already used to indicate pieces of a flags field which are changing, it seems better to use a name reflecting the actual purpose of this field. I chose 'proposed_flags' as they may not actually end up in 'flags', and in an case will be modified when they are moved over. This affects the API, but not ABI of the user-mode interface. --- shared-core/drm.h | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) (limited to 'shared-core/drm.h') diff --git a/shared-core/drm.h b/shared-core/drm.h index 6f6f2386..6b4125f2 100644 --- a/shared-core/drm.h +++ b/shared-core/drm.h @@ -661,6 +661,10 @@ struct drm_fence_arg { #define DRM_BO_FLAG_WRITE (1ULL << 1) #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. @@ -741,10 +745,21 @@ 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 0x00000000FF0800A0ULL - +/* + * 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 @@ -794,7 +809,7 @@ struct drm_bo_info_req { }; struct drm_bo_create_req { - uint64_t mask; + uint64_t flags; uint64_t size; uint64_t buffer_start; unsigned int hint; @@ -810,7 +825,7 @@ struct drm_bo_create_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; -- cgit v1.2.3 From 44a9fa8cc6c7d598163d1885bf69e4bf747a004b Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 7 Jan 2008 13:10:50 -0800 Subject: Add additional explanation of DRM_BO_FLAG_CACHED_MAPPED before I forget again. --- shared-core/drm.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'shared-core/drm.h') diff --git a/shared-core/drm.h b/shared-core/drm.h index 6b4125f2..a551e4c2 100644 --- a/shared-core/drm.h +++ b/shared-core/drm.h @@ -705,7 +705,14 @@ struct drm_fence_arg { */ #define DRM_BO_FLAG_NO_MOVE (1ULL << 8) -/* Mask: Make sure the buffer is in cached memory when mapped +/* 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 -- cgit v1.2.3 From bfdddd218ec3e7ce3f8e765b93af35661a7bf0fd Mon Sep 17 00:00:00 2001 From: Jesse Barnes Date: Thu, 24 Jan 2008 20:59:51 -0800 Subject: Fixup modeset ioctl number & typedef usage Should be 0x08 rather than 0xa0, and shouldn't use typedefs. --- shared-core/drm.h | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'shared-core/drm.h') diff --git a/shared-core/drm.h b/shared-core/drm.h index 52de596b..6c134566 100644 --- a/shared-core/drm.h +++ b/shared-core/drm.h @@ -555,20 +555,20 @@ union drm_wait_vblank { struct drm_wait_vblank_reply reply; }; -typedef enum { +enum drm_modeset_ctl_cmd { _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 { +struct drm_modeset_ctl { unsigned long arg; - drm_modeset_ctl_cmd_t cmd; -} drm_modeset_ctl_t; + enum drm_modeset_ctl_cmd cmd; +}; /** * DRM_IOCTL_AGP_ENABLE ioctl argument type. @@ -969,6 +969,7 @@ struct drm_mm_init_arg { #define DRM_IOCTL_GET_CLIENT DRM_IOWR(0x05, struct drm_client) #define DRM_IOCTL_GET_STATS DRM_IOR( 0x06, struct drm_stats) #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_SET_UNIQUE DRM_IOW( 0x10, struct drm_unique) #define DRM_IOCTL_AUTH_MAGIC DRM_IOW( 0x11, struct drm_auth) @@ -1041,9 +1042,6 @@ struct drm_mm_init_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) - /*@}*/ /** -- cgit v1.2.3