drm/i915: blitter ring workaround for gen6
Subsystems (2)
PATCH 1/1 drm/i915: blitter ring workaround for gen6
Found this through doc inspection. I don't have a failing test case that this fixes, but the docs specify we need to do it in addition to the A0 workaround.
--- drivers/gpu/drm/i915/intel_ringbuffer.c | 58 +++++++++++++++++++++++++++++-- 1 files changed, 55 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_ringbuffer.c +55 -3
@@ -1233,13 +1233,18 @@ blt_ring_put_irq(struct intel_ring_buffer *ring) } +/* SNB C0 and D0 need ever more workarounds */ +#define NEED_MORE_BLT_WORKAROUND (dev) \ + (dev->pdev->revision == 9 || dev->pdev->revision == 10) +/* Workaround for some stepping of SNB, * each time when BLT engine ring tail moved, * the first command in the ring to be parsed * should be MI_BATCH_BUFFER_START */ #define NEED_BLT_WORKAROUND (dev) \ - (IS_GEN6(dev) && (dev->pdev->revision < 8)) + ((IS_GEN6(dev) && (dev->pdev->revision < 8)) || \ + (IS_GEN6(dev) && NEED_MORE_BLT_WORKAROUND(dev)))static inline struct drm_i915_gem_object *to_blt_workaround (struct intel_ring_buffer *ring)
@@ -1286,10 +1291,20 @@ static int blt_ring_begin(struct intel_ring_buffer *ring, int num_dwords) {if (ring->private) { -int ret =intel_ring_begin (ring, num_dwords+2 ); +int ret; +if (NEED_MORE_BLT_WORKAROUND (ring->dev)) + num_dwords +=46 ; +else + num_dwords +=2 ; + ret =intel_ring_begin (ring, num_dwords);if (ret)return ret; +if (NEED_MORE_BLT_WORKAROUND (ring->dev)) { +int i =0 ; +for (i =0 ; i <32 ; i++) +intel_ring_emit (ring,MI_NOOP ); + }intel_ring_emit (ring,MI_BATCH_BUFFER_START );intel_ring_emit (ring,to_blt_workaround (ring)->gtt_offset);
@@ -1298,6 +1313,25 @@ static int blt_ring_begin(struct intel_ring_buffer *ring,return intel_ring_begin (ring,4 ); } +static void blt_ring_begin2 (struct intel_ring_buffer *ring) +{ +if (!ring->private) +return ; + +intel_ring_emit (ring,MI_LOAD_REGISTER_IMM (1 )); +intel_ring_emit (ring,0x2209c ); +intel_ring_emit (ring,0x20002 ); +intel_ring_emit (ring,MI_FLUSH_DW ); +intel_ring_emit (ring,0x2209c ); +intel_ring_emit (ring,MI_LOAD_REGISTER_IMM (1 )); +intel_ring_emit (ring,0x2209c ); +intel_ring_emit (ring,0x20000 ); +intel_ring_emit (ring,MI_LOAD_REGISTER_IMM (1 )); +intel_ring_emit (ring,0x2209c ); +intel_ring_emit (ring,0x20000 ); +intel_ring_emit (ring,MI_NOOP ); +} +static int blt_ring_flush (struct intel_ring_buffer *ring,u32 invalidate,u32 flush) {
@@ -1315,10 +1349,28 @@ static int blt_ring_flush(struct intel_ring_buffer *ring,intel_ring_emit (ring,0 );intel_ring_emit (ring,0 );intel_ring_emit (ring,MI_NOOP ); +blt_ring_begin2 (ring);intel_ring_advance (ring);return 0 ; } +static int +blt_ring_dispatch_execbuffer (struct intel_ring_buffer *ring, +u32 offset,u32 len) +{ +int ret; + + ret =blt_ring_begin (ring,4 ); +if (ret) +return ret; +intel_ring_emit (ring,MI_BATCH_BUFFER_START |MI_BATCH_NON_SECURE_I965 ); +/* bit0-7 is the length on GEN6+ */ +intel_ring_emit (ring, offset); +blt_ring_begin2 (ring); +intel_ring_advance (ring); + +return 0 ; +}static void blt_ring_cleanup (struct intel_ring_buffer *ring) {if (!ring->private)
@@ -1341,7 +1393,7 @@ static const struct intel_ring_buffer gen6_blt_ring = { .get_seqno = ring_get_seqno, .irq_get = blt_ring_get_irq, .irq_put = blt_ring_put_irq, - .dispatch_execbuffer = gen6_ring_dispatch_execbuffer, + .dispatch_execbuffer = blt_ring_dispatch_execbuffer, .cleanup = blt_ring_cleanup, .sync_to = gen6_blt_ring_sync_to, .semaphore_register = {MI_SEMAPHORE_SYNC_BR,
Signature · 1 line
1.7.6.4
Quoted 9 lines · Ben Widawsky
drivers/gpu/drm/i915/intel_ringbuffer.c +9
-0+static void blt_ring_begin2 (struct intel_ring_buffer *ring) +{ +if (!ring->private) +return ; + +intel_ring_emit (ring,MI_LOAD_REGISTER_IMM (1 )); +intel_ring_emit (ring,0x2209c ); +intel_ring_emit (ring,0x20002 ); +intel_ring_emit (ring,MI_FLUSH_DW );
drivers/gpu/drm/i915/intel_ringbuffer.c static int blt_ring_begin(struct intel_ring_buffer *ring, · line 1334
Quoted 10 lines
drivers/gpu/drm/i915/intel_ringbuffer.c +10
-0+intel_ring_emit (ring,0x2209c ); +intel_ring_emit (ring,MI_LOAD_REGISTER_IMM (1 )); +intel_ring_emit (ring,0x2209c ); +intel_ring_emit (ring,0x20000 ); +intel_ring_emit (ring,MI_LOAD_REGISTER_IMM (1 )); +intel_ring_emit (ring,0x2209c ); +intel_ring_emit (ring,0x20000 ); +intel_ring_emit (ring,MI_NOOP ); +} +
Surely you can provide symbolic names here.
Signature · 1 line
[email protected]
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 15 lines · Keith Packard
Quoted 13 lines · Ben Widawsky
drivers/gpu/drm/i915/intel_ringbuffer.c +13
-0+static void blt_ring_begin2 (struct intel_ring_buffer *ring) +{ +if (!ring->private) +return ; + +intel_ring_emit (ring,MI_LOAD_REGISTER_IMM (1 )); +intel_ring_emit (ring,0x2209c ); +intel_ring_emit (ring,0x20002 ); +intel_ring_emit (ring,MI_FLUSH_DW ); +intel_ring_emit (ring,0x2209c ); +intel_ring_emit (ring,MI_LOAD_REGISTER_IMM (1 )); +intel_ring_emit (ring,0x2209c ); +intel_ring_emit (ring,0x20000 );
Quoted 9 lines
drivers/gpu/drm/i915/intel_ringbuffer.c static int blt_ring_begin(struct intel_ring_buffer *ring, · line 1334
Quoted 6 lines
drivers/gpu/drm/i915/intel_ringbuffer.c +6
-0+intel_ring_emit (ring,MI_LOAD_REGISTER_IMM (1 )); +intel_ring_emit (ring,0x2209c ); +intel_ring_emit (ring,0x20000 ); +intel_ring_emit (ring,MI_NOOP ); +} +Surely you can provide symbolic names here.
Of course. I lazily just copied the docs hoping someone would come up with some reason not to bother going further.
Assuming nobody has any complains, I'll fix it up.
Ben
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 2 lines · Ben Widawsky
Found this through doc inspection. I don't have a failing test case that this fixes, but the docs specify we need to do it in addition to the A0 workaround.
Can you try running /usr/lib/xscreenaver/xslip with and without this patch? That reliably hangs my machine and various reporters, with some being as unlucky to hit it during x11perf -copywinwin. I'll try and do so before my flight...
Oh and rebase it against keithp/drm-intel-fixes ;-). -Chris
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
PATCH 1/1 drm/i915: blitter ring workaround for gen6
I found this workaround in the docs while trying to debug a certain test case I stumbled upon. The patch is in flux as I try to get it to be useful. Both my test case and xscreensaver slip have similar scenarios which I'm hoping some variation of this patch will fix.
Again, this doesn't fix anything yet.
--- drivers/gpu/drm/i915/i915_reg.h | 2 + drivers/gpu/drm/i915/intel_ringbuffer.c | 84 ++++++++++++++++++++++++++++-- 2 files changed, 80 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +2 -0
@@ -543,6 +543,8 @@#define GEN6_RENDER_USER_INTERRUPT (1 << 0)#define GEN6_BLITTER_HWSTAM 0x22098 +#define GEN6_BCS_MI_MODE 0x2209c +#define GEN6_BCS_BYPASS_FENCE (1 << 1)#define GEN6_BLITTER_IMR 0x220a8#define GEN6_BLITTER_MI_FLUSH_DW_NOTIFY_INTERRUPT (1 << 26)#define GEN6_BLITTER_COMMAND_PARSER_MASTER_ERROR (1 << 25)
drivers/gpu/drm/i915/intel_ringbuffer.c +78 -6
158 lines not on this page · raw message
Signature · 1 line
1.7.6.4
PATCH 1/1 drm/i915: blitter ring workaround for gen6
In reply to Chris WilsonI found this workaround in the docs while trying to debug a certain test case I stumbled upon. The patch is in flux as I try to get it to be useful. Both my test case and xscreensaver slip have similar scenarios which I'm hoping some variation of this patch will fix.
Again, this doesn't fix anything yet.
v2: bugfixes + cleanups... still doesn't help, still WIP
--- drivers/gpu/drm/i915/i915_reg.h | 2 + drivers/gpu/drm/i915/intel_ringbuffer.c | 153 ++++++++++++++++++++++++++----- 2 files changed, 133 insertions(+), 22 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +2 -0
@@ -543,6 +543,8 @@#define GEN6_RENDER_USER_INTERRUPT (1 << 0)#define GEN6_BLITTER_HWSTAM 0x22098 +#define GEN6_BCS_MI_MODE 0x2209c +#define GEN6_BCS_BYPASS_FENCE (1 << 1)#define GEN6_BLITTER_IMR 0x220a8#define GEN6_BLITTER_MI_FLUSH_DW_NOTIFY_INTERRUPT (1 << 26)#define GEN6_BLITTER_COMMAND_PARSER_MASTER_ERROR (1 << 25)
drivers/gpu/drm/i915/intel_ringbuffer.c +131 -22
246 lines not on this page · raw message
Signature · 1 line
1.7.6.4
Quoted 2 lines · Ben Widawsky
Found this through doc inspection. I don't have a failing test case that this fixes, but the docs specify we need to do it in addition to the A0 workaround.
Can you confirm that the A0 workaround is really needed in addition to this new work-around on production-hw? Because I have patches lying around to kill that mess (no need don't carry around workarounds that only apply to pre-production hw after hw bringup) and your patch seems to extend that A0 workaround to all chips.
-Daniel
Signature · 3 lines
Daniel Vetter Mail: [email protected] Mobile: +41 (0)79 365 57 48
Quoted 10 lines · On Mon, 3 Oct 2011 09:41:28 +0200 Daniel Vetter <[email protected]> wrote:
Quoted 2 lines · Ben Widawsky
Found this through doc inspection. I don't have a failing test case that this fixes, but the docs specify we need to do it in addition to the A0 workaround.
Can you confirm that the A0 workaround is really needed in addition to this new work-around on production-hw? Because I have patches lying around to kill that mess (no need don't carry around workarounds that only apply to pre-production hw after hw bringup) and your patch seems to extend that A0 workaround to all chips.
-Daniel
It appears it is needed assuming I can make the patch do something useful. The docs are so terribly vague about what this actually fixes, or how it should be implemented.
By the way, it's not all chips, again once I get this to do something useful, I'll clean things up.
Ben