drm/i915: SNB BLT workaround
Subsystems (2)
PATCH 1/1 drm/i915: SNB BLT workaround
on some stepping of SNB cpu, the first command to be parsed in BLT command streamer should be MI_BATCHBUFFER_START otherwise the GPU may hang.
--- drivers/gpu/drm/i915/intel_ringbuffer.c | 89 +++++++++++++++++++++++++++++- 1 files changed, 86 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_ringbuffer.c +86 -3
@@ -854,15 +854,98 @@ blt_ring_put_user_irq(struct drm_device *dev,/* do nothing */ } + +/* 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 +*/ +static struct drm_gem_object *wa_batch; +static unsigned long wa_batch_addr; + +#define NEED_BLT_WORKAROUND (dev) \ + (IS_GEN6(dev) && (dev->pdev->revision < 8)) + +static int blt_ring_init (struct drm_device *dev, +struct intel_ring_buffer *ring) +{ +u32 *ptr; +struct drm_i915_gem_object *batch; +if (NEED_BLT_WORKAROUND (dev) && wa_batch ==NULL ) { + wa_batch =i915_gem_alloc_object (dev,4096 ); + +i915_gem_object_pin (wa_batch,4096 ); + + batch =to_intel_bo (wa_batch); + wa_batch_addr = batch->gtt_offset; + + ptr =kmap (batch->pages[0 ]); +memset ((u8 *)ptr,0 ,4096 ); + *ptr =MI_BATCH_BUFFER_END ; +kunmap (batch->pages[0 ]); + } +return init_ring_common (dev, ring); +} + +static void blt_ring_flush (struct drm_device *dev, +struct intel_ring_buffer *ring, +u32 invalidate_domains, +u32 flush_domains) +{ +if (NEED_BLT_WORKAROUND (dev)) { +intel_ring_begin (dev, ring,6 ); +intel_ring_emit (dev, ring,MI_BATCH_BUFFER_START ); +intel_ring_emit (dev, ring, wa_batch_addr); + }else +intel_ring_begin (dev, ring,4 ); + +intel_ring_emit (dev, ring,MI_FLUSH_DW ); +intel_ring_emit (dev, ring,0 ); +intel_ring_emit (dev, ring,0 ); +intel_ring_emit (dev, ring,0 ); + +intel_ring_advance (dev, ring); +} + +static u32 +blt_ring_add_request (struct drm_device *dev, +struct intel_ring_buffer *ring, +u32 flush_domains) +{ +u32 seqno; + + seqno =i915_gem_get_seqno (dev); + +if (NEED_BLT_WORKAROUND (dev)) { +intel_ring_begin (dev, ring,6 ); +intel_ring_emit (dev, ring,MI_BATCH_BUFFER_START ); +intel_ring_emit (dev, ring, wa_batch_addr); + }else { +intel_ring_begin (dev, ring,4 ); + } + +intel_ring_emit (dev, ring,MI_STORE_DWORD_INDEX ); +intel_ring_emit (dev, ring, +I915_GEM_HWS_INDEX <<MI_STORE_DWORD_INDEX_SHIFT ); +intel_ring_emit (dev, ring, seqno); +intel_ring_emit (dev, ring,MI_USER_INTERRUPT ); + +intel_ring_advance (dev, ring); + +DRM_DEBUG_DRIVER ("%s %d\n" , ring->name, seqno); + +return seqno; +} +static const struct intel_ring_buffer gen6_blt_ring = { .name ="blt ring" , .id =RING_BLT , .mmio_base =BLT_RING_BASE , .size =32 *PAGE_SIZE , - .init = init_ring_common, + .init = blt_ring_init, .write_tail = ring_write_tail, - .flush = gen6_ring_flush, - .add_request = ring_add_request, + .flush = blt_ring_flush, + .add_request = blt_ring_add_request, .get_seqno = ring_status_page_get_seqno, .user_irq_get = blt_ring_get_user_irq, .user_irq_put = blt_ring_put_user_irq,
Signature · 1 line
1.7.1
Quoted 3 lines · Zou Nan hai
on some stepping of SNB cpu, the first command to be parsed in BLT command streamer should be
MI_BATCHBUFFER_STARTotherwise the GPU may hang.
Then just add the workaround to the init routine.
-Chris
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
Quoted 7 lines
Quoted 7 lines
-----Original Message-----
From: Chris Wilson [mailto:[email protected]]
Sent: 2010年11月2日 17:05
To: Zou, Nanhai; [email protected]
Cc: Zou, Nanhai
Subject: Re: [PATCH] drm/i915: SNB BLT workaround
Quoted 8 lines
Quoted 8 lines · Zou Nan hai
Quoted 3 lines
on some stepping of SNB cpu, the first command to be parsed in BLT command streamer should be
MI_BATCHBUFFER_STARTotherwise the GPU may hang.Then just add the workaround to the init routine.
-Chris
The first command here means each BLT command streamer begin the parse action, when the ring tail is moving ahead.
Thanks
Zou Nan hai
Quoted 2 lines
Quoted 2 lines
--
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Chris Wilson
AppliedQuoted 12 lines · Nanhai
Quoted 12 lines
Quoted 12 lines
-----Original Message-----
From: Chris Wilson [mailto:[email protected]]
Sent: 2010年11月2日 17:05
To: Zou, Nanhai; [email protected]
Cc: Zou, Nanhai
Subject: Re: [PATCH] drm/i915: SNB BLT workaroundQuoted 3 lines · Zou Nan hai
on some stepping of SNB cpu, the first command to be parsed in BLT command streamer should be
MI_BATCHBUFFER_STARTotherwise the GPU may hang.
Quoted 6 lines
Quoted 3 lines
Quoted 3 lines
Then just add the workaround to the init routine.
-ChrisThe first command here means each BLT command streamer begin the parse action, when the ring tail is moving ahead.
Okay, that makes more sense. :)
I added some error checking, then realised that no error checking was done in 2.6.36 and swore.
Applied to -next and -fixes, with a tag for stable since I presume that some of these chips were sent to vendors for validation. -Chris
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx