drm/i915: Embed the ring->private within the struct intel_ring_buffer
Subsystems (2)
PATCH 1/2 drm/i915: Embed the ring->private within the struct intel_ring_buffer
We now have more devices using ring->private than not, and they all want the same structure. Worse, I would like to use a scratch page from outside of intel_ringbuffer.c and so for convenience would like to reuse ring->private. Embed the object into the struct intel_ringbuffer so that we can keep the code clean.
--- drivers/gpu/drm/i915/i915_gpu_error.c | 2 +- drivers/gpu/drm/i915/intel_ringbuffer.c | 99 ++++++++++----------------------- drivers/gpu/drm/i915/intel_ringbuffer.h | 6 +- 3 files changed, 35 insertions(+), 72 deletions(-)
drivers/gpu/drm/i915/i915_gpu_error.c +1 -1
@@ -644,7 +644,7 @@ i915_error_first_batchbuffer(struct drm_i915_private *dev_priv,if (WARN_ON (ring->id !=RCS ))return NULL ; - obj = ring->private; + obj = ring->scratch.obj;if (acthd >=i915_gem_obj_ggtt_offset (obj) && acthd <i915_gem_obj_ggtt_offset (obj) + obj->base.size)return i915_error_object_create (dev_priv, obj);
drivers/gpu/drm/i915/intel_ringbuffer.c +29 -70
205 lines not on this page · raw message
drivers/gpu/drm/i915/intel_ringbuffer.h +5 -1
@@ -155,7 +155,11 @@ struct intel_ring_buffer {struct intel_ring_hangcheck hangcheck; -void *private; +struct { +struct drm_i915_gem_object *obj; +u32 gtt_offset; +volatile u32 *cpu_page; + } scratch; }; static inline bool
Signature · 1 line
1.8.4.rc3
PATCH 2/2 drm/i915: Use RCS flips on Ivybridge+
RCS flips do work on Iybridge+ so long as we can unmask the messages through DERRMR. However, there are quite a few workarounds mentioned regarding unmasking more than one event or triggering more than one message through DERRMR. Those workarounds in principle prevent us from performing pipelined flips (and asynchronous flips across multiple planes) and equally apply to the "known good" BCS ring. Given that it already appears to work, and also appears to work with unmasking all 3 planes at once (and queuing flips across multiple planes), be brave.
Bugzlla: https://bugs.freedesktop.org/show_bug.cgi?id=67600
--- drivers/gpu/drm/i915/i915_reg.h | 18 ++++++++++++++++ drivers/gpu/drm/i915/intel_display.c | 40 ++++++++++++++++++++++++++++-------- 2 files changed, 49 insertions(+), 9 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +18 -0
@@ -230,6 +230,7 @@* address/value pairs. Don't overdue it, though, x <= 2^4 must hold! */ #define MI_LOAD_REGISTER_IMM (x) MI_INSTR(0x22, 2*x-1) +#define MI_STORE_REGISTER_MEM (x) MI_INSTR(0x24, 2*x-1)#define MI_FLUSH_DW MI_INSTR(0x26, 1)/* for GEN6 */ #define MI_FLUSH_DW_STORE_INDEX (1<<21)#define MI_INVALIDATE_TLB (1<<18)
@@ -678,6 +679,23 @@#define FPGA_DBG_RM_NOCLAIM (1<<31)#define DERRMR 0x44050 +#define DERRMR_PIPEA_SCANLINE (1<<0) +#define DERRMR_PIPEA_PRI_FLIP_DONE (1<<1) +#define DERRMR_PIPEA_SPR_FLIP_DONE (1<<2) +#define DERRMR_PIPEA_VBLANK (1<<3) +#define DERRMR_PIPEA_HBLANK (1<<5) +#define DERRMR_PIPEB_SCANLINE (1<<8) +#define DERRMR_PIPEB_PRI_FLIP_DONE (1<<9) +#define DERRMR_PIPEB_SPR_FLIP_DONE (1<<10) +#define DERRMR_PIPEB_VBLANK (1<<11) +#define DERRMR_PIPEB_HBLANK (1<<13) +/* Note that PIPEC is not a simple translation of PIPEA/PIPEB */ +#define DERRMR_PIPEC_SCANLINE (1<<14) +#define DERRMR_PIPEC_PRI_FLIP_DONE (1<<15) +#define DERRMR_PIPEC_SPR_FLIP_DONE (1<<20) +#define DERRMR_PIPEC_VBLANK (1<<21) +#define DERRMR_PIPEC_HBLANK (1<<22) +/* GM45+ chicken bits -- debug workaround bits that may be required * for various sorts of correct behavior. The top 16 bits of each are
drivers/gpu/drm/i915/intel_display.c +31 -9
@@ -7826,12 +7826,6 @@ err:return ret; } -/* -* On gen7 we currently use the blit ring because (in early silicon at least) -* the render ring doesn't give us interrpts for page flip completion, which -* means clients will hang after the first flip is queued. Fortunately the -* blit ring generates interrupts properly, so use it instead. -*/ static int intel_gen7_queue_flip(struct drm_device *dev, struct drm_crtc *crtc, struct drm_framebuffer *fb,
@@ -7839,9 +7833,13 @@ static int intel_gen7_queue_flip(struct drm_device *dev, {struct drm_i915_private *dev_priv = dev->dev_private;struct intel_crtc *intel_crtc =to_intel_crtc (crtc); -struct intel_ring_buffer *ring = &dev_priv->ring[BCS ]; +struct intel_ring_buffer *ring;uint32_t plane_bit =0 ; -int ret; +int len, ret; + + ring = obj->ring; +if (ring ==NULL || ring->id !=RCS ) + ring = &dev_priv->ring[BCS ]; ret =intel_pin_and_fence_fb_obj (dev, obj, ring);if (ret)
@@ -7863,10 +7861,34 @@ static int intel_gen7_queue_flip(struct drm_device *dev, goto err_unpin; } - ret =intel_ring_begin (ring,4 ); + len =4 ; +if (ring->id ==RCS ) + len +=6 ; + + ret =intel_ring_begin (ring, len);if (ret) goto err_unpin; +/* Unmask the flip-done completion message. Note that the bspec says that +* we should do this for both the BCS and RCS, and that we must not unmask +* more than one flip event at any time (or ensure that one flip message +* can be sent by waiting for flip-done prior to queueing new flips). +* Experimentation says that BCS works despite DERRMR masking all +* flip-done completion events and that unmasking all planes at once +* for the RCS also doesn't appear to drop events. Setting the DERRMR +* to zero does lead to lockups within MI_DISPLAY_FLIP. +*/ +if (ring->id ==RCS ) { +intel_ring_emit (ring,MI_LOAD_REGISTER_IMM (1 )); +intel_ring_emit (ring,DERRMR ); +intel_ring_emit (ring, ~(DERRMR_PIPEA_PRI_FLIP_DONE | +DERRMR_PIPEB_PRI_FLIP_DONE | +DERRMR_PIPEC_PRI_FLIP_DONE )); +intel_ring_emit (ring,MI_STORE_REGISTER_MEM (1 )); +intel_ring_emit (ring,DERRMR ); +intel_ring_emit (ring, ring->scratch.gtt_offset +256 ); + } +intel_ring_emit (ring,MI_DISPLAY_FLIP_I915 | plane_bit);intel_ring_emit (ring, (fb->pitches[0 ] | obj->tiling_mode));intel_ring_emit (ring,i915_gem_obj_ggtt_offset (obj) + intel_crtc->dspaddr_offset);
Signature · 1 line
1.8.4.rc3
Re: [PATCH 2/2] drm/i915: Use RCS flips on Ivybridge+
Quoted 9 lines · Chris Wilson
RCS flips do work on Iybridge+ so long as we can unmask the messages through DERRMR. However, there are quite a few workarounds mentioned regarding unmasking more than one event or triggering more than one message through DERRMR. Those workarounds in principle prevent us from performing pipelined flips (and asynchronous flips across multiple planes) and equally apply to the "known good" BCS ring. Given that it already appears to work, and also appears to work with unmasking all 3 planes at once (and queuing flips across multiple planes), be brave.
Quoted 4 lines
Bugzlla: https://bugs.freedesktop.org/show_bug.cgi?id=67600
Signed-off-by Chris Wilson <[email protected]>Lightly-tested-by Stephane Marchesin <[email protected]>
You can go ahead and say Tested-by, I ran my usual tests for 3 hours and it didn't crash/show an issue. It would crash in ~10-30 minutes with the other patches.
Stéphane
Quoted 126 lines
Cc Stephane Marchesin <[email protected]>Cc Ben Widawsky <[email protected]>--- drivers/gpu/drm/i915/i915_reg.h | 18 ++++++++++++++++ drivers/gpu/drm/i915/intel_display.c | 40 ++++++++++++++++++++++++++++-------- 2 files changed, 49 insertions(+), 9 deletions(-)drivers/gpu/drm/i915/i915_reg.h +18
-0@@ -230,6 +230,7 @@* address/value pairs. Don't overdue it, though, x <= 2^4 must hold! */ #define MI_LOAD_REGISTER_IMM (x) MI_INSTR(0x22, 2*x-1) +#define MI_STORE_REGISTER_MEM (x) MI_INSTR(0x24, 2*x-1)#define MI_FLUSH_DW MI_INSTR(0x26, 1)/* for GEN6 */ #define MI_FLUSH_DW_STORE_INDEX (1<<21)#define MI_INVALIDATE_TLB (1<<18)@@ -678,6 +679,23 @@#define FPGA_DBG_RM_NOCLAIM (1<<31)#define DERRMR 0x44050 +#define DERRMR_PIPEA_SCANLINE (1<<0) +#define DERRMR_PIPEA_PRI_FLIP_DONE (1<<1) +#define DERRMR_PIPEA_SPR_FLIP_DONE (1<<2) +#define DERRMR_PIPEA_VBLANK (1<<3) +#define DERRMR_PIPEA_HBLANK (1<<5) +#define DERRMR_PIPEB_SCANLINE (1<<8) +#define DERRMR_PIPEB_PRI_FLIP_DONE (1<<9) +#define DERRMR_PIPEB_SPR_FLIP_DONE (1<<10) +#define DERRMR_PIPEB_VBLANK (1<<11) +#define DERRMR_PIPEB_HBLANK (1<<13) +/* Note that PIPEC is not a simple translation of PIPEA/PIPEB */ +#define DERRMR_PIPEC_SCANLINE (1<<14) +#define DERRMR_PIPEC_PRI_FLIP_DONE (1<<15) +#define DERRMR_PIPEC_SPR_FLIP_DONE (1<<20) +#define DERRMR_PIPEC_VBLANK (1<<21) +#define DERRMR_PIPEC_HBLANK (1<<22) +/* GM45+ chicken bits -- debug workaround bits that may be required * for various sorts of correct behavior. The top 16 bits of each are drivers/gpu/drm/i915/intel_display.c +0
-3@@ -7826,12 +7826,6 @@ err:return ret; } -/* -* On gen7 we currently use the blit ring because (in early silicon at least) -* the render ring doesn't give us interrpts for page flip completion, which
- * means clients will hang after the first flip is queued. Fortunately the
- * blit ring generates interrupts properly, so use it instead.
- */
static int intel_gen7_queue_flip(structdrm_device*dev,
structdrm_crtc*crtc, structdrm_framebuffer*fb,drivers/gpu/drm/i915/intel_display.c +6
-2@@ -7839,9 +7833,13 @@ static int intel_gen7_queue_flip(struct drm_device *dev, {struct drm_i915_private *dev_priv = dev->dev_private;struct intel_crtc *intel_crtc =to_intel_crtc (crtc); -struct intel_ring_buffer *ring = &dev_priv->ring[BCS ]; +struct intel_ring_buffer *ring;uint32_t plane_bit =0 ; -int ret; +int len, ret; + + ring = obj->ring; +if (ring ==NULL || ring->id !=RCS ) + ring = &dev_priv->ring[BCS ]; ret =intel_pin_and_fence_fb_obj (dev, obj, ring);if (ret)
drivers/gpu/drm/i915/intel_display.c +6
-1@@ -7863,10 +7861,34 @@ static int intel_gen7_queue_flip(struct drm_device *dev, goto err_unpin; } - ret =intel_ring_begin (ring,4 ); + len =4 ; +if (ring->id ==RCS ) + len +=6 ; + + ret =intel_ring_begin (ring, len);if (ret) goto err_unpin; +/* Unmask the flip-done completion message. Note that the bspec says that
+ * we should do this for both the BCS and RCS, and that we must
not unmask
+ * more than one flip event at any time (or ensure that one flip
message
+ * can be sent by waiting for flip-done prior to queueing new
flips).drivers/gpu/drm/i915/intel_display.c +2
-0+* Experimentation says that BCS works despite DERRMR masking all +* flip-done completion events and that unmasking all planes at once
+ * for the RCS also doesn't appear to drop events. Setting the
DERRMRdrivers/gpu/drm/i915/intel_display.c +13
-0+* to zero does lead to lockups within MI_DISPLAY_FLIP. +*/ +if (ring->id ==RCS ) { +intel_ring_emit (ring,MI_LOAD_REGISTER_IMM (1 )); +intel_ring_emit (ring,DERRMR ); +intel_ring_emit (ring, ~(DERRMR_PIPEA_PRI_FLIP_DONE | +DERRMR_PIPEB_PRI_FLIP_DONE | +DERRMR_PIPEC_PRI_FLIP_DONE )); +intel_ring_emit (ring,MI_STORE_REGISTER_MEM (1 )); +intel_ring_emit (ring,DERRMR ); +intel_ring_emit (ring, ring->scratch.gtt_offset +256 ); + } +intel_ring_emit (ring,MI_DISPLAY_FLIP_I915 | plane_bit);intel_ring_emit (ring, (fb->pitches[0 ] | obj->tiling_mode)); intel_ring_emit(ring, i915_gem_obj_ggtt_offset(obj) +
Quoted 4 lines
intel_crtc->dspaddr_offset);
--
1.8.4.rc3
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 2/2] drm/i915: Use RCS flips on Ivybridge+
Quoted 14 lines · Stéphane Marchesin
Quoted 9 lines · Chris Wilson
RCS flips do work on Iybridge+ so long as we can unmask the messages through DERRMR. However, there are quite a few workarounds mentioned regarding unmasking more than one event or triggering more than one message through DERRMR. Those workarounds in principle prevent us from performing pipelined flips (and asynchronous flips across multiple planes) and equally apply to the "known good" BCS ring. Given that it already appears to work, and also appears to work with unmasking all 3 planes at once (and queuing flips across multiple planes), be brave.
Quoted 9 lines
Quoted 4 lines
Bugzlla: https://bugs.freedesktop.org/show_bug.cgi?id=67600
Signed-off-by Chris Wilson <[email protected]>Lightly-tested-by Stephane Marchesin <[email protected]>You can go ahead and say Tested-by, I ran my usual tests for 3 hours and it didn't crash/show an issue. It would crash in ~10-30 minutes with the other patches.
Oh actually this one is a bit different... Give me 3 hours :)
Stéphane
Quoted 126 lines
Stéphane
Quoted 122 lines
Cc Stephane Marchesin <[email protected]>Cc Ben Widawsky <[email protected]>--- drivers/gpu/drm/i915/i915_reg.h | 18 ++++++++++++++++ drivers/gpu/drm/i915/intel_display.c | 40 ++++++++++++++++++++++++++++-------- 2 files changed, 49 insertions(+), 9 deletions(-)drivers/gpu/drm/i915/i915_reg.h +18
-0@@ -230,6 +230,7 @@* address/value pairs. Don't overdue it, though, x <= 2^4 must hold! */ #define MI_LOAD_REGISTER_IMM (x) MI_INSTR(0x22, 2*x-1) +#define MI_STORE_REGISTER_MEM (x) MI_INSTR(0x24, 2*x-1)#define MI_FLUSH_DW MI_INSTR(0x26, 1)/* for GEN6 */ #define MI_FLUSH_DW_STORE_INDEX (1<<21)#define MI_INVALIDATE_TLB (1<<18)@@ -678,6 +679,23 @@#define FPGA_DBG_RM_NOCLAIM (1<<31)#define DERRMR 0x44050 +#define DERRMR_PIPEA_SCANLINE (1<<0) +#define DERRMR_PIPEA_PRI_FLIP_DONE (1<<1) +#define DERRMR_PIPEA_SPR_FLIP_DONE (1<<2) +#define DERRMR_PIPEA_VBLANK (1<<3) +#define DERRMR_PIPEA_HBLANK (1<<5) +#define DERRMR_PIPEB_SCANLINE (1<<8) +#define DERRMR_PIPEB_PRI_FLIP_DONE (1<<9) +#define DERRMR_PIPEB_SPR_FLIP_DONE (1<<10) +#define DERRMR_PIPEB_VBLANK (1<<11) +#define DERRMR_PIPEB_HBLANK (1<<13) +/* Note that PIPEC is not a simple translation of PIPEA/PIPEB */ +#define DERRMR_PIPEC_SCANLINE (1<<14) +#define DERRMR_PIPEC_PRI_FLIP_DONE (1<<15) +#define DERRMR_PIPEC_SPR_FLIP_DONE (1<<20) +#define DERRMR_PIPEC_VBLANK (1<<21) +#define DERRMR_PIPEC_HBLANK (1<<22) +/* GM45+ chicken bits -- debug workaround bits that may be required * for various sorts of correct behavior. The top 16 bits of each are drivers/gpu/drm/i915/intel_display.c +0
-3@@ -7826,12 +7826,6 @@ err:return ret; } -/* -* On gen7 we currently use the blit ring because (in early silicon at least) -* the render ring doesn't give us interrpts for page flip completion, which
- * means clients will hang after the first flip is queued. Fortunately the
- * blit ring generates interrupts properly, so use it instead.
- */
static int intel_gen7_queue_flip(structdrm_device*dev,
structdrm_crtc*crtc, structdrm_framebuffer*fb,drivers/gpu/drm/i915/intel_display.c +6
-2@@ -7839,9 +7833,13 @@ static int intel_gen7_queue_flip(struct drm_device *dev, {struct drm_i915_private *dev_priv = dev->dev_private;struct intel_crtc *intel_crtc =to_intel_crtc (crtc); -struct intel_ring_buffer *ring = &dev_priv->ring[BCS ]; +struct intel_ring_buffer *ring;uint32_t plane_bit =0 ; -int ret; +int len, ret; + + ring = obj->ring; +if (ring ==NULL || ring->id !=RCS ) + ring = &dev_priv->ring[BCS ]; ret =intel_pin_and_fence_fb_obj (dev, obj, ring);if (ret)
drivers/gpu/drm/i915/intel_display.c +6
-1@@ -7863,10 +7861,34 @@ static int intel_gen7_queue_flip(structdrm_device *dev, goto err_unpin; } - ret =intel_ring_begin (ring,4 ); + len =4 ; +if (ring->id ==RCS ) + len +=6 ; + + ret =intel_ring_begin (ring, len);if (ret) goto err_unpin; +/* Unmask the flip-done completion message. Note that the bspec says that
+ * we should do this for both the BCS and RCS, and that we must
not unmask
+ * more than one flip event at any time (or ensure that one flip
message
+ * can be sent by waiting for flip-done prior to queueing new
flips).drivers/gpu/drm/i915/intel_display.c +2
-0+* Experimentation says that BCS works despite DERRMR masking all +* flip-done completion events and that unmasking all planes at once
+ * for the RCS also doesn't appear to drop events. Setting the
DERRMRdrivers/gpu/drm/i915/intel_display.c +12
-0+* to zero does lead to lockups within MI_DISPLAY_FLIP. +*/ +if (ring->id ==RCS ) { +intel_ring_emit (ring,MI_LOAD_REGISTER_IMM (1 )); +intel_ring_emit (ring,DERRMR ); +intel_ring_emit (ring, ~(DERRMR_PIPEA_PRI_FLIP_DONE | +DERRMR_PIPEB_PRI_FLIP_DONE | +DERRMR_PIPEC_PRI_FLIP_DONE )); +intel_ring_emit (ring,MI_STORE_REGISTER_MEM (1 )); +intel_ring_emit (ring,DERRMR ); +intel_ring_emit (ring, ring->scratch.gtt_offset +256 ); + }
Quoted 10 lines
Quoted 8 lines
+
intel_ring_emit(ring, MI_DISPLAY_FLIP_I915 | plane_bit); intel_ring_emit(ring, (fb->pitches[0] | obj->tiling_mode)); intel_ring_emit(ring, i915_gem_obj_ggtt_offset(obj) +
intel_crtc->dspaddr_offset);
--
1.8.4.rc3
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 2/2] drm/i915: Use RCS flips on Ivybridge+
Quoted 19 lines · Stéphane Marchesin
On Mon, Aug 26, 2013 at 1:42 PM, St�phane Marchesin <[1][email protected]> wrote:
On Mon, Aug 26, 2013 at 12:58 PM, Chris Wilson <[2][email protected]> wrote:
RCS flips do work on Iybridge+ so long as we can unmask the messages through DERRMR. However, there are quite a few workarounds mentioned regarding unmasking more than one event or triggering more than one message through DERRMR. Those workarounds in principle prevent us from performing pipelined flips (and asynchronous flips across multiple planes) and equally apply to the "known good" BCS ring. Given that it already appears to work, and also appears to work with unmasking all 3 planes at once (and queuing flips across multiple planes), be brave.
Bugzlla: [3]https://bugs.freedesktop.org/show_bug.cgi?id=67600
Signed-off-by Chris Wilson <[4][email protected]>Lightly-tested-by Stephane Marchesin <[5][email protected]>
Quoted 6 lines
You can go ahead and say Tested-by, I ran my usual tests for 3 hours and it didn't crash/show an issue. It would crash in ~10-30 minutes with the other patches.
Oh actually this one is a bit different... Give me 3 hours :) St�phane
I should have mentionted this was v2, and your testing was for v1. Hopefully, I've moved the code around correctly.
-Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Stéphane Marchesin
Tested-byRe: [PATCH 2/2] drm/i915: Use RCS flips on Ivybridge+
In reply to Stéphane MarchesinQuoted 26 lines · Stéphane Marchesin
Quoted 21 lines · Stéphane Marchesin
Quoted 13 lines · Chris Wilson
RCS flips do work on Iybridge+ so long as we can unmask the messages through DERRMR. However, there are quite a few workarounds mentioned regarding unmasking more than one event or triggering more than one message through DERRMR. Those workarounds in principle prevent us from performing pipelined flips (and asynchronous flips across multiple planes) and equally apply to the "known good" BCS ring. Given that it already appears to work, and also appears to work with unmasking all 3 planes at once (and queuing flips across multiple planes), be brave.
Bugzlla: https://bugs.freedesktop.org/show_bug.cgi?id=67600
Signed-off-by Chris Wilson <[email protected]>Lightly-tested-by Stephane Marchesin <[email protected]>
Quoted 7 lines
Quoted 3 lines
You can go ahead and say Tested-by, I ran my usual tests for 3 hours and it didn't crash/show an issue. It would crash in ~10-30 minutes with the other patches.
Oh actually this one is a bit different... Give me 3 hours :)
Quoted 145 lines
Stéphane
Quoted 126 lines
Stéphane
Quoted 122 lines
Cc Stephane Marchesin <[email protected]>Cc Ben Widawsky <[email protected]>--- drivers/gpu/drm/i915/i915_reg.h | 18 ++++++++++++++++ drivers/gpu/drm/i915/intel_display.c | 40 ++++++++++++++++++++++++++++-------- 2 files changed, 49 insertions(+), 9 deletions(-)drivers/gpu/drm/i915/i915_reg.h +18
-0@@ -230,6 +230,7 @@* address/value pairs. Don't overdue it, though, x <= 2^4 must hold! */ #define MI_LOAD_REGISTER_IMM (x) MI_INSTR(0x22, 2*x-1) +#define MI_STORE_REGISTER_MEM (x) MI_INSTR(0x24, 2*x-1)#define MI_FLUSH_DW MI_INSTR(0x26, 1)/* for GEN6 */ #define MI_FLUSH_DW_STORE_INDEX (1<<21)#define MI_INVALIDATE_TLB (1<<18)@@ -678,6 +679,23 @@#define FPGA_DBG_RM_NOCLAIM (1<<31)#define DERRMR 0x44050 +#define DERRMR_PIPEA_SCANLINE (1<<0) +#define DERRMR_PIPEA_PRI_FLIP_DONE (1<<1) +#define DERRMR_PIPEA_SPR_FLIP_DONE (1<<2) +#define DERRMR_PIPEA_VBLANK (1<<3) +#define DERRMR_PIPEA_HBLANK (1<<5) +#define DERRMR_PIPEB_SCANLINE (1<<8) +#define DERRMR_PIPEB_PRI_FLIP_DONE (1<<9) +#define DERRMR_PIPEB_SPR_FLIP_DONE (1<<10) +#define DERRMR_PIPEB_VBLANK (1<<11) +#define DERRMR_PIPEB_HBLANK (1<<13) +/* Note that PIPEC is not a simple translation of PIPEA/PIPEB */ +#define DERRMR_PIPEC_SCANLINE (1<<14) +#define DERRMR_PIPEC_PRI_FLIP_DONE (1<<15) +#define DERRMR_PIPEC_SPR_FLIP_DONE (1<<20) +#define DERRMR_PIPEC_VBLANK (1<<21) +#define DERRMR_PIPEC_HBLANK (1<<22) +/* GM45+ chicken bits -- debug workaround bits that may be required * for various sorts of correct behavior. The top 16 bits of each are drivers/gpu/drm/i915/intel_display.c +0
-3@@ -7826,12 +7826,6 @@ err:return ret; } -/* -* On gen7 we currently use the blit ring because (in early silicon at least) -* the render ring doesn't give us interrpts for page flip completion, which
- * means clients will hang after the first flip is queued. Fortunately the
- * blit ring generates interrupts properly, so use it instead.
- */
static int intel_gen7_queue_flip(structdrm_device*dev,
structdrm_crtc*crtc, structdrm_framebuffer*fb,drivers/gpu/drm/i915/intel_display.c +6
-2@@ -7839,9 +7833,13 @@ static int intel_gen7_queue_flip(struct drm_device *dev, {struct drm_i915_private *dev_priv = dev->dev_private;struct intel_crtc *intel_crtc =to_intel_crtc (crtc); -struct intel_ring_buffer *ring = &dev_priv->ring[BCS ]; +struct intel_ring_buffer *ring;uint32_t plane_bit =0 ; -int ret; +int len, ret; + + ring = obj->ring; +if (ring ==NULL || ring->id !=RCS ) + ring = &dev_priv->ring[BCS ]; ret =intel_pin_and_fence_fb_obj (dev, obj, ring);if (ret)
drivers/gpu/drm/i915/intel_display.c +6
-1@@ -7863,10 +7861,34 @@ static int intel_gen7_queue_flip(structdrm_device *dev, goto err_unpin; } - ret =intel_ring_begin (ring,4 ); + len =4 ; +if (ring->id ==RCS ) + len +=6 ; + + ret =intel_ring_begin (ring, len);if (ret) goto err_unpin; +/* Unmask the flip-done completion message. Note that the bspec says that
+ * we should do this for both the BCS and RCS, and that we must
not unmask
+ * more than one flip event at any time (or ensure that one flip
message
+ * can be sent by waiting for flip-done prior to queueing new
flips).drivers/gpu/drm/i915/intel_display.c +2
-0+* Experimentation says that BCS works despite DERRMR masking all +* flip-done completion events and that unmasking all planes at once
+ * for the RCS also doesn't appear to drop events. Setting the
DERRMRdrivers/gpu/drm/i915/intel_display.c +11
-0+* to zero does lead to lockups within MI_DISPLAY_FLIP. +*/ +if (ring->id ==RCS ) { +intel_ring_emit (ring,MI_LOAD_REGISTER_IMM (1 )); +intel_ring_emit (ring,DERRMR ); +intel_ring_emit (ring, ~(DERRMR_PIPEA_PRI_FLIP_DONE | +DERRMR_PIPEB_PRI_FLIP_DONE | +DERRMR_PIPEC_PRI_FLIP_DONE )); +intel_ring_emit (ring,MI_STORE_REGISTER_MEM (1 )); +intel_ring_emit (ring,DERRMR ); +intel_ring_emit (ring, ring->scratch.gtt_offset +256 );Quoted 10 lines
Quoted 8 lines
drivers/gpu/drm/i915/intel_display.c +2
-0+ } +intel_ring_emit (ring,MI_DISPLAY_FLIP_I915 | plane_bit);intel_ring_emit (ring, (fb->pitches[0 ] | obj->tiling_mode)); intel_ring_emit(ring, i915_gem_obj_ggtt_offset(obj) +
intel_crtc->dspaddr_offset);
--
1.8.4.rc3_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 2/2] drm/i915: Use RCS flips on Ivybridge+
In reply to Chris WilsonQuoted 9 lines · Chris Wilson
RCS flips do work on Iybridge+ so long as we can unmask the messages through DERRMR. However, there are quite a few workarounds mentioned regarding unmasking more than one event or triggering more than one message through DERRMR. Those workarounds in principle prevent us from performing pipelined flips (and asynchronous flips across multiple planes) and equally apply to the "known good" BCS ring. Given that it already appears to work, and also appears to work with unmasking all 3 planes at once (and queuing flips across multiple planes), be brave.
Quoted 5 lines
Bugzlla: https://bugs.freedesktop.org/show_bug.cgi?id=67600
Signed-off-by Chris Wilson <[email protected]>Lightly-tested-by Stephane Marchesin <[email protected]>Cc Stephane Marchesin <[email protected]>Cc Ben Widawsky <[email protected]>
Both patches merged to dinq.
-Daniel
Quoted 117 lines
--- drivers/gpu/drm/i915/i915_reg.h | 18 ++++++++++++++++ drivers/gpu/drm/i915/intel_display.c | 40 ++++++++++++++++++++++++++++-------- 2 files changed, 49 insertions(+), 9 deletions(-)drivers/gpu/drm/i915/i915_reg.h +18
-0@@ -230,6 +230,7 @@* address/value pairs. Don't overdue it, though, x <= 2^4 must hold! */ #define MI_LOAD_REGISTER_IMM (x) MI_INSTR(0x22, 2*x-1) +#define MI_STORE_REGISTER_MEM (x) MI_INSTR(0x24, 2*x-1)#define MI_FLUSH_DW MI_INSTR(0x26, 1)/* for GEN6 */ #define MI_FLUSH_DW_STORE_INDEX (1<<21)#define MI_INVALIDATE_TLB (1<<18)@@ -678,6 +679,23 @@#define FPGA_DBG_RM_NOCLAIM (1<<31)#define DERRMR 0x44050 +#define DERRMR_PIPEA_SCANLINE (1<<0) +#define DERRMR_PIPEA_PRI_FLIP_DONE (1<<1) +#define DERRMR_PIPEA_SPR_FLIP_DONE (1<<2) +#define DERRMR_PIPEA_VBLANK (1<<3) +#define DERRMR_PIPEA_HBLANK (1<<5) +#define DERRMR_PIPEB_SCANLINE (1<<8) +#define DERRMR_PIPEB_PRI_FLIP_DONE (1<<9) +#define DERRMR_PIPEB_SPR_FLIP_DONE (1<<10) +#define DERRMR_PIPEB_VBLANK (1<<11) +#define DERRMR_PIPEB_HBLANK (1<<13) +/* Note that PIPEC is not a simple translation of PIPEA/PIPEB */ +#define DERRMR_PIPEC_SCANLINE (1<<14) +#define DERRMR_PIPEC_PRI_FLIP_DONE (1<<15) +#define DERRMR_PIPEC_SPR_FLIP_DONE (1<<20) +#define DERRMR_PIPEC_VBLANK (1<<21) +#define DERRMR_PIPEC_HBLANK (1<<22) +/* GM45+ chicken bits -- debug workaround bits that may be required * for various sorts of correct behavior. The top 16 bits of each are drivers/gpu/drm/i915/intel_display.c +31
-9@@ -7826,12 +7826,6 @@ err:return ret; } -/* -* On gen7 we currently use the blit ring because (in early silicon at least) -* the render ring doesn't give us interrpts for page flip completion, which -* means clients will hang after the first flip is queued. Fortunately the -* blit ring generates interrupts properly, so use it instead. -*/ static int intel_gen7_queue_flip(struct drm_device *dev, struct drm_crtc *crtc, struct drm_framebuffer *fb,@@ -7839,9 +7833,13 @@ static int intel_gen7_queue_flip(struct drm_device *dev, {struct drm_i915_private *dev_priv = dev->dev_private;struct intel_crtc *intel_crtc =to_intel_crtc (crtc); -struct intel_ring_buffer *ring = &dev_priv->ring[BCS ]; +struct intel_ring_buffer *ring;uint32_t plane_bit =0 ; -int ret; +int len, ret; + + ring = obj->ring; +if (ring ==NULL || ring->id !=RCS ) + ring = &dev_priv->ring[BCS ]; ret =intel_pin_and_fence_fb_obj (dev, obj, ring);if (ret)@@ -7863,10 +7861,34 @@ static int intel_gen7_queue_flip(struct drm_device *dev, goto err_unpin; } - ret =intel_ring_begin (ring,4 ); + len =4 ; +if (ring->id ==RCS ) + len +=6 ; + + ret =intel_ring_begin (ring, len);if (ret) goto err_unpin; +/* Unmask the flip-done completion message. Note that the bspec says that +* we should do this for both the BCS and RCS, and that we must not unmask +* more than one flip event at any time (or ensure that one flip message +* can be sent by waiting for flip-done prior to queueing new flips). +* Experimentation says that BCS works despite DERRMR masking all +* flip-done completion events and that unmasking all planes at once +* for the RCS also doesn't appear to drop events. Setting the DERRMR +* to zero does lead to lockups within MI_DISPLAY_FLIP. +*/ +if (ring->id ==RCS ) { +intel_ring_emit (ring,MI_LOAD_REGISTER_IMM (1 )); +intel_ring_emit (ring,DERRMR ); +intel_ring_emit (ring, ~(DERRMR_PIPEA_PRI_FLIP_DONE | +DERRMR_PIPEB_PRI_FLIP_DONE | +DERRMR_PIPEC_PRI_FLIP_DONE )); +intel_ring_emit (ring,MI_STORE_REGISTER_MEM (1 )); +intel_ring_emit (ring,DERRMR ); +intel_ring_emit (ring, ring->scratch.gtt_offset +256 ); + } +intel_ring_emit (ring,MI_DISPLAY_FLIP_I915 | plane_bit);intel_ring_emit (ring, (fb->pitches[0 ] | obj->tiling_mode));intel_ring_emit (ring,i915_gem_obj_ggtt_offset (obj) + intel_crtc->dspaddr_offset);Signature · 6 lines
1.8.4.rc3 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
Re: [PATCH 2/2] drm/i915: Use RCS flips on Ivybridge+
This patch causes VLV hang, look like ring buffer lockup.
This is the message.
[drm] stuck on render ring
I haven't look at the bspec for the different between VLV and Ivybridge on this yet. Just see anyone have any clue why this might fail in VLV.
Quoted 145 lines · Daniel Vetter
Quoted 9 lines · Chris Wilson
RCS flips do work on Iybridge+ so long as we can unmask the messages through DERRMR. However, there are quite a few workarounds mentioned regarding unmasking more than one event or triggering more than one message through DERRMR. Those workarounds in principle prevent us from performing pipelined flips (and asynchronous flips across multiple planes) and equally apply to the "known good" BCS ring. Given that it already appears to work, and also appears to work with unmasking all 3 planes at once (and queuing flips across multiple planes), be brave.
Quoted 5 lines
Bugzlla: https://bugs.freedesktop.org/show_bug.cgi?id=67600
Signed-off-by Chris Wilson <[email protected]>Lightly-tested-by Stephane Marchesin <[email protected]>Cc Stephane Marchesin <[email protected]>Cc Ben Widawsky <[email protected]>Both patches merged to dinq.
-DanielQuoted 117 lines
--- drivers/gpu/drm/i915/i915_reg.h | 18 ++++++++++++++++ drivers/gpu/drm/i915/intel_display.c | 40 ++++++++++++++++++++++++++++-------- 2 files changed, 49 insertions(+), 9 deletions(-)drivers/gpu/drm/i915/i915_reg.h +18
-0@@ -230,6 +230,7 @@* address/value pairs. Don't overdue it, though, x <= 2^4 must hold! */ #define MI_LOAD_REGISTER_IMM (x) MI_INSTR(0x22, 2*x-1) +#define MI_STORE_REGISTER_MEM (x) MI_INSTR(0x24, 2*x-1)#define MI_FLUSH_DW MI_INSTR(0x26, 1)/* for GEN6 */ #define MI_FLUSH_DW_STORE_INDEX (1<<21)#define MI_INVALIDATE_TLB (1<<18)@@ -678,6 +679,23 @@#define FPGA_DBG_RM_NOCLAIM (1<<31)#define DERRMR 0x44050 +#define DERRMR_PIPEA_SCANLINE (1<<0) +#define DERRMR_PIPEA_PRI_FLIP_DONE (1<<1) +#define DERRMR_PIPEA_SPR_FLIP_DONE (1<<2) +#define DERRMR_PIPEA_VBLANK (1<<3) +#define DERRMR_PIPEA_HBLANK (1<<5) +#define DERRMR_PIPEB_SCANLINE (1<<8) +#define DERRMR_PIPEB_PRI_FLIP_DONE (1<<9) +#define DERRMR_PIPEB_SPR_FLIP_DONE (1<<10) +#define DERRMR_PIPEB_VBLANK (1<<11) +#define DERRMR_PIPEB_HBLANK (1<<13) +/* Note that PIPEC is not a simple translation of PIPEA/PIPEB */ +#define DERRMR_PIPEC_SCANLINE (1<<14) +#define DERRMR_PIPEC_PRI_FLIP_DONE (1<<15) +#define DERRMR_PIPEC_SPR_FLIP_DONE (1<<20) +#define DERRMR_PIPEC_VBLANK (1<<21) +#define DERRMR_PIPEC_HBLANK (1<<22) +/* GM45+ chicken bits -- debug workaround bits that may be required * for various sorts of correct behavior. The top 16 bits of each are drivers/gpu/drm/i915/intel_display.c +31
-9@@ -7826,12 +7826,6 @@ err:return ret; } -/* -* On gen7 we currently use the blit ring because (in early silicon at least) -* the render ring doesn't give us interrpts for page flip completion, which -* means clients will hang after the first flip is queued. Fortunately the -* blit ring generates interrupts properly, so use it instead. -*/ static int intel_gen7_queue_flip(struct drm_device *dev, struct drm_crtc *crtc, struct drm_framebuffer *fb,@@ -7839,9 +7833,13 @@ static int intel_gen7_queue_flip(struct drm_device *dev, {struct drm_i915_private *dev_priv = dev->dev_private;struct intel_crtc *intel_crtc =to_intel_crtc (crtc); -struct intel_ring_buffer *ring = &dev_priv->ring[BCS ]; +struct intel_ring_buffer *ring;uint32_t plane_bit =0 ; -int ret; +int len, ret; + + ring = obj->ring; +if (ring ==NULL || ring->id !=RCS ) + ring = &dev_priv->ring[BCS ]; ret =intel_pin_and_fence_fb_obj (dev, obj, ring);if (ret)@@ -7863,10 +7861,34 @@ static int intel_gen7_queue_flip(struct drm_device *dev, goto err_unpin; } - ret =intel_ring_begin (ring,4 ); + len =4 ; +if (ring->id ==RCS ) + len +=6 ; + + ret =intel_ring_begin (ring, len);if (ret) goto err_unpin; +/* Unmask the flip-done completion message. Note that the bspec says that +* we should do this for both the BCS and RCS, and that we must not unmask +* more than one flip event at any time (or ensure that one flip message +* can be sent by waiting for flip-done prior to queueing new flips). +* Experimentation says that BCS works despite DERRMR masking all +* flip-done completion events and that unmasking all planes at once +* for the RCS also doesn't appear to drop events. Setting the DERRMR +* to zero does lead to lockups within MI_DISPLAY_FLIP. +*/ +if (ring->id ==RCS ) { +intel_ring_emit (ring,MI_LOAD_REGISTER_IMM (1 )); +intel_ring_emit (ring,DERRMR ); +intel_ring_emit (ring, ~(DERRMR_PIPEA_PRI_FLIP_DONE | +DERRMR_PIPEB_PRI_FLIP_DONE | +DERRMR_PIPEC_PRI_FLIP_DONE )); +intel_ring_emit (ring,MI_STORE_REGISTER_MEM (1 )); +intel_ring_emit (ring,DERRMR ); +intel_ring_emit (ring, ring->scratch.gtt_offset +256 ); + } +intel_ring_emit (ring,MI_DISPLAY_FLIP_I915 | plane_bit);intel_ring_emit (ring, (fb->pitches[0 ] | obj->tiling_mode));intel_ring_emit (ring,i915_gem_obj_ggtt_offset (obj) + intel_crtc->dspaddr_offset);Signature · 6 lines
1.8.4.rc3 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfxSignature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 2/2] drm/i915: Use RCS flips on Ivybridge+
Quoted 7 lines · Chon Ming
This patch causes VLV hang, look like ring buffer lockup.
This is the message.
[drm] stuck on render ringI haven't look at the bspec for the different between VLV and Ivybridge on this yet. Just see anyone have any clue why this might fail in VLV.
I guess there's no DERRMR register on vlv? If that's the case I think we just need to disable rcs flips on vlv.
-Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
Re: [PATCH 2/2] drm/i915: Use RCS flips on Ivybridge+
Quoted 11 lines · Daniel Vetter
Quoted 7 lines · Chon Ming
This patch causes VLV hang, look like ring buffer lockup.
This is the message.
[drm] stuck on render ringI haven't look at the bspec for the different between VLV and Ivybridge on this yet. Just see anyone have any clue why this might fail in VLV.
I guess there's no DERRMR register on vlv? If that's the case I think we just need to disable rcs flips on vlv.
There's the DPFLIPSTAT register. But my understanding was that it only affects flip done signalling for MI_WAIT stuff. Worth a shot maybe anyway.
Signature · 2 lines
Ville Syrjälä Intel OTC
Re: [PATCH 2/2] drm/i915: Use RCS flips on Ivybridge+
In reply to Daniel VetterDERRMR is documented in vlv bspec.
Regards,
Chon Ming
Quoted 16 lines · Daniel Vetter
Quoted 7 lines · Chon Ming
This patch causes VLV hang, look like ring buffer lockup.
This is the message.
[drm] stuck on render ringI haven't look at the bspec for the different between VLV and Ivybridge on this yet. Just see anyone have any clue why this might fail in VLV.
I guess there's no DERRMR register on vlv? If that's the case I think we just need to disable rcs flips on vlv.
-DanielSignature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
Re: [PATCH 2/2] drm/i915: Use RCS flips on Ivybridge+
In reply to Lee, Chon MingQuoted 7 lines · Chon Ming
This patch causes VLV hang, look like ring buffer lockup.
This is the message.
[drm] stuck on render ringI haven't look at the bspec for the different between VLV and Ivybridge on this yet. Just see anyone have any clue why this might fail in VLV.
Hmm, vsync on vlv behaves like snb not ivb, so flipping may be snb as well? Bspec confirms, MI_DISPLAY_FLIP is invalid for RCS on VLV. -Chris
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre