Skip to contentSkip to conversation

drm/i915: Fix VCS ring selection after uapi decoupling

PATCH Superseded Tvrtko Ursulin 3 participants 6 messages Jan 27, 2016 – Jan 28, 2016

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

PATCH 1/1 drm/i915: Fix VCS ring selection after uapi decoupling

From: Tvrtko Ursulin <[email protected]>

This got broken in:

commit de1add360522c876c25ef2bbbbab1c94bdb509ab
Author: Tvrtko Ursulin <[email protected]>
Date: Fri Jan 15 15:12:50 2016 +0000

drm/i915: Decouple execbuf uAPI from internal implementation

BSD ring flags need to be shifted before they can be considered indices into the ring array.

Reported by Zhipeng Gong.

Cc Daniel Vetter <[email protected]>
Cc Chris Wilson <[email protected]>
Cc Zhipeng Gong <[email protected]>
---
 drivers/gpu/drm/i915/i915_gem_execbuffer.c | 11 +++++++----
 include/uapi/drm/i915_drm.h                | 10 ++++++----
 2 files changed, 13 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/i915_gem_execbuffer.c +7 -4
index 2dc08ce1079a..6fc620af14fa 100644
@@ -1395,12 +1395,15 @@ eb_select_ring(struct drm_i915_private *dev_priv,
 	}
 
 	if (user_ring_id == I915_EXEC_BSD && HAS_BSD2(dev_priv)) {
-		unsigned int bsd_idx = args->flags & I915_EXEC_BSD_MASK;
+		unsigned int bsd_idx = (args->flags & I915_EXEC_BSD_MASK) >>
+					I915_EXEC_BSD_SHIFT;
 
-		if (bsd_idx == I915_EXEC_BSD_DEFAULT) {
+		if (bsd_idx == (I915_EXEC_BSD_DEFAULT >> I915_EXEC_BSD_SHIFT)) {
 			bsd_idx = gen8_dispatch_bsd_ring(dev_priv, file);
-		} else if (bsd_idx >= I915_EXEC_BSD_RING1 &&
-			   bsd_idx <= I915_EXEC_BSD_RING2) {
+		} else if (bsd_idx >=
+			  (I915_EXEC_BSD_RING1 >> I915_EXEC_BSD_SHIFT) &&
+			  bsd_idx <=
+			  (I915_EXEC_BSD_RING2 >> I915_EXEC_BSD_SHIFT)) {
 			bsd_idx--;
 		} else {
 			DRM_DEBUG("execbuf with unknown bsd ring: %u\n",
include/uapi/drm/i915_drm.h +6 -4
index 6a19371391fa..a5524cc95ff8 100644
@@ -772,10 +772,12 @@ struct drm_i915_gem_execbuffer2 {
 #define I915_EXEC_HANDLE_LUT		(1<<12)
 
 /** Used for switching BSD rings on the platforms with two BSD rings */
-#define I915_EXEC_BSD_MASK		(3<<13)
-#define I915_EXEC_BSD_DEFAULT		(0<<13) /* default ping-pong mode */
-#define I915_EXEC_BSD_RING1		(1<<13)
-#define I915_EXEC_BSD_RING2		(2<<13)
+#define I915_EXEC_BSD_SHIFT	 (13)
+#define I915_EXEC_BSD_MASK	 (3 << I915_EXEC_BSD_SHIFT)
+/* default ping-pong mode */
+#define I915_EXEC_BSD_DEFAULT	 (0 << I915_EXEC_BSD_SHIFT)
+#define I915_EXEC_BSD_RING1	 (1 << I915_EXEC_BSD_SHIFT)
+#define I915_EXEC_BSD_RING2	 (2 << I915_EXEC_BSD_SHIFT)
 
 /** Tell the kernel that the batchbuffer is processed by
  *  the resource streamer.
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw
Quoted 8 lines · Tvrtko Ursulin

From: Tvrtko Ursulin <[email protected]>

This got broken in:

commit de1add360522c876c25ef2bbbbab1c94bdb509ab
Author: Tvrtko Ursulin <[email protected]>
Date: Fri Jan 15 15:12:50 2016 +0000

Quoted 7 lines

drm/i915: Decouple execbuf uAPI from internal implementation

BSD ring flags need to be shifted before they can be considered indices into the ring array.

Reported by Zhipeng Gong.

This should be hit by gem_busy on appropriate hardware. I need to add the extra ring to gem_exec_nop and make those all basic test.

Quoted 20 lines
Cc Daniel Vetter <[email protected]>
Cc Chris Wilson <[email protected]>
Cc Zhipeng Gong <[email protected]>
---
 drivers/gpu/drm/i915/i915_gem_execbuffer.c | 11 +++++++----
 include/uapi/drm/i915_drm.h                | 10 ++++++----
 2 files changed, 13 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/i915_gem_execbuffer.c +2 -1
index 2dc08ce1079a..6fc620af14fa 100644
@@ -1395,12 +1395,15 @@ eb_select_ring(struct drm_i915_private *dev_priv,
 	}
 
 	if (user_ring_id == I915_EXEC_BSD && HAS_BSD2(dev_priv)) {
-		unsigned int bsd_idx = args->flags & I915_EXEC_BSD_MASK;
+		unsigned int bsd_idx = (args->flags & I915_EXEC_BSD_MASK) >>
+					I915_EXEC_BSD_SHIFT;

drivers/gpu/drm/i915/i915_gem_execbuffer.c eb_select_ring(struct drm_i915_private *dev_priv, · line 1406

Quoted 10 lines
drivers/gpu/drm/i915/i915_gem_execbuffer.c +5 -3
 
-		if (bsd_idx == I915_EXEC_BSD_DEFAULT) {
+		if (bsd_idx == (I915_EXEC_BSD_DEFAULT >> I915_EXEC_BSD_SHIFT)) {
 			bsd_idx = gen8_dispatch_bsd_ring(dev_priv, file);
-		} else if (bsd_idx >= I915_EXEC_BSD_RING1 &&
-			   bsd_idx <= I915_EXEC_BSD_RING2) {
+		} else if (bsd_idx >=
+			  (I915_EXEC_BSD_RING1 >> I915_EXEC_BSD_SHIFT) &&
+			  bsd_idx <=
+			  (I915_EXEC_BSD_RING2 >> I915_EXEC_BSD_SHIFT)) {

Wouldn't inserting bsd_idx >>= I915_EXEC_BSD_SHIFT; here be simpler ?

Quoted 1 line
drivers/gpu/drm/i915/i915_gem_execbuffer.c +0 -0
 			bsd_idx--;
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw

PATCH v2 1/1 drm/i915: Fix VCS ring selection after uapi decoupling

From: Tvrtko Ursulin <[email protected]>

This got broken in:

commit de1add360522c876c25ef2bbbbab1c94bdb509ab
Author: Tvrtko Ursulin <[email protected]>
Date: Fri Jan 15 15:12:50 2016 +0000

drm/i915: Decouple execbuf uAPI from internal implementation

BSD ring flags need to be shifted before they can be considered indices into the ring array.

Reported by Zhipeng Gong.

v2: Simplify the code. (Chris Wilson)

Cc Daniel Vetter <[email protected]>
Cc Chris Wilson <[email protected]>
Cc Zhipeng Gong <[email protected]>
---
 drivers/gpu/drm/i915/i915_gem_execbuffer.c |  1 +
 include/uapi/drm/i915_drm.h                | 10 ++++++----
 2 files changed, 7 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/i915_gem_execbuffer.c +1 -0
index 2dc08ce1079a..5cb57f642ac1 100644
@@ -1401,6 +1401,7 @@ eb_select_ring(struct drm_i915_private *dev_priv,
 			bsd_idx = gen8_dispatch_bsd_ring(dev_priv, file);
 		} else if (bsd_idx >= I915_EXEC_BSD_RING1 &&
 			   bsd_idx <= I915_EXEC_BSD_RING2) {
+			bsd_idx >>= I915_EXEC_BSD_SHIFT;
 			bsd_idx--;
 		} else {
 			DRM_DEBUG("execbuf with unknown bsd ring: %u\n",
include/uapi/drm/i915_drm.h +6 -4
index 6a19371391fa..a5524cc95ff8 100644
@@ -772,10 +772,12 @@ struct drm_i915_gem_execbuffer2 {
 #define I915_EXEC_HANDLE_LUT		(1<<12)
 
 /** Used for switching BSD rings on the platforms with two BSD rings */
-#define I915_EXEC_BSD_MASK		(3<<13)
-#define I915_EXEC_BSD_DEFAULT		(0<<13) /* default ping-pong mode */
-#define I915_EXEC_BSD_RING1		(1<<13)
-#define I915_EXEC_BSD_RING2		(2<<13)
+#define I915_EXEC_BSD_SHIFT	 (13)
+#define I915_EXEC_BSD_MASK	 (3 << I915_EXEC_BSD_SHIFT)
+/* default ping-pong mode */
+#define I915_EXEC_BSD_DEFAULT	 (0 << I915_EXEC_BSD_SHIFT)
+#define I915_EXEC_BSD_RING1	 (1 << I915_EXEC_BSD_SHIFT)
+#define I915_EXEC_BSD_RING2	 (2 << I915_EXEC_BSD_SHIFT)
 
 /** Tell the kernel that the batchbuffer is processed by
  *  the resource streamer.
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v2 1/1
#3 lore raw
Quoted 8 lines · Tvrtko Ursulin

From: Tvrtko Ursulin <[email protected]>

This got broken in:

commit de1add360522c876c25ef2bbbbab1c94bdb509ab
Author: Tvrtko Ursulin <[email protected]>
Date: Fri Jan 15 15:12:50 2016 +0000

Quoted 8 lines

drm/i915: Decouple execbuf uAPI from internal implementation

BSD ring flags need to be shifted before they can be considered indices into the ring array.

Reported by Zhipeng Gong.

v2: Simplify the code. (Chris Wilson)

Testcase: igt/gem_exec_basic # bdw-gt3

Quoted 4 lines
Cc Daniel Vetter <[email protected]>
Cc Chris Wilson <[email protected]>
Cc Zhipeng Gong <[email protected]>

There were a few tests that would have hit this, but nothing existed to only try and touch the ring so I added gem_exec_basic to exercise the ring selection.
-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
#4 lore raw
In reply to Chris Wilson
Quoted 11 lines · Chris Wilson
Quoted 10 lines · Tvrtko Ursulin

From: Tvrtko Ursulin <[email protected]>

This got broken in:

commit de1add360522c876c25ef2bbbbab1c94bdb509ab
Author: Tvrtko Ursulin <[email protected]>
Date: Fri Jan 15 15:12:50 2016 +0000

drm/i915: Decouple execbuf uAPI from internal implementation

Quoted 8 lines
Quoted 5 lines

BSD ring flags need to be shifted before they can be considered indices into the ring array.

Reported by Zhipeng Gong.

This should be hit by gem_busy on appropriate hardware. I need to add the extra ring to gem_exec_nop and make those all basic test.

Right hardware is the key.

Quoted 21 lines
Quoted 21 lines
Cc Daniel Vetter <[email protected]>
Cc Chris Wilson <[email protected]>
Cc Zhipeng Gong <[email protected]>
---
  drivers/gpu/drm/i915/i915_gem_execbuffer.c | 11 +++++++----
  include/uapi/drm/i915_drm.h                | 10 ++++++----
  2 files changed, 13 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/i915_gem_execbuffer.c +2 -1
index 2dc08ce1079a..6fc620af14fa 100644
@@ -1395,12 +1395,15 @@ eb_select_ring(struct drm_i915_private *dev_priv,
  	}
 
  	if (user_ring_id == I915_EXEC_BSD && HAS_BSD2(dev_priv)) {
-		unsigned int bsd_idx = args->flags & I915_EXEC_BSD_MASK;
+		unsigned int bsd_idx = (args->flags & I915_EXEC_BSD_MASK) >>
+					I915_EXEC_BSD_SHIFT;
 
Quoted 11 lines

drivers/gpu/drm/i915/i915_gem_execbuffer.c eb_select_ring(struct drm_i915_private *dev_priv, · line 1406

Quoted 9 lines
drivers/gpu/drm/i915/i915_gem_execbuffer.c +5 -3
-		if (bsd_idx == I915_EXEC_BSD_DEFAULT) {
+		if (bsd_idx == (I915_EXEC_BSD_DEFAULT >> I915_EXEC_BSD_SHIFT)) {
  			bsd_idx = gen8_dispatch_bsd_ring(dev_priv, file);
-		} else if (bsd_idx >= I915_EXEC_BSD_RING1 &&
-			   bsd_idx <= I915_EXEC_BSD_RING2) {
+		} else if (bsd_idx >=
+			  (I915_EXEC_BSD_RING1 >> I915_EXEC_BSD_SHIFT) &&
+			  bsd_idx <=
+			  (I915_EXEC_BSD_RING2 >> I915_EXEC_BSD_SHIFT)) {

Wouldn't inserting bsd_idx >>= I915_EXEC_BSD_SHIFT; here be simpler ?

Indeed it would, v2 is on the way.

Regards,

Tvrtko

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#5 lore raw

✓ Fi.CI.BAT: success for drm/i915: Fix VCS ring selection after uapi decoupling (rev2)

In reply to Tvrtko Ursulin
== Summary ==

== Summary ==

Built on 430706bace599ea1a908b9a7c6b7ea17535fe17f drm-intel-nightly: 2016y-01m-27d-16h-33m-06s UTC integration manifest

Test kms_pipe_crc_basic:

        Subgroup read-crc-pipe-b:
                dmesg-warn -> PASS       (ilk-hp8440p)
bdw-nuci7        total:141  pass:132  dwarn:0   dfail:0   fail:0   skip:9  
bdw-ultra        total:144  pass:138  dwarn:0   dfail:0   fail:0   skip:6  
bsw-nuc-2        total:144  pass:120  dwarn:0   dfail:0   fail:0   skip:24 
byt-nuc          total:144  pass:129  dwarn:0   dfail:0   fail:0   skip:15 
hsw-brixbox      total:144  pass:137  dwarn:0   dfail:0   fail:0   skip:7  
hsw-gt2          total:144  pass:140  dwarn:0   dfail:0   fail:0   skip:4  
ilk-hp8440p      total:144  pass:105  dwarn:0   dfail:0   fail:1   skip:38 
ivb-t430s        total:144  pass:138  dwarn:0   dfail:0   fail:0   skip:6  
skl-i5k-2        total:144  pass:135  dwarn:1   dfail:0   fail:0   skip:8  
snb-dellxps      total:144  pass:130  dwarn:0   dfail:0   fail:0   skip:14 

Results at /archive/results/CI_IGT_test/Patchwork_1275/

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx