From 72983ff30183745cd96760aa07b857c44daebde7 Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Wed, 27 Feb 2008 19:46:28 +0100 Subject: Don't wait for buffer idle before applying relocations. --- shared-core/i915_dma.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'shared-core') diff --git a/shared-core/i915_dma.c b/shared-core/i915_dma.c index b916441d..2d26fcc1 100644 --- a/shared-core/i915_dma.c +++ b/shared-core/i915_dma.c @@ -860,6 +860,15 @@ int i915_apply_reloc(struct drm_file *file_priv, int num_buffers, drm_bo_kunmap(&relocatee->kmap); relocatee->data_page = NULL; relocatee->offset = new_cmd_offset; + + /* + * Note on buffer idle: + * Since we're applying relocations, this part of the + * buffer is obviously not used by the GPU and we don't + * need to wait for buffer idle. This is an important + * consideration for user-space buffer pools. + */ + ret = drm_bo_kmap(relocatee->buf, new_cmd_offset >> PAGE_SHIFT, 1, &relocatee->kmap); if (ret) { @@ -1003,10 +1012,6 @@ static int i915_exec_reloc(struct drm_file *file_priv, drm_handle_t buf_handle, } mutex_lock (&relocatee.buf->mutex); - ret = drm_bo_wait (relocatee.buf, 0, 0, FALSE); - if (ret) - goto out_err1; - while (reloc_user_ptr) { ret = i915_process_relocs(file_priv, buf_handle, &reloc_user_ptr, &relocatee, buffers, buf_count); if (ret) { -- cgit v1.2.3 From fd595fa4dc6f788a8a1e1b56178e15f411706cb9 Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Wed, 27 Feb 2008 21:44:40 +0100 Subject: Reinstate buffer idle before applying relocations. --- shared-core/i915_dma.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'shared-core') diff --git a/shared-core/i915_dma.c b/shared-core/i915_dma.c index 2d26fcc1..f9e02c77 100644 --- a/shared-core/i915_dma.c +++ b/shared-core/i915_dma.c @@ -805,6 +805,7 @@ struct i915_relocatee_info { unsigned page_offset; struct drm_bo_kmap_obj kmap; int is_iomem; + int idle; }; struct drm_i915_validate_buffer { @@ -860,14 +861,13 @@ int i915_apply_reloc(struct drm_file *file_priv, int num_buffers, drm_bo_kunmap(&relocatee->kmap); relocatee->data_page = NULL; relocatee->offset = new_cmd_offset; - - /* - * Note on buffer idle: - * Since we're applying relocations, this part of the - * buffer is obviously not used by the GPU and we don't - * need to wait for buffer idle. This is an important - * consideration for user-space buffer pools. - */ + + if (unlikely(!relocatee->idle)) { + ret = drm_bo_wait(relocatee->buf, 0, 0, 0); + if (ret) + return ret; + relocatee->idle = 1; + } ret = drm_bo_kmap(relocatee->buf, new_cmd_offset >> PAGE_SHIFT, 1, &relocatee->kmap); -- cgit v1.2.3 From 63fd6f284ddd1096d34b39941683ae244c1e01fc Mon Sep 17 00:00:00 2001 From: Zou Nan hai Date: Mon, 3 Mar 2008 14:49:49 +0800 Subject: [i915] 2D driver may reset Frame count value, this may lead driver to leap it's vblank count a huge value. This will stall some applications that switch video mode if vblank_mode is set to a non zero value in drirc. --- shared-core/i915_irq.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'shared-core') diff --git a/shared-core/i915_irq.c b/shared-core/i915_irq.c index fd08b6e8..126f0379 100644 --- a/shared-core/i915_irq.c +++ b/shared-core/i915_irq.c @@ -406,6 +406,13 @@ u32 i915_get_vblank_counter(struct drm_device *dev, int plane) if (i915_in_vblank(dev, pipe)) count++; #endif + /* count may be reset by other driver(e.g. 2D driver), + we have no way to know if it is wrapped or resetted + when count is zero. do a rough guess. + */ + if (count == 0 && dev->last_vblank[pipe] < dev->max_vblank_count/2) + dev->last_vblank[pipe] = 0; + return count; } -- cgit v1.2.3 From 3332a0add63162222bd9c829117cd7e30d981aa7 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 30 Jan 2008 19:02:56 -0800 Subject: Remove unused DRM_FENCE_FLAG_WAIT_IGNORE_SIGNALS. --- shared-core/drm.h | 1 - 1 file changed, 1 deletion(-) (limited to 'shared-core') diff --git a/shared-core/drm.h b/shared-core/drm.h index 6c134566..213d3c7a 100644 --- a/shared-core/drm.h +++ b/shared-core/drm.h @@ -646,7 +646,6 @@ struct drm_set_version { #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_FLAG_NO_USER 0x00000010 /* Reserved for driver use */ -- cgit v1.2.3 From a6a2f2c8c491617de702dc7d62bb55cbada4d42b Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 4 Mar 2008 13:45:41 -0800 Subject: Clarify when WAIT_LAZY is relevant to users. --- shared-core/drm.h | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'shared-core') diff --git a/shared-core/drm.h b/shared-core/drm.h index 213d3c7a..663696c1 100644 --- a/shared-core/drm.h +++ b/shared-core/drm.h @@ -645,6 +645,13 @@ struct drm_set_version { #define DRM_FENCE_FLAG_EMIT 0x00000001 #define DRM_FENCE_FLAG_SHAREABLE 0x00000002 +/** + * On hardware with no interrupt events for operation completion, + * indicates that the kernel should sleep while waiting for any blocking + * operation to complete rather than spinning. + * + * Has no effect otherwise. + */ #define DRM_FENCE_FLAG_WAIT_LAZY 0x00000004 #define DRM_FENCE_FLAG_NO_USER 0x00000010 @@ -794,13 +801,12 @@ struct drm_fence_arg { * 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 +/** + * On hardware with no interrupt events for operation completion, + * indicates that the kernel should sleep while waiting for any blocking + * operation to complete rather than spinning. + * + * Has no effect otherwise. */ #define DRM_BO_HINT_WAIT_LAZY 0x00000008 /* -- cgit v1.2.3