[Intel-gfx] [PATCH 3/5] drm/i915: WaInsertNoopAfterBatchEndCommand

2012-10-18 Thread Daniel Vetter
Comment says that this applies to earlier gens, too. Since two more
MI_NOOP's can't hurt that much, I've figured I'll apply this w/a down
to gen2.

v2: Correct the ringbuffer dword count for gen3, spotted by Chris
Wilson.

Signed-off-by: Daniel Vetter daniel.vet...@ffwll.ch
---
 drivers/gpu/drm/i915/intel_ringbuffer.c |   18 +++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c 
b/drivers/gpu/drm/i915/intel_ringbuffer.c
index 984a0c5..38092dc 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.c
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
@@ -969,7 +969,7 @@ i965_dispatch_execbuffer(struct intel_ring_buffer *ring, 
u32 offset, u32 length)
 {
int ret;
 
-   ret = intel_ring_begin(ring, 2);
+   ret = intel_ring_begin(ring, 4);
if (ret)
return ret;
 
@@ -978,6 +978,11 @@ i965_dispatch_execbuffer(struct intel_ring_buffer *ring, 
u32 offset, u32 length)
MI_BATCH_GTT |
MI_BATCH_NON_SECURE_I965);
intel_ring_emit(ring, offset);
+   /* WaInsertNoopAfterBatchEndCommand: Command says to do the same after
+* the batchbuffer start command. Unclear whether really required on
+* gen3, but better safe than sorry. */
+   intel_ring_emit(ring, MI_NOOP);
+   intel_ring_emit(ring, MI_NOOP);
intel_ring_advance(ring);
 
return 0;
@@ -996,7 +1001,10 @@ i830_dispatch_execbuffer(struct intel_ring_buffer *ring,
intel_ring_emit(ring, MI_BATCH_BUFFER);
intel_ring_emit(ring, offset | MI_BATCH_NON_SECURE);
intel_ring_emit(ring, offset + len - 8);
-   intel_ring_emit(ring, 0);
+   /* WaInsertNoopAfterBatchEndCommand: Command says to do the same after
+* the batchbuffer start command. Unclear whether really required on
+* gen2, but better safe than sorry. */
+   intel_ring_emit(ring, MI_NOOP);
intel_ring_advance(ring);
 
return 0;
@@ -1008,12 +1016,16 @@ i915_dispatch_execbuffer(struct intel_ring_buffer *ring,
 {
int ret;
 
-   ret = intel_ring_begin(ring, 2);
+   ret = intel_ring_begin(ring, 4);
if (ret)
return ret;
 
intel_ring_emit(ring, MI_BATCH_BUFFER_START | MI_BATCH_GTT);
intel_ring_emit(ring, offset | MI_BATCH_NON_SECURE);
+   /* WaInsertNoopAfterBatchEndCommand: Command says to do the same after
+* the batchbuffer start command. */
+   intel_ring_emit(ring, MI_NOOP);
+   intel_ring_emit(ring, MI_NOOP);
intel_ring_advance(ring);
 
return 0;
-- 
1.7.10.4

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 3/5] drm/i915: WaInsertNoopAfterBatchEndCommand

2012-10-18 Thread Chris Wilson
On Thu, 18 Oct 2012 11:49:52 +0200, Daniel Vetter daniel.vet...@ffwll.ch 
wrote:
 Comment says that this applies to earlier gens, too. Since two more
 MI_NOOP's can't hurt that much, I've figured I'll apply this w/a down
 to gen2.
 
 v2: Correct the ringbuffer dword count for gen3, spotted by Chris
 Wilson.
 
 Signed-off-by: Daniel Vetter daniel.vet...@ffwll.ch

I'm just not sold on this one, surely we would have spotted a need
before now? 12 extra cycles after every batch! :-p

Can you please fix up the cut'n'paste comments to not refer to
generations that never call the function?
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx