drm/i915: Make semaphore updates more precise
Subsystems (2)
Rodrigo Vivi
maintainerPATCH 1/10 drm/i915: Make semaphore updates more precise
From: Ben Widawsky <[email protected]>
With the ring mask we now have an easy way to know the number of rings in the system, and therefore can accurately predict the number of dwords to emit for semaphore signalling. This was not possible (easily) previously.
There should be no functional impact, simply fewer instructions emitted.
While we're here, simply do the round up to 2 instead of the fancier rounding we did before, which rounding up per mbox, ie 4. This also allows us to drop the unnecessary MI_NOOP, so not really 4, 3.
v2: Use 3 dwords instead of 4 (Ville)
Do the proper calculation to get the number of dwords to emit (Ville) Conditionally set .sync_to when semaphores are enabled (Ville)
v3: Rebased on VCS2
Replace hweight_long with hweight32 (Ville)
v4: Pull out the accidentally squashed hunk from the next patch after rebase (Daniel).
v5: Fix conflict after rebase (Rodrigo)
--- drivers/gpu/drm/i915/intel_ringbuffer.c | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-)
drivers/gpu/drm/i915/intel_ringbuffer.c +9 -18
@@ -679,23 +679,16 @@ static int gen6_signal(struct intel_engine_cs *signaller,struct drm_device *dev = signaller->dev;struct drm_i915_private *dev_priv = dev->dev_private;struct intel_engine_cs *useless; -int i, ret; +int i, ret, num_rings; -/* NB: In order to be able to do semaphore MBOX updates for varying -* number of rings, it's easiest if we round up each individual update -* to a multiple of 2 (since ring updates must always be a multiple of -* 2) even though the actual update only requires 3 dwords. -*/ -#define MBOX_UPDATE_DWORDS 4 -if (i915_semaphore_is_enabled (dev)) - num_dwords += ((I915_NUM_RINGS -1 ) *MBOX_UPDATE_DWORDS ); -else -return intel_ring_begin (signaller, num_dwords); +#define MBOX_UPDATE_DWORDS 3 + num_rings =hweight32 (INTEL_INFO (dev)->ring_mask); + num_dwords +=round_up ((num_rings-1 ) *MBOX_UPDATE_DWORDS ,2 ); +#undef MBOX_UPDATE_DWORDS ret =intel_ring_begin (signaller, num_dwords);if (ret)return ret; -#undef MBOX_UPDATE_DWORDSfor_each_ring (useless, dev_priv, i) {u32 mbox_reg = signaller->semaphore.mbox.signal[i];
@@ -703,15 +696,13 @@ static int gen6_signal(struct intel_engine_cs *signaller,intel_ring_emit (signaller,MI_LOAD_REGISTER_IMM (1 ));intel_ring_emit (signaller, mbox_reg);intel_ring_emit (signaller, signaller->outstanding_lazy_seqno); -intel_ring_emit (signaller,MI_NOOP ); - }else { -intel_ring_emit (signaller,MI_NOOP ); -intel_ring_emit (signaller,MI_NOOP ); -intel_ring_emit (signaller,MI_NOOP ); -intel_ring_emit (signaller,MI_NOOP ); } } +/* If num_dwords was rounded, make sure the tail pointer is correct */ +if (num_rings %2 ==0 ) +intel_ring_emit (signaller,MI_NOOP ); +return 0 ; }
Signature · 6 lines
1.9.3 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Rodrigo Vivi
maintainerPATCH 2/10 drm/i915: gen specific ring init
From: Ben Widawsky <[email protected]>
Gen8 has already had some differentiation with how it handles rings. Semaphores bring yet more differences, and now is as good a time as any to do the split.
Also, since gen8 doesn't actually use semaphores up until this point, put the proper "NULL" values in for the mbox info.
v2: v1 had a stale commit message
v3: Move everything in the is_semaphore_enabled() check
v4: VCS2 rebase
Remove double assignment of signal in render ring (Ville)
v5: Adding missed VCS2 signal init on gen8+ (Rodrigo)
--- drivers/gpu/drm/i915/intel_ringbuffer.c | 227 +++++++++++++++++++++----------- 1 file changed, 151 insertions(+), 76 deletions(-)
drivers/gpu/drm/i915/intel_ringbuffer.c +151 -76
@@ -720,7 +720,11 @@ gen6_add_request(struct intel_engine_cs *ring) {int ret; - ret = ring->semaphore.signal (ring,4 ); +if (ring->semaphore.signal) + ret = ring->semaphore.signal (ring,4 ); +else + ret =intel_ring_begin (ring,4 ); +if (ret)return ret;
@@ -1943,40 +1947,59 @@ int intel_init_render_ring_buffer(struct drm_device *dev) ring->id =RCS ; ring->mmio_base =RENDER_RING_BASE ; -if (INTEL_INFO (dev)->gen >=6 ) { +if (INTEL_INFO (dev)->gen >=8 ) { + ring->add_request = gen6_add_request; + ring->flush = gen8_render_ring_flush; + ring->irq_get = gen8_ring_get_irq; + ring->irq_put = gen8_ring_put_irq; + ring->irq_enable_mask =GT_RENDER_USER_INTERRUPT ; + ring->get_seqno = gen6_ring_get_seqno; + ring->set_seqno = ring_set_seqno; +if (i915_semaphore_is_enabled (dev)) { + ring->semaphore.sync_to = gen6_ring_sync; + ring->semaphore.signal = gen6_signal; + ring->semaphore.mbox.wait[RCS ] =MI_SEMAPHORE_SYNC_INVALID ; + ring->semaphore.mbox.wait[VCS ] =MI_SEMAPHORE_SYNC_INVALID ; + ring->semaphore.mbox.wait[BCS ] =MI_SEMAPHORE_SYNC_INVALID ; + ring->semaphore.mbox.wait[VECS ] =MI_SEMAPHORE_SYNC_INVALID ; + ring->semaphore.mbox.wait[VCS2 ] =MI_SEMAPHORE_SYNC_INVALID ; + ring->semaphore.mbox.signal[RCS ] =GEN6_NOSYNC ; + ring->semaphore.mbox.signal[VCS ] =GEN6_NOSYNC ; + ring->semaphore.mbox.signal[BCS ] =GEN6_NOSYNC ; + ring->semaphore.mbox.signal[VECS ] =GEN6_NOSYNC ; + ring->semaphore.mbox.signal[VCS2 ] =GEN6_NOSYNC ; + } + }else if (INTEL_INFO (dev)->gen >=6 ) { ring->add_request = gen6_add_request; ring->flush = gen7_render_ring_flush;if (INTEL_INFO (dev)->gen ==6 ) ring->flush = gen6_render_ring_flush; -if (INTEL_INFO (dev)->gen >=8 ) { - ring->flush = gen8_render_ring_flush; - ring->irq_get = gen8_ring_get_irq; - ring->irq_put = gen8_ring_put_irq; - }else { - ring->irq_get = gen6_ring_get_irq; - ring->irq_put = gen6_ring_put_irq; - } + ring->irq_get = gen6_ring_get_irq; + ring->irq_put = gen6_ring_put_irq; ring->irq_enable_mask =GT_RENDER_USER_INTERRUPT ; ring->get_seqno = gen6_ring_get_seqno; ring->set_seqno = ring_set_seqno; - ring->semaphore.sync_to = gen6_ring_sync; - ring->semaphore.signal = gen6_signal; -/* -* The current semaphore is only applied on pre-gen8 platform. -* And there is no VCS2 ring on the pre-gen8 platform. So the -* semaphore between RCS and VCS2 is initialized as INVALID. -* Gen8 will initialize the sema between VCS2 and RCS later. -*/ - ring->semaphore.mbox.wait[RCS ] =MI_SEMAPHORE_SYNC_INVALID ; - ring->semaphore.mbox.wait[VCS ] =MI_SEMAPHORE_SYNC_RV ; - ring->semaphore.mbox.wait[BCS ] =MI_SEMAPHORE_SYNC_RB ; - ring->semaphore.mbox.wait[VECS ] =MI_SEMAPHORE_SYNC_RVE ; - ring->semaphore.mbox.wait[VCS2 ] =MI_SEMAPHORE_SYNC_INVALID ; - ring->semaphore.mbox.signal[RCS ] =GEN6_NOSYNC ; - ring->semaphore.mbox.signal[VCS ] =GEN6_VRSYNC ; - ring->semaphore.mbox.signal[BCS ] =GEN6_BRSYNC ; - ring->semaphore.mbox.signal[VECS ] =GEN6_VERSYNC ; - ring->semaphore.mbox.signal[VCS2 ] =GEN6_NOSYNC ; +if (i915_semaphore_is_enabled (dev)) { + ring->semaphore.sync_to = gen6_ring_sync; + ring->semaphore.signal = gen6_signal; +/* +* The current semaphore is only applied on pre-gen8 +* platform. And there is no VCS2 ring on the pre-gen8 +* platform. So the semaphore between RCS and VCS2 is +* initialized as INVALID. Gen8 will initialize the +* sema between VCS2 and RCS later. +*/ + ring->semaphore.mbox.wait[RCS ] =MI_SEMAPHORE_SYNC_INVALID ; + ring->semaphore.mbox.wait[VCS ] =MI_SEMAPHORE_SYNC_RV ; + ring->semaphore.mbox.wait[BCS ] =MI_SEMAPHORE_SYNC_RB ; + ring->semaphore.mbox.wait[VECS ] =MI_SEMAPHORE_SYNC_RVE ; + ring->semaphore.mbox.wait[VCS2 ] =MI_SEMAPHORE_SYNC_INVALID ; + ring->semaphore.mbox.signal[RCS ] =GEN6_NOSYNC ; + ring->semaphore.mbox.signal[VCS ] =GEN6_VRSYNC ; + ring->semaphore.mbox.signal[BCS ] =GEN6_BRSYNC ; + ring->semaphore.mbox.signal[VECS ] =GEN6_VERSYNC ; + ring->semaphore.mbox.signal[VCS2 ] =GEN6_NOSYNC ; + } }else if (IS_GEN5 (dev)) { ring->add_request = pc_render_add_request; ring->flush = gen4_render_ring_flush;
@@ -2004,6 +2027,7 @@ int intel_init_render_ring_buffer(struct drm_device *dev) ring->irq_enable_mask =I915_USER_INTERRUPT ; } ring->write_tail = ring_write_tail; +if (IS_HASWELL (dev)) ring->dispatch_execbuffer = hsw_ring_dispatch_execbuffer;else if (IS_GEN8 (dev))
@@ -2154,31 +2178,49 @@ int intel_init_bsd_ring_buffer(struct drm_device *dev) ring->irq_put = gen8_ring_put_irq; ring->dispatch_execbuffer = gen8_ring_dispatch_execbuffer; +if (i915_semaphore_is_enabled (dev)) { + ring->semaphore.sync_to = gen6_ring_sync; + ring->semaphore.signal = gen6_signal; +/* +* The current semaphore is only applied on +* pre-gen8 platform. And there is no VCS2 ring +* on the pre-gen8 platform. So the semaphore +* between VCS and VCS2 is initialized as +* INVALID. Gen8 will initialize the sema +* between VCS2 and VCS later. +*/ + ring->semaphore.mbox.wait[RCS ] =MI_SEMAPHORE_SYNC_INVALID ; + ring->semaphore.mbox.wait[VCS ] =MI_SEMAPHORE_SYNC_INVALID ; + ring->semaphore.mbox.wait[BCS ] =MI_SEMAPHORE_SYNC_INVALID ; + ring->semaphore.mbox.wait[VECS ] =MI_SEMAPHORE_SYNC_INVALID ; + ring->semaphore.mbox.wait[VCS2 ] =MI_SEMAPHORE_SYNC_INVALID ; + ring->semaphore.mbox.signal[RCS ] =GEN6_NOSYNC ; + ring->semaphore.mbox.signal[VCS ] =GEN6_NOSYNC ; + ring->semaphore.mbox.signal[BCS ] =GEN6_NOSYNC ; + ring->semaphore.mbox.signal[VECS ] =GEN6_NOSYNC ; + ring->semaphore.mbox.signal[VCS2 ] =GEN6_NOSYNC ; + } }else { ring->irq_enable_mask =GT_BSD_USER_INTERRUPT ; ring->irq_get = gen6_ring_get_irq; ring->irq_put = gen6_ring_put_irq; ring->dispatch_execbuffer = gen6_ring_dispatch_execbuffer; +if (i915_semaphore_is_enabled (dev)) { + ring->semaphore.sync_to = gen6_ring_sync; + ring->semaphore.signal = gen6_signal; + ring->semaphore.mbox.wait[RCS ] =MI_SEMAPHORE_SYNC_VR ; + ring->semaphore.mbox.wait[VCS ] =MI_SEMAPHORE_SYNC_INVALID ; + ring->semaphore.mbox.wait[BCS ] =MI_SEMAPHORE_SYNC_VB ; + ring->semaphore.mbox.wait[VECS ] =MI_SEMAPHORE_SYNC_VVE ; + ring->semaphore.mbox.wait[VCS2 ] =MI_SEMAPHORE_SYNC_INVALID ; + ring->semaphore.mbox.signal[RCS ] =GEN6_RVSYNC ; + ring->semaphore.mbox.signal[VCS ] =GEN6_NOSYNC ; + ring->semaphore.mbox.signal[BCS ] =GEN6_BVSYNC ; + ring->semaphore.mbox.signal[VECS ] =GEN6_VEVSYNC ; + ring->semaphore.mbox.signal[VCS2 ] =GEN6_NOSYNC ; + } } - ring->semaphore.sync_to = gen6_ring_sync; - ring->semaphore.signal = gen6_signal; -/* -* The current semaphore is only applied on pre-gen8 platform. -* And there is no VCS2 ring on the pre-gen8 platform. So the -* semaphore between VCS and VCS2 is initialized as INVALID. -* Gen8 will initialize the sema between VCS2 and VCS later. -*/ - ring->semaphore.mbox.wait[RCS ] =MI_SEMAPHORE_SYNC_VR ; - ring->semaphore.mbox.wait[VCS ] =MI_SEMAPHORE_SYNC_INVALID ; - ring->semaphore.mbox.wait[BCS ] =MI_SEMAPHORE_SYNC_VB ; - ring->semaphore.mbox.wait[VECS ] =MI_SEMAPHORE_SYNC_VVE ; - ring->semaphore.mbox.wait[VCS2 ] =MI_SEMAPHORE_SYNC_INVALID ; - ring->semaphore.mbox.signal[RCS ] =GEN6_RVSYNC ; - ring->semaphore.mbox.signal[VCS ] =GEN6_NOSYNC ; - ring->semaphore.mbox.signal[BCS ] =GEN6_BVSYNC ; - ring->semaphore.mbox.signal[VECS ] =GEN6_VEVSYNC ; - ring->semaphore.mbox.signal[VCS2 ] =GEN6_NOSYNC ; }else { ring->mmio_base =BSD_RING_BASE ; ring->flush = bsd_ring_flush;
@@ -2274,30 +2316,47 @@ int intel_init_blt_ring_buffer(struct drm_device *dev) ring->irq_get = gen8_ring_get_irq; ring->irq_put = gen8_ring_put_irq; ring->dispatch_execbuffer = gen8_ring_dispatch_execbuffer; +if (i915_semaphore_is_enabled (dev)) { + ring->semaphore.sync_to = gen6_ring_sync; + ring->semaphore.signal = gen6_signal; + ring->semaphore.mbox.wait[RCS ] =MI_SEMAPHORE_SYNC_INVALID ; + ring->semaphore.mbox.wait[VCS ] =MI_SEMAPHORE_SYNC_INVALID ; + ring->semaphore.mbox.wait[BCS ] =MI_SEMAPHORE_SYNC_INVALID ; + ring->semaphore.mbox.wait[VECS ] =MI_SEMAPHORE_SYNC_INVALID ; + ring->semaphore.mbox.wait[VCS2 ] =MI_SEMAPHORE_SYNC_INVALID ; + ring->semaphore.mbox.signal[RCS ] =GEN6_NOSYNC ; + ring->semaphore.mbox.signal[VCS ] =GEN6_NOSYNC ; + ring->semaphore.mbox.signal[BCS ] =GEN6_NOSYNC ; + ring->semaphore.mbox.signal[VECS ] =GEN6_NOSYNC ; + ring->semaphore.mbox.signal[VCS2 ] =GEN6_NOSYNC ; + } }else { ring->irq_enable_mask =GT_BLT_USER_INTERRUPT ; ring->irq_get = gen6_ring_get_irq; ring->irq_put = gen6_ring_put_irq; ring->dispatch_execbuffer = gen6_ring_dispatch_execbuffer; +if (i915_semaphore_is_enabled (dev)) { + ring->semaphore.signal = gen6_signal; + ring->semaphore.sync_to = gen6_ring_sync; +/* +* The current semaphore is only applied on pre-gen8 +* platform. And there is no VCS2 ring on the pre-gen8 +* platform. So the semaphore between BCS and VCS2 is +* initialized as INVALID. Gen8 will initialize the +* sema between BCS and VCS2 later. +*/ + ring->semaphore.mbox.wait[RCS ] =MI_SEMAPHORE_SYNC_BR ; + ring->semaphore.mbox.wait[VCS ] =MI_SEMAPHORE_SYNC_BV ; + ring->semaphore.mbox.wait[BCS ] =MI_SEMAPHORE_SYNC_INVALID ; + ring->semaphore.mbox.wait[VECS ] =MI_SEMAPHORE_SYNC_BVE ; + ring->semaphore.mbox.wait[VCS2 ] =MI_SEMAPHORE_SYNC_INVALID ; + ring->semaphore.mbox.signal[RCS ] =GEN6_RBSYNC ; + ring->semaphore.mbox.signal[VCS ] =GEN6_VBSYNC ; + ring->semaphore.mbox.signal[BCS ] =GEN6_NOSYNC ; + ring->semaphore.mbox.signal[VECS ] =GEN6_VEBSYNC ; + ring->semaphore.mbox.signal[VCS2 ] =GEN6_NOSYNC ; + } } - ring->semaphore.sync_to = gen6_ring_sync; - ring->semaphore.signal = gen6_signal; -/* -* The current semaphore is only applied on pre-gen8 platform. And -* there is no VCS2 ring on the pre-gen8 platform. So the semaphore -* between BCS and VCS2 is initialized as INVALID. -* Gen8 will initialize the sema between BCS and VCS2 later. -*/ - ring->semaphore.mbox.wait[RCS ] =MI_SEMAPHORE_SYNC_BR ; - ring->semaphore.mbox.wait[VCS ] =MI_SEMAPHORE_SYNC_BV ; - ring->semaphore.mbox.wait[BCS ] =MI_SEMAPHORE_SYNC_INVALID ; - ring->semaphore.mbox.wait[VECS ] =MI_SEMAPHORE_SYNC_BVE ; - ring->semaphore.mbox.wait[VCS2 ] =MI_SEMAPHORE_SYNC_INVALID ; - ring->semaphore.mbox.signal[RCS ] =GEN6_RBSYNC ; - ring->semaphore.mbox.signal[VCS ] =GEN6_VBSYNC ; - ring->semaphore.mbox.signal[BCS ] =GEN6_NOSYNC ; - ring->semaphore.mbox.signal[VECS ] =GEN6_VEBSYNC ; - ring->semaphore.mbox.signal[VCS2 ] =GEN6_NOSYNC ; ring->init = init_ring_common;return intel_init_ring_buffer (dev, ring);
@@ -2324,24 +2383,40 @@ int intel_init_vebox_ring_buffer(struct drm_device *dev) ring->irq_get = gen8_ring_get_irq; ring->irq_put = gen8_ring_put_irq; ring->dispatch_execbuffer = gen8_ring_dispatch_execbuffer; +if (i915_semaphore_is_enabled (dev)) { + ring->semaphore.sync_to = gen6_ring_sync; + ring->semaphore.signal = gen6_signal; + ring->semaphore.mbox.wait[RCS ] =MI_SEMAPHORE_SYNC_INVALID ; + ring->semaphore.mbox.wait[VCS ] =MI_SEMAPHORE_SYNC_INVALID ; + ring->semaphore.mbox.wait[BCS ] =MI_SEMAPHORE_SYNC_INVALID ; + ring->semaphore.mbox.wait[VECS ] =MI_SEMAPHORE_SYNC_INVALID ; + ring->semaphore.mbox.wait[VCS2 ] =MI_SEMAPHORE_SYNC_INVALID ; + ring->semaphore.mbox.signal[RCS ] =GEN6_NOSYNC ; + ring->semaphore.mbox.signal[VCS ] =GEN6_NOSYNC ; + ring->semaphore.mbox.signal[BCS ] =GEN6_NOSYNC ; + ring->semaphore.mbox.signal[VECS ] =GEN6_NOSYNC ; + ring->semaphore.mbox.signal[VCS2 ] =GEN6_NOSYNC ; + } }else { ring->irq_enable_mask =PM_VEBOX_USER_INTERRUPT ; ring->irq_get = hsw_vebox_get_irq; ring->irq_put = hsw_vebox_put_irq; ring->dispatch_execbuffer = gen6_ring_dispatch_execbuffer; +if (i915_semaphore_is_enabled (dev)) { + ring->semaphore.sync_to = gen6_ring_sync; + ring->semaphore.signal = gen6_signal; + ring->semaphore.mbox.wait[RCS ] =MI_SEMAPHORE_SYNC_VER ; + ring->semaphore.mbox.wait[VCS ] =MI_SEMAPHORE_SYNC_VEV ; + ring->semaphore.mbox.wait[BCS ] =MI_SEMAPHORE_SYNC_VEB ; + ring->semaphore.mbox.wait[VECS ] =MI_SEMAPHORE_SYNC_INVALID ; + ring->semaphore.mbox.wait[VCS2 ] =MI_SEMAPHORE_SYNC_INVALID ; + ring->semaphore.mbox.signal[RCS ] =GEN6_RVESYNC ; + ring->semaphore.mbox.signal[VCS ] =GEN6_VVESYNC ; + ring->semaphore.mbox.signal[BCS ] =GEN6_BVESYNC ; + ring->semaphore.mbox.signal[VECS ] =GEN6_NOSYNC ; + ring->semaphore.mbox.signal[VCS2 ] =GEN6_NOSYNC ; + } } - ring->semaphore.sync_to = gen6_ring_sync; - ring->semaphore.signal = gen6_signal; - ring->semaphore.mbox.wait[RCS ] =MI_SEMAPHORE_SYNC_VER ; - ring->semaphore.mbox.wait[VCS ] =MI_SEMAPHORE_SYNC_VEV ; - ring->semaphore.mbox.wait[BCS ] =MI_SEMAPHORE_SYNC_VEB ; - ring->semaphore.mbox.wait[VECS ] =MI_SEMAPHORE_SYNC_INVALID ; - ring->semaphore.mbox.wait[VCS2 ] =MI_SEMAPHORE_SYNC_INVALID ; - ring->semaphore.mbox.signal[RCS ] =GEN6_RVESYNC ; - ring->semaphore.mbox.signal[VCS ] =GEN6_VVESYNC ; - ring->semaphore.mbox.signal[BCS ] =GEN6_BVESYNC ; - ring->semaphore.mbox.signal[VECS ] =GEN6_NOSYNC ; - ring->semaphore.mbox.signal[VCS2 ] =GEN6_NOSYNC ; ring->init = init_ring_common;return intel_init_ring_buffer (dev, ring);
Signature · 1 line
1.9.3
Rodrigo Vivi
maintainerPATCH 3/10 drm/i915/bdw: implement semaphore signal
In reply to Rodrigo ViviFrom: Ben Widawsky <[email protected]>
Semaphore signalling works similarly to previous GENs with the exception that the per ring mailboxes no longer exist. Instead you must define your own space, somewhere in the GTT.
The comments in the code define the layout I've opted for, which should be fairly future proof. Ie. I tried to define offsets in abstract terms (NUM_RINGS, seqno size, etc).
NOTE: If one wanted to move this to the HWSP they could. I've decided one 4k object would be easier to deal with, and provide potential wins with cache locality, but that's all speculative.
v2: Update the macro to not need the other ring's ring->id (Chris) Update the comment to use the correct formula (Chris)
v3: Move the macros the ringbuffer.h to prevent churn in next patch (Ville)
v4: Fixed compilation rebase conflict
commit 1ec9e26ddab06459e89a890431b2de064c5d1056
Author: Daniel Vetter <[email protected]> Date: Fri Feb 14 14:01:11 2014 +0100
drm/i915: Consolidate binding parameters into flags
v5: VCS2 rebase
Replace hweight_long with hweight32
v6 (Rodrigo): * Add missed VC2 gen8 ring signal init
* fixing conflicst on rebase
* minor fixes on address table
* remove WARN_ON
--- drivers/gpu/drm/i915/i915_drv.h | 1 + drivers/gpu/drm/i915/i915_reg.h | 5 +- drivers/gpu/drm/i915/intel_ringbuffer.c | 185 +++++++++++++++++++------------- drivers/gpu/drm/i915/intel_ringbuffer.h | 78 ++++++++++++-- 4 files changed, 189 insertions(+), 80 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +1 -0
@@ -1374,6 +1374,7 @@ struct drm_i915_private {struct pci_dev *bridge_dev;struct intel_engine_cs ring[I915_NUM_RINGS ]; +struct drm_i915_gem_object *semaphore_obj;uint32_t last_seqno, next_seqno;drm_dma_handle_t *status_page_dmah;
drivers/gpu/drm/i915/i915_reg.h +4 -1
@@ -240,7 +240,7 @@#define MI_DISPLAY_FLIP_IVB_SPRITE_B (3 << 19)#define MI_DISPLAY_FLIP_IVB_PLANE_C (4 << 19)#define MI_DISPLAY_FLIP_IVB_SPRITE_C (5 << 19) -#define MI_SEMAPHORE_MBOX MI_INSTR(0x16, 1)/* gen6+ */ +#define MI_SEMAPHORE_MBOX MI_INSTR(0x16, 1)/* gen6, gen7 */ #define MI_SEMAPHORE_GLOBAL_GTT (1<<22)#define MI_SEMAPHORE_UPDATE (1<<21)#define MI_SEMAPHORE_COMPARE (1<<20)
@@ -266,6 +266,8 @@#define MI_RESTORE_EXT_STATE_EN (1<<2)#define MI_FORCE_RESTORE (1<<1)#define MI_RESTORE_INHIBIT (1<<0) +#define MI_SEMAPHORE_SIGNAL MI_INSTR(0x1b, 0)/* GEN8+ */ +#define MI_SEMAPHORE_TARGET (engine) ((engine)<<15)#define MI_STORE_DWORD_IMM MI_INSTR(0x20, 1)#define MI_MEM_VIRTUAL (1 << 22)/* 965+ only */ #define MI_STORE_DWORD_INDEX MI_INSTR(0x21, 1)
@@ -360,6 +362,7 @@#define PIPE_CONTROL_TEXTURE_CACHE_INVALIDATE (1<<10)/* GM45+ only */ #define PIPE_CONTROL_INDIRECT_STATE_DISABLE (1<<9)#define PIPE_CONTROL_NOTIFY (1<<8) +#define PIPE_CONTROL_FLUSH_ENABLE (1<<7)/* gen7+ */ #define PIPE_CONTROL_VF_CACHE_INVALIDATE (1<<4)#define PIPE_CONTROL_CONST_CACHE_INVALIDATE (1<<3)#define PIPE_CONTROL_STATE_CACHE_INVALIDATE (1<<2)
drivers/gpu/drm/i915/intel_ringbuffer.c +112 -73
246 lines not on this page · raw message
drivers/gpu/drm/i915/intel_ringbuffer.h +72 -6
93 lines not on this page · raw message
Signature · 1 line
1.9.3
Rodrigo Vivi
maintainerPATCH 4/10 drm/i915/bdw: implement semaphore wait
In reply to Rodrigo ViviFrom: Ben Widawsky <[email protected]>
Semaphore waits use a new instruction, MI_SEMAPHORE_WAIT. The seqno to wait on is all well defined by the table in the previous patch. There is nothing else different from previous GEN's semaphore synchronization code.
v2: Update macros to not require the other ring's ring->id (Chris)
v3: Add missing VCS2 gen8_ring_wait init besides
s/ring_buffer/engine_cs (Rodrigo)
--- drivers/gpu/drm/i915/i915_reg.h | 3 +++ drivers/gpu/drm/i915/intel_ringbuffer.c | 35 ++++++++++++++++++++++++++++----- 2 files changed, 33 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +3 -0
@@ -268,6 +268,9 @@#define MI_RESTORE_INHIBIT (1<<0)#define MI_SEMAPHORE_SIGNAL MI_INSTR(0x1b, 0)/* GEN8+ */ #define MI_SEMAPHORE_TARGET (engine) ((engine)<<15) +#define MI_SEMAPHORE_WAIT MI_INSTR(0x1c, 2)/* GEN8+ */ +#define MI_SEMAPHORE_POLL (1<<15) +#define MI_SEMAPHORE_SAD_GTE_SDD (1<<12)#define MI_STORE_DWORD_IMM MI_INSTR(0x20, 1)#define MI_MEM_VIRTUAL (1 << 22)/* 965+ only */ #define MI_STORE_DWORD_INDEX MI_INSTR(0x21, 1)
drivers/gpu/drm/i915/intel_ringbuffer.c +30 -5
@@ -832,6 +832,31 @@ static inline bool i915_gem_has_seqno_wrapped(struct drm_device *dev,* @signaller - ring which has, or will signal * @seqno - seqno which the waiter will block on */ + +static int +gen8_ring_sync (struct intel_engine_cs *waiter, +struct intel_engine_cs *signaller, +u32 seqno) +{ +struct drm_i915_private *dev_priv = waiter->dev->dev_private; +int ret; + + ret =intel_ring_begin (waiter,4 ); +if (ret) +return ret; + +intel_ring_emit (waiter,MI_SEMAPHORE_WAIT | +MI_SEMAPHORE_GLOBAL_GTT | +MI_SEMAPHORE_SAD_GTE_SDD ); +intel_ring_emit (waiter, seqno); +intel_ring_emit (waiter, +lower_32_bits (GEN8_WAIT_OFFSET (waiter, signaller->id))); +intel_ring_emit (waiter, +upper_32_bits (GEN8_WAIT_OFFSET (waiter, signaller->id))); +intel_ring_advance (waiter); +return 0 ; +} + static int gen6_ring_sync(struct intel_engine_cs *waiter, struct intel_engine_cs *signaller,
@@ -2056,7 +2081,7 @@ int intel_init_render_ring_buffer(struct drm_device *dev) ring->set_seqno = ring_set_seqno;if (i915_semaphore_is_enabled (dev)) {BUG_ON (!dev_priv->semaphore_obj); - ring->semaphore.sync_to = gen6_ring_sync; + ring->semaphore.sync_to = gen8_ring_sync; ring->semaphore.signal = gen8_rcs_signal;GEN8_RING_SEMAPHORE_INIT ; }
@@ -2267,7 +2292,7 @@ int intel_init_bsd_ring_buffer(struct drm_device *dev) ring->dispatch_execbuffer = gen8_ring_dispatch_execbuffer;if (i915_semaphore_is_enabled (dev)) { - ring->semaphore.sync_to = gen6_ring_sync; + ring->semaphore.sync_to = gen8_ring_sync; ring->semaphore.signal = gen8_xcs_signal;GEN8_RING_SEMAPHORE_INIT ; }
@@ -2343,8 +2368,8 @@ int intel_init_bsd2_ring_buffer(struct drm_device *dev) ring->irq_put = gen8_ring_put_irq; ring->dispatch_execbuffer = gen8_ring_dispatch_execbuffer; - ring->semaphore.sync_to = gen6_ring_sync;if (i915_semaphore_is_enabled (dev)) { + ring->semaphore.sync_to = gen8_ring_sync; ring->semaphore.signal = gen8_xcs_signal;GEN8_RING_SEMAPHORE_INIT ; }
@@ -2374,7 +2399,7 @@ int intel_init_blt_ring_buffer(struct drm_device *dev) ring->irq_put = gen8_ring_put_irq; ring->dispatch_execbuffer = gen8_ring_dispatch_execbuffer;if (i915_semaphore_is_enabled (dev)) { - ring->semaphore.sync_to = gen6_ring_sync; + ring->semaphore.sync_to = gen8_ring_sync; ring->semaphore.signal = gen8_xcs_signal;GEN8_RING_SEMAPHORE_INIT ; }
@@ -2432,7 +2457,7 @@ int intel_init_vebox_ring_buffer(struct drm_device *dev) ring->irq_put = gen8_ring_put_irq; ring->dispatch_execbuffer = gen8_ring_dispatch_execbuffer;if (i915_semaphore_is_enabled (dev)) { - ring->semaphore.sync_to = gen6_ring_sync; + ring->semaphore.sync_to = gen8_ring_sync; ring->semaphore.signal = gen8_xcs_signal;GEN8_RING_SEMAPHORE_INIT ; }
Signature · 1 line
1.9.3
Rodrigo Vivi
maintainerPATCH 5/10 drm/i915: Implement MI decode for gen8
In reply to Rodrigo ViviIpehr just carries Dword 0 and on Gen 8, offsets are located on Dword 2 and 3 of MI_SEMAPHORE_WAIT.
This implementation was based on Ben's work and on Ville's suggestion for Ben
--- drivers/gpu/drm/i915/i915_irq.c | 42 ++++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 19 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +23 -19
@@ -2784,12 +2784,7 @@ static bool ipehr_is_semaphore_wait(struct drm_device *dev, u32 ipehr) { if (INTEL_INFO(dev)->gen >= 8) { - /* - * FIXME: gen8 semaphore support - currently we don't emit - * semaphores on bdw anyway, but this needs to be addressed when - * we merge that code. - */ - return false; + return (ipehr >> 23) == 0x1c; } else { ipehr &= ~MI_SEMAPHORE_SYNC_MASK ; return ipehr == (MI_SEMAPHORE_MBOX | MI_SEMAPHORE_COMPARE |
@@ -2798,19 +2793,20 @@ ipehr_is_semaphore_wait(struct drm_device *dev, u32 ipehr) }static struct intel_engine_cs * -semaphore_wait_to_signaller_ring (struct intel_engine_cs *ring,u32 ipehr) +semaphore_wait_to_signaller_ring (struct intel_engine_cs *ring,u32 ipehr,u64 offset) {struct drm_i915_private *dev_priv = ring->dev->dev_private;struct intel_engine_cs *signaller;int i;if (INTEL_INFO (dev_priv->dev)->gen >=8 ) { -/* -* FIXME: gen8 semaphore support - currently we don't emit -* semaphores on bdw anyway, but this needs to be addressed when -* we merge that code. -*/ -return NULL ; +for_each_ring (signaller, dev_priv, i) { +if (ring == signaller) +continue ; + +if (offset == signaller->semaphore.signal_ggtt[ring->id]) +return signaller; + } }else {u32 sync_bits = ipehr &MI_SEMAPHORE_SYNC_MASK ;
@@ -2823,8 +2819,8 @@ semaphore_wait_to_signaller_ring(struct intel_engine_cs *ring, u32 ipehr) } } -DRM_ERROR ("No signaller ring found for ring %i, ipehr 0x%08x\n" , - ring->id, ipehr); +DRM_ERROR ("No signaller ring found for ring %i, ipehr 0x%08x, offset 0x%0%016llx\n" , + ring->id, ipehr, offset);return NULL ; }
@@ -2834,7 +2830,8 @@ semaphore_waits_for(struct intel_engine_cs *ring, u32 *seqno) {struct drm_i915_private *dev_priv = ring->dev->dev_private;u32 cmd, ipehr, head; -int i; +u64 offset =0 ; +int i, backwards; ipehr =I915_READ (RING_IPEHR (ring->mmio_base));if (!ipehr_is_semaphore_wait (ring->dev, ipehr))
@@ -2843,13 +2840,15 @@ semaphore_waits_for(struct intel_engine_cs *ring, u32 *seqno)/* * HEAD is likely pointing to the dword after the actual command, * so scan backwards until we find the MBOX. But limit it to just 3 -* dwords. Note that we don't care about ACTHD here since that might +* or 4 dwords depending on the semaphore wait command size. +* Note that we don't care about ACTHD here since that might * point at at batch, and semaphores are always emitted into the * ringbuffer itself. */ head =I915_READ_HEAD (ring) &HEAD_ADDR ; + backwards = (INTEL_INFO (ring->dev)->gen >=8 ) ?5 :4 ; -for (i =4 ; i; --i) { +for (i = backwards; i; --i) {/* * Be paranoid and presume the hw has gone off into the wild - * our ring is smaller than what the hardware (and hence
@@ -2869,7 +2868,12 @@ semaphore_waits_for(struct intel_engine_cs *ring, u32 *seqno)return NULL ; *seqno =ioread32 (ring->buffer->virtual_start + head +4 ) +1 ; -return semaphore_wait_to_signaller_ring (ring, ipehr); +if (INTEL_INFO (ring->dev)->gen >=8 ) { + offset =ioread32 (ring->buffer->virtual_start + head +12 ); + offset <<=32 ; + offset =ioread32 (ring->buffer->virtual_start + head +8 ); + } +return semaphore_wait_to_signaller_ring (ring, ipehr, offset); }static int semaphore_passed (struct intel_engine_cs *ring)
Signature · 6 lines
1.9.3 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 05/10] drm/i915: Implement MI decode for gen8
Quoted 8 lines · Rodrigo Vivi
Ipehr just carries Dword 0 and on Gen 8, offsets are located on Dword 2 and 3 of
MI_SEMAPHORE_WAIT.This implementation was based on Ben's work and on Ville's suggestion for Ben
Cc Ville Syrjälä <[email protected]>Cc Ben Widawsky <[email protected]>Signed-off-by Rodrigo Vivi <[email protected]>
Signature · 5 lines
Ben Widawsky, Intel Open Source Technology Center _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 05/10] drm/i915: Implement MI decode for gen8
In reply to Rodrigo ViviQuoted 59 lines · Rodrigo Vivi
Ipehr just carries Dword 0 and on Gen 8, offsets are located on Dword 2 and 3 of
MI_SEMAPHORE_WAIT.This implementation was based on Ben's work and on Ville's suggestion for Ben
Cc Ville Syrjälä <[email protected]>Cc Ben Widawsky <[email protected]>Signed-off-by Rodrigo Vivi <[email protected]>--- drivers/gpu/drm/i915/i915_irq.c | 42 ++++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 19 deletions(-)drivers/gpu/drm/i915/i915_irq.c +9
-13@@ -2784,12 +2784,7 @@ static bool ipehr_is_semaphore_wait(struct drm_device *dev, u32 ipehr) { if (INTEL_INFO(dev)->gen >= 8) { - /* - * FIXME: gen8 semaphore support - currently we don't emit - * semaphores on bdw anyway, but this needs to be addressed when - * we merge that code. - */ - return false; + return (ipehr >> 23) == 0x1c; } else { ipehr &= ~MI_SEMAPHORE_SYNC_MASK ; return ipehr == (MI_SEMAPHORE_MBOX | MI_SEMAPHORE_COMPARE |@@ -2798,19 +2793,20 @@ ipehr_is_semaphore_wait(struct drm_device *dev, u32 ipehr) }static struct intel_engine_cs * -semaphore_wait_to_signaller_ring (struct intel_engine_cs *ring,u32 ipehr) +semaphore_wait_to_signaller_ring (struct intel_engine_cs *ring,u32 ipehr,u64 offset) {struct drm_i915_private *dev_priv = ring->dev->dev_private;struct intel_engine_cs *signaller;int i;if (INTEL_INFO (dev_priv->dev)->gen >=8 ) { -/* -* FIXME: gen8 semaphore support - currently we don't emit -* semaphores on bdw anyway, but this needs to be addressed when -* we merge that code. -*/ -return NULL ; +for_each_ring (signaller, dev_priv, i) { +if (ring == signaller) +continue ; + +if (offset == signaller->semaphore.signal_ggtt[ring->id]) +return signaller; + } }else {u32 sync_bits = ipehr &MI_SEMAPHORE_SYNC_MASK ;
drivers/gpu/drm/i915/i915_irq.c semaphore_wait_to_signaller_ring(struct intel_engine_cs *ring, u32 ipehr) · line 2822
Quoted 6 lines
drivers/gpu/drm/i915/i915_irq.c +1
-2@@ -2823,8 +2819,8 @@ semaphore_wait_to_signaller_ring(struct intel_engine_cs *ring, u32 ipehr) } } -DRM_ERROR ("No signaller ring found for ring %i, ipehr 0x%08x\n" , - ring->id, ipehr); + DRM_ERROR("No signaller ring found for ring %i, ipehr 0x%08x, offset 0x%0%016llx\n",
The format string has a spurious 0% here. I've dropped it. -Daniel
Quoted 53 lines
drivers/gpu/drm/i915/i915_irq.c +13
-4+ ring->id, ipehr, offset);return NULL ; }@@ -2834,7 +2830,8 @@ semaphore_waits_for(struct intel_engine_cs *ring, u32 *seqno) {struct drm_i915_private *dev_priv = ring->dev->dev_private;u32 cmd, ipehr, head; -int i; +u64 offset =0 ; +int i, backwards; ipehr =I915_READ (RING_IPEHR (ring->mmio_base));if (!ipehr_is_semaphore_wait (ring->dev, ipehr))@@ -2843,13 +2840,15 @@ semaphore_waits_for(struct intel_engine_cs *ring, u32 *seqno)/* * HEAD is likely pointing to the dword after the actual command, * so scan backwards until we find the MBOX. But limit it to just 3 -* dwords. Note that we don't care about ACTHD here since that might +* or 4 dwords depending on the semaphore wait command size. +* Note that we don't care about ACTHD here since that might * point at at batch, and semaphores are always emitted into the * ringbuffer itself. */ head =I915_READ_HEAD (ring) &HEAD_ADDR ; + backwards = (INTEL_INFO (ring->dev)->gen >=8 ) ?5 :4 ; -for (i =4 ; i; --i) { +for (i = backwards; i; --i) {/* * Be paranoid and presume the hw has gone off into the wild - * our ring is smaller than what the hardware (and hence @@ -2869,7 +2868,12 @@ semaphore_waits_for(struct intel_engine_cs *ring, u32 *seqno)return NULL ; *seqno =ioread32 (ring->buffer->virtual_start + head +4 ) +1 ; -return semaphore_wait_to_signaller_ring (ring, ipehr); +if (INTEL_INFO (ring->dev)->gen >=8 ) { + offset =ioread32 (ring->buffer->virtual_start + head +12 ); + offset <<=32 ; + offset =ioread32 (ring->buffer->virtual_start + head +8 ); + } +return semaphore_wait_to_signaller_ring (ring, ipehr, offset); }static int semaphore_passed (struct intel_engine_cs *ring)Signature · 6 lines
1.9.3 _______________________________________________ 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
Rodrigo Vivi
maintainerPATCH 1/1 drm/i915: Implement MI decode for gen8
Ipehr just carries Dword 0 and on Gen 8, offsets are located on Dword 2 and 3 of MI_SEMAPHORE_WAIT.
This implementation was based on Ben's work and on Ville's suggestion for Ben
v2: fix typo. Removing spurious 0% from debug msg "0x%0%0". (Daniel)
--- drivers/gpu/drm/i915/i915_irq.c | 42 ++++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 19 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +23 -19
@@ -2784,12 +2784,7 @@ static bool ipehr_is_semaphore_wait(struct drm_device *dev, u32 ipehr) { if (INTEL_INFO(dev)->gen >= 8) { - /* - * FIXME: gen8 semaphore support - currently we don't emit - * semaphores on bdw anyway, but this needs to be addressed when - * we merge that code. - */ - return false; + return (ipehr >> 23) == 0x1c; } else { ipehr &= ~MI_SEMAPHORE_SYNC_MASK ; return ipehr == (MI_SEMAPHORE_MBOX | MI_SEMAPHORE_COMPARE |
@@ -2798,19 +2793,20 @@ ipehr_is_semaphore_wait(struct drm_device *dev, u32 ipehr) }static struct intel_engine_cs * -semaphore_wait_to_signaller_ring (struct intel_engine_cs *ring,u32 ipehr) +semaphore_wait_to_signaller_ring (struct intel_engine_cs *ring,u32 ipehr,u64 offset) {struct drm_i915_private *dev_priv = ring->dev->dev_private;struct intel_engine_cs *signaller;int i;if (INTEL_INFO (dev_priv->dev)->gen >=8 ) { -/* -* FIXME: gen8 semaphore support - currently we don't emit -* semaphores on bdw anyway, but this needs to be addressed when -* we merge that code. -*/ -return NULL ; +for_each_ring (signaller, dev_priv, i) { +if (ring == signaller) +continue ; + +if (offset == signaller->semaphore.signal_ggtt[ring->id]) +return signaller; + } }else {u32 sync_bits = ipehr &MI_SEMAPHORE_SYNC_MASK ;
@@ -2823,8 +2819,8 @@ semaphore_wait_to_signaller_ring(struct intel_engine_cs *ring, u32 ipehr) } } -DRM_ERROR ("No signaller ring found for ring %i, ipehr 0x%08x\n" , - ring->id, ipehr); +DRM_ERROR ("No signaller ring found for ring %i, ipehr 0x%08x, offset 0x%016llx\n" , + ring->id, ipehr, offset);return NULL ; }
@@ -2834,7 +2830,8 @@ semaphore_waits_for(struct intel_engine_cs *ring, u32 *seqno) {struct drm_i915_private *dev_priv = ring->dev->dev_private;u32 cmd, ipehr, head; -int i; +u64 offset =0 ; +int i, backwards; ipehr =I915_READ (RING_IPEHR (ring->mmio_base));if (!ipehr_is_semaphore_wait (ring->dev, ipehr))
@@ -2843,13 +2840,15 @@ semaphore_waits_for(struct intel_engine_cs *ring, u32 *seqno)/* * HEAD is likely pointing to the dword after the actual command, * so scan backwards until we find the MBOX. But limit it to just 3 -* dwords. Note that we don't care about ACTHD here since that might +* or 4 dwords depending on the semaphore wait command size. +* Note that we don't care about ACTHD here since that might * point at at batch, and semaphores are always emitted into the * ringbuffer itself. */ head =I915_READ_HEAD (ring) &HEAD_ADDR ; + backwards = (INTEL_INFO (ring->dev)->gen >=8 ) ?5 :4 ; -for (i =4 ; i; --i) { +for (i = backwards; i; --i) {/* * Be paranoid and presume the hw has gone off into the wild - * our ring is smaller than what the hardware (and hence
@@ -2869,7 +2868,12 @@ semaphore_waits_for(struct intel_engine_cs *ring, u32 *seqno)return NULL ; *seqno =ioread32 (ring->buffer->virtual_start + head +4 ) +1 ; -return semaphore_wait_to_signaller_ring (ring, ipehr); +if (INTEL_INFO (ring->dev)->gen >=8 ) { + offset =ioread32 (ring->buffer->virtual_start + head +12 ); + offset <<=32 ; + offset =ioread32 (ring->buffer->virtual_start + head +8 ); + } +return semaphore_wait_to_signaller_ring (ring, ipehr, offset); }static int semaphore_passed (struct intel_engine_cs *ring)
Signature · 6 lines
1.9.3 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Rodrigo Vivi
maintainerPATCH 6/10 drm/i915: Extract semaphore error collection
In reply to Rodrigo ViviFrom: Ben Widawsky <[email protected]>
v2: s/ring_buffer/engine_cs (Rodrigo)
--- drivers/gpu/drm/i915/i915_gpu_error.c | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-)
drivers/gpu/drm/i915/i915_gpu_error.c +18 -12
@@ -746,6 +746,23 @@ static void i915_gem_record_fences(struct drm_device *dev, } } + +static void gen6_record_semaphore_state (struct drm_i915_private *dev_priv, +struct intel_engine_cs *ring, +struct drm_i915_error_ring *ering) +{ + ering->semaphore_mboxes[0 ] =I915_READ (RING_SYNC_0 (ring->mmio_base)); + ering->semaphore_mboxes[1 ] =I915_READ (RING_SYNC_1 (ring->mmio_base)); + ering->semaphore_seqno[0 ] = ring->semaphore.sync_seqno[0 ]; + ering->semaphore_seqno[1 ] = ring->semaphore.sync_seqno[1 ]; + +if (HAS_VEBOX (dev_priv->dev)) { + ering->semaphore_mboxes[2 ] = +I915_READ (RING_SYNC_2 (ring->mmio_base)); + ering->semaphore_seqno[2 ] = ring->semaphore.sync_seqno[2 ]; + } +} +static void i915_record_ring_state (struct drm_device *dev,struct intel_engine_cs *ring,struct drm_i915_error_ring *ering)
@@ -755,18 +772,7 @@ static void i915_record_ring_state(struct drm_device *dev,if (INTEL_INFO (dev)->gen >=6 ) { ering->rc_psmi =I915_READ (ring->mmio_base +0x50 ); ering->fault_reg =I915_READ (RING_FAULT_REG (ring)); - ering->semaphore_mboxes[0 ] - =I915_READ (RING_SYNC_0 (ring->mmio_base)); - ering->semaphore_mboxes[1 ] - =I915_READ (RING_SYNC_1 (ring->mmio_base)); - ering->semaphore_seqno[0 ] = ring->semaphore.sync_seqno[0 ]; - ering->semaphore_seqno[1 ] = ring->semaphore.sync_seqno[1 ]; - } - -if (HAS_VEBOX (dev)) { - ering->semaphore_mboxes[2 ] = -I915_READ (RING_SYNC_2 (ring->mmio_base)); - ering->semaphore_seqno[2 ] = ring->semaphore.sync_seqno[2 ]; +gen6_record_semaphore_state (dev_priv, ring, ering); }if (INTEL_INFO (dev)->gen >=4 ) {
Signature · 1 line
1.9.3
Rodrigo Vivi
maintainerPATCH 7/10 drm/i915/bdw: collect semaphore error state
In reply to Rodrigo ViviFrom: Ben Widawsky <[email protected]>
Since the semaphore information is in an object, just dump it, and let the user parse it later.
NOTE: The page being used for the semaphores are incoherent with the CPU. No matter what I do, I cannot figure out a way to read anything but 0s. Note that the semaphore waits are indeed working.
v2: Don't print signal, and wait (they should be the same). Instead, print sync_seqno (Chris)
v3: Free the semaphore error object (Chris)
v4: Fix semaphore offset calculation during error state collection (Ville)
v5: VCS2 rebase
Make semaphore object error capture coding style consistent (Ville) Do the proper math for the signal offset (Ville)
v6: Fix small conflicts on rebase and s/ring_buffer/engine_cs (Rodrigo)
--- drivers/gpu/drm/i915/i915_drv.h | 1 + drivers/gpu/drm/i915/i915_gpu_error.c | 51 ++++++++++++++++++++++++++++++++--- 2 files changed, 48 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +1 -0
@@ -324,6 +324,7 @@ struct drm_i915_error_state {u64 fence[I915_MAX_NUM_FENCES ];struct intel_overlay_error_state *overlay;struct intel_display_error_state *display; +struct drm_i915_error_object *semaphore_obj;struct drm_i915_error_ring {bool valid;
drivers/gpu/drm/i915/i915_gpu_error.c +47 -4
99 lines not on this page · raw message
Signature · 1 line
1.9.3
Re: [PATCH 07/10] drm/i915/bdw: collect semaphore error state
drivers/gpu/drm/i915/i915_gpu_error.c static void i915_gem_record_fences(struct drm_device *dev, · line 787
Quoted 9 lines · Rodrigo Vivi
drivers/gpu/drm/i915/i915_gpu_error.c +9
-0+for_each_ring (useless, dev_priv, i) { +u16 signal_offset = + (GEN8_SIGNAL_OFFSET (ring, i) &PAGE_MASK ) /4 ; +u32 *tmp = error->semaphore_obj->pages[0 ]; + + ering->semaphore_mboxes[i] = tmp[signal_offset]; + ering->semaphore_seqno[i] = ring->semaphore.sync_seqno[i]; + } +}
This loops around all the rings, but semaphore_mboxes[] and semaphore_seqno[] are of size (I915_NUM_RINGS - 1).
Signature · 1 line
Damien
Re: [PATCH 07/10] drm/i915/bdw: collect semaphore error state
Quoted 16 lines · Damien Lespiau
drivers/gpu/drm/i915/i915_gpu_error.c static void i915_gem_record_fences(struct drm_device *dev, · line 787
Quoted 9 lines · Rodrigo Vivi
drivers/gpu/drm/i915/i915_gpu_error.c +9
-0+for_each_ring (useless, dev_priv, i) { +u16 signal_offset = + (GEN8_SIGNAL_OFFSET (ring, i) &PAGE_MASK ) /4 ; +u32 *tmp = error->semaphore_obj->pages[0 ]; + + ering->semaphore_mboxes[i] = tmp[signal_offset]; + ering->semaphore_seqno[i] = ring->semaphore.sync_seqno[i]; + } +}This loops around all the rings, but semaphore_mboxes[] and semaphore_seqno[] are of size (
I915_NUM_RINGS- 1).Signature · 1 line
Damien
Dan Carpenter has already reported this to us. I was expecting a patch from Rodrigo.
Signature · 1 line
Ben Widawsky, Intel Open Source Technology Center
Rodrigo Vivi
maintainerPATCH 8/10 drm/i915: semaphore debugfs
In reply to Rodrigo ViviFrom: Ben Widawsky <[email protected]>
Simple debugfs file to display the current state of semaphores. This is useful if you want to see the state without hanging the GPU.
NOTE: This patch is optional to the series.
NOTE2: Like the GPU error state collection, the reads are currently incoherent.
v2 (Rodrigo): * Iterate only on active rings.
* s/ring_buffer/engine_cs.
--- drivers/gpu/drm/i915/i915_debugfs.c | 71 +++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+)
drivers/gpu/drm/i915/i915_debugfs.c +71 -0
@@ -2386,6 +2386,76 @@ static int i915_display_info(struct seq_file *m, void *unused)return 0 ; } +static int i915_semaphore_status (struct seq_file *m,void *unused) +{ +struct drm_info_node *node = (struct drm_info_node *) m->private; +struct drm_device *dev = node->minor->dev; +struct drm_i915_private *dev_priv = dev->dev_private; +struct intel_engine_cs *ring; +int num_rings =hweight32 (INTEL_INFO (dev)->ring_mask); +int i, j, ret; + +if (!i915_semaphore_is_enabled (dev)) { +seq_puts (m,"Semaphores are disabled\n" ); +return 0 ; + } + + ret =mutex_lock_interruptible (&dev->struct_mutex); +if (ret) +return ret; + +if (IS_BROADWELL (dev)) { +struct page *page; +uint64_t *seqno; + + page =i915_gem_object_get_page (dev_priv->semaphore_obj,0 ); + + seqno = (uint64_t *)kmap_atomic (page); +for_each_ring (ring, dev_priv, i) { +uint64_t offset; + +seq_printf (m,"%s\n" , ring->name); + +seq_puts (m," Last signal:" ); +for (j =0 ; j < num_rings; j++) { + offset = i *I915_NUM_RINGS + j; +seq_printf (m,"0x%08llx (0x%02llx) " , + seqno[offset], offset *8 ); + } +seq_putc (m,'\n' ); + +seq_puts (m," Last wait: " ); +for (j =0 ; j < num_rings; j++) { + offset = i + (j *I915_NUM_RINGS ); +seq_printf (m,"0x%08llx (0x%02llx) " , + seqno[offset], offset *8 ); + } +seq_putc (m,'\n' ); + + } +kunmap_atomic (seqno); + }else { +seq_puts (m," Last signal:" ); +for_each_ring (ring, dev_priv, i) +for (j =0 ; j < num_rings; j++) +seq_printf (m,"0x%08x\n" , +I915_READ (ring->semaphore.mbox.signal[j])); +seq_putc (m,'\n' ); + } + +seq_puts (m,"\nSync seqno:\n" ); +for_each_ring (ring, dev_priv, i) { +for (j =0 ; j < num_rings; j++) { +seq_printf (m," 0x%08x " , ring->semaphore.sync_seqno[j]); + } +seq_putc (m,'\n' ); + } +seq_putc (m,'\n' ); + +mutex_unlock (&dev->struct_mutex); +return 0 ; +} +struct pipe_crc_info {const char *name;struct drm_device *dev;
@@ -3837,6 +3907,7 @@ static const struct drm_info_list i915_debugfs_list[] = { {"i915_pc8_status", i915_pc8_status, 0}, {"i915_power_domain_info", i915_power_domain_info, 0}, {"i915_display_info", i915_display_info, 0}, + {"i915_semaphore_status", i915_semaphore_status, 0}, };#define I915_DEBUGFS_ENTRIES ARRAY_SIZE(i915_debugfs_list)
Signature · 1 line
1.9.3
Rodrigo Vivi
maintainerPATCH 9/10 drm/i915/bdw: poll semaphores
In reply to Rodrigo ViviFrom: Ben Widawsky <[email protected]>
As Ville points out, it's possible/probable we don't actually need this. Potentially, this validates the letter of the spec, and not the spirit.
Ville:
Quoted 6 lines
I discussed this on irc w/ Ben, and I was suggesting we don't need to poll. Polling apparently can be used as a workaround for certain hardware issues, but it looks like those issues shouldn't affect us, for the momemnt at least. So my suggestion was to try w/o polling first (since there could be some power cost to polling) and add the poll bit if problems arise.
Rodrigo: Spec suggests this as an W/A for GT3. However semaphores didn't worked in my BDW GT2 on Signal Mode. So pool mode is definitely needed.
--- drivers/gpu/drm/i915/intel_ringbuffer.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/i915/intel_ringbuffer.c +1 -0
@@ -847,6 +847,7 @@ gen8_ring_sync(struct intel_engine_cs *waiter,intel_ring_emit (waiter,MI_SEMAPHORE_WAIT |MI_SEMAPHORE_GLOBAL_GTT | +MI_SEMAPHORE_POLL |MI_SEMAPHORE_SAD_GTE_SDD );intel_ring_emit (waiter, seqno); intel_ring_emit(waiter,
Signature · 1 line
1.9.3
Rodrigo Vivi
maintainerPATCH 10/10 drm/i915: Enable semaphores on BDW
In reply to Rodrigo Vivi--- drivers/gpu/drm/i915/i915_drv.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/gpu/drm/i915/i915_drv.c +0 -4
@@ -477,10 +477,6 @@ bool i915_semaphore_is_enabled(struct drm_device *dev)if (i915.semaphores >=0 )return i915.semaphores; -/* Until we get further testing... */ -if (IS_GEN8 (dev)) -return false; -#ifdef CONFIG_INTEL_IOMMU /* Enable semaphores on SNB when IO remapping is off */ if (INTEL_INFO (dev)->gen ==6 && intel_iommu_gfx_mapped)
Signature · 1 line
1.9.3
Re: [PATCH 10/10] drm/i915: Enable semaphores on BDW
Quoted 1 line · Rodrigo Vivi
Signed-off-by Rodrigo Vivi <[email protected]>
Signature · 1 line
Ben Widawsky, Intel Open Source Technology Center
Re: [PATCH 10/10] drm/i915: Enable semaphores on BDW
Quoted 4 lines · Ben Widawsky
Quoted 1 line · Rodrigo Vivi
Signed-off-by Rodrigo Vivi <[email protected]>Reviewed-by Ben Widawsky <[email protected]>
Pulled in entire series. Yay!
-Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch