Skip to contentSkip to conversation

drm/i915: clarify semaphore-ring interaction

PATCH Superseded Ben Widawsky 2 participants 5 messages May 20, 2012 – May 21, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 drm/i915: clarify semaphore-ring interaction

After Daniel split out this code, I think this makes more sense, and looks nicer. Also added some comments to help the situation.

v2: Make signal_mbox be all rings for symmetric-ness.
v3: submitted the wrong version of the patch before.
v2 had an issue with odd number of rings. The fix is to always emit an even number of instructions to the ring with mbox updates.

Reviewed-by (v1): Chris Wilson <[email protected]>

---
 drivers/gpu/drm/i915/i915_reg.h         |   13 ++++----
 drivers/gpu/drm/i915/intel_ringbuffer.c |   54 +++++++++++++++++--------------
 drivers/gpu/drm/i915/intel_ringbuffer.h |    4 +--
 3 files changed, 39 insertions(+), 32 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +7 -6
index fb76b19..d3040d5 100644
@@ -241,12 +241,12 @@
 #define  MI_SEMAPHORE_UPDATE	    (1<<21)
 #define  MI_SEMAPHORE_COMPARE	    (1<<20)
 #define  MI_SEMAPHORE_REGISTER	    (1<<18)
-#define  MI_SEMAPHORE_SYNC_RV	    (2<<16)
-#define  MI_SEMAPHORE_SYNC_RB	    (0<<16)
-#define  MI_SEMAPHORE_SYNC_VR	    (0<<16)
-#define  MI_SEMAPHORE_SYNC_VB	    (2<<16)
-#define  MI_SEMAPHORE_SYNC_BR	    (2<<16)
-#define  MI_SEMAPHORE_SYNC_BV	    (0<<16)
+#define  MI_SEMAPHORE_SYNC_RB	    (0<<16) /* RCS wait for BCS  (BRSYNC) */
+#define  MI_SEMAPHORE_SYNC_RV	    (2<<16) /* RCS wait for VCS  (VRSYNC) */
+#define  MI_SEMAPHORE_SYNC_VR	    (0<<16) /* VCS wait for RCS  (RVSYNC) */
+#define  MI_SEMAPHORE_SYNC_VB	    (2<<16) /* VCS wait for BCS  (BVSYNC) */
+#define  MI_SEMAPHORE_SYNC_BV	    (0<<16) /* BCS wait for VCS  (VBSYNC) */
+#define  MI_SEMAPHORE_SYNC_BR	    (2<<16) /* BCS wait for RCS  (RBSYNC) */
 #define  MI_SEMAPHORE_SYNC_INVALID  (1<<0)
 /*
  * 3D instructions used by the kernel
@@ -423,6 +423,7 @@
 #define GEN6_VBSYNC (RING_SYNC_0(GEN6_BSD_RING_BASE))
 #define GEN6_BRSYNC (RING_SYNC_0(BLT_RING_BASE))
 #define GEN6_BVSYNC (RING_SYNC_1(BLT_RING_BASE))
+#define GEN6_NOSYNC 0
 #define RING_MAX_IDLE(base)	((base)+0x54)
 #define RING_HWS_PGA(base)	((base)+0x80)
 #define RING_HWS_PGA_GEN6(base)	((base)+0x2080)
drivers/gpu/drm/i915/intel_ringbuffer.c +30 -24

90 lines not on this page · raw message

drivers/gpu/drm/i915/intel_ringbuffer.h +2 -2
index 55d3da2..3db4447 100644
@@ -80,8 +80,8 @@ struct  intel_ring_buffer {
 				   struct intel_ring_buffer *to,
 				   u32 seqno);
 
-	u32		semaphore_register[3]; /*our mbox written by others */
-	u32		signal_mbox[2]; /* mboxes this ring signals to */
+	u32		semaphore_register[I915_NUM_RINGS]; /*our mbox written by others */
+	u32		signal_mbox[I915_NUM_RINGS]; /* mboxes this ring signals to */
 	/**
 	 * List of objects currently involved in rendering from the
 	 * ringbuffer.
Signature · 1 line
1.7.10.2
#1 lore raw

PATCH v4 1/1 drm/i915: clarify semaphore-ring interaction

After Daniel split out this code, I think this makes more sense, and looks nicer. Also added some comments to help the situation.

v2: Make signal_mbox be all rings for symmetric-ness.
v3: submitted the wrong version of the patch before.
v2 had an issue with odd number of rings. The fix is to always emit an even number of instructions to the ring with mbox updates.
v4: I suck. The code should send out mbox updates for NUM_RINGS-1 *
number of commands. Instead of NUM_RINGS * number of commands-1.
-ret = intel_ring_begin(ring, round_up((I915_NUM_RINGS) * 3, 2) + 4); +ret = intel_ring_begin(ring, round_up((I915_NUM_RINGS-1) * 4, 2) + 4);

Reviewed-by (v1): Chris Wilson <[email protected]>

---
 drivers/gpu/drm/i915/i915_reg.h         |   13 ++++----
 drivers/gpu/drm/i915/intel_ringbuffer.c |   54 +++++++++++++++++--------------
 drivers/gpu/drm/i915/intel_ringbuffer.h |    4 +--
 3 files changed, 39 insertions(+), 32 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +7 -6
index fb76b19..d3040d5 100644
@@ -241,12 +241,12 @@
 #define  MI_SEMAPHORE_UPDATE	    (1<<21)
 #define  MI_SEMAPHORE_COMPARE	    (1<<20)
 #define  MI_SEMAPHORE_REGISTER	    (1<<18)
-#define  MI_SEMAPHORE_SYNC_RV	    (2<<16)
-#define  MI_SEMAPHORE_SYNC_RB	    (0<<16)
-#define  MI_SEMAPHORE_SYNC_VR	    (0<<16)
-#define  MI_SEMAPHORE_SYNC_VB	    (2<<16)
-#define  MI_SEMAPHORE_SYNC_BR	    (2<<16)
-#define  MI_SEMAPHORE_SYNC_BV	    (0<<16)
+#define  MI_SEMAPHORE_SYNC_RB	    (0<<16) /* RCS wait for BCS  (BRSYNC) */
+#define  MI_SEMAPHORE_SYNC_RV	    (2<<16) /* RCS wait for VCS  (VRSYNC) */
+#define  MI_SEMAPHORE_SYNC_VR	    (0<<16) /* VCS wait for RCS  (RVSYNC) */
+#define  MI_SEMAPHORE_SYNC_VB	    (2<<16) /* VCS wait for BCS  (BVSYNC) */
+#define  MI_SEMAPHORE_SYNC_BV	    (0<<16) /* BCS wait for VCS  (VBSYNC) */
+#define  MI_SEMAPHORE_SYNC_BR	    (2<<16) /* BCS wait for RCS  (RBSYNC) */
 #define  MI_SEMAPHORE_SYNC_INVALID  (1<<0)
 /*
  * 3D instructions used by the kernel
@@ -423,6 +423,7 @@
 #define GEN6_VBSYNC (RING_SYNC_0(GEN6_BSD_RING_BASE))
 #define GEN6_BRSYNC (RING_SYNC_0(BLT_RING_BASE))
 #define GEN6_BVSYNC (RING_SYNC_1(BLT_RING_BASE))
+#define GEN6_NOSYNC 0
 #define RING_MAX_IDLE(base)	((base)+0x54)
 #define RING_HWS_PGA(base)	((base)+0x80)
 #define RING_HWS_PGA_GEN6(base)	((base)+0x2080)
drivers/gpu/drm/i915/intel_ringbuffer.c +30 -24

90 lines not on this page · raw message

drivers/gpu/drm/i915/intel_ringbuffer.h +2 -2
index 55d3da2..3db4447 100644
@@ -80,8 +80,8 @@ struct  intel_ring_buffer {
 				   struct intel_ring_buffer *to,
 				   u32 seqno);
 
-	u32		semaphore_register[3]; /*our mbox written by others */
-	u32		signal_mbox[2]; /* mboxes this ring signals to */
+	u32		semaphore_register[I915_NUM_RINGS]; /*our mbox written by others */
+	u32		signal_mbox[I915_NUM_RINGS]; /* mboxes this ring signals to */
 	/**
 	 * List of objects currently involved in rendering from the
 	 * ringbuffer.
Signature · 1 line
1.7.10.2
#2 lore raw

Review

Quoted 11 lines · Ben Widawsky

After Daniel split out this code, I think this makes more sense, and looks nicer. Also added some comments to help the situation.

v2: Make signal_mbox be all rings for symmetric-ness.
v3: submitted the wrong version of the patch before.
v2 had an issue with odd number of rings. The fix is to always emit an even number of instructions to the ring with mbox updates.
v4: I suck. The code should send out mbox updates for NUM_RINGS-1 *
number of commands. Instead of NUM_RINGS * number of commands-1.

(quoted diff) +1 -1
-ret = intel_ring_begin(ring, round_up((I915_NUM_RINGS) * 3, 2) + 4);
+ret = intel_ring_begin(ring, round_up((I915_NUM_RINGS-1) * 4, 2) + 4);

I'm honestly less enthralled about v4. I'd rather see that as a separate preparatory patch so that it is put into context.
-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#3 lore raw
Quoted 4 lines · On Mon, 21 May 2012 09:44:02 +0100 Chris Wilson <[email protected]>…
Quoted 3 lines · Ben Widawsky

After Daniel split out this code, I think this makes more sense, and looks nicer. Also added some comments to help the situation.

Quoted 13 lines

Review

Quoted 8 lines

v2: Make signal_mbox be all rings for symmetric-ness.
v3: submitted the wrong version of the patch before.
v2 had an issue with odd number of rings. The fix is to always emit an even number of instructions to the ring with mbox updates.
v4: I suck. The code should send out mbox updates for NUM_RINGS-1 *
number of commands. Instead of NUM_RINGS * number of commands-1.

(quoted diff) +1 -1
-ret = intel_ring_begin(ring, round_up((I915_NUM_RINGS) * 3, 2) + 4);
+ret = intel_ring_begin(ring, round_up((I915_NUM_RINGS-1) * 4, 2) + 4);

I'm honestly less enthralled about v4. I'd rather see that as a separate preparatory patch so that it is put into context.
-Chris

I can do that. Are you okay with the idea otherwise? This is really all prep work for some HSW patches anyway.

Signature · 1 line
Ben Widawsky, Intel Open Source Technology Center
#4 lore raw
Quoted 2 lines · Ben Widawsky

I can do that. Are you okay with the idea otherwise? This is really all prep work for some HSW patches anyway.

Yes, I can see where you are going, I just need that little bit of convincing that it will all work out in the end ;-) -Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre