drm/i915: Fix VCS ring selection after uapi decoupling
authorTvrtko Ursulin <[email protected]>
Wed, 27 Jan 2016 13:41:09 +0000 (13:41 +0000)
committerTvrtko Ursulin <[email protected]>
Thu, 28 Jan 2016 10:25:49 +0000 (10:25 +0000)
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)

Signed-off-by: Tvrtko Ursulin <[email protected]>
Cc: Daniel Vetter <[email protected]>
Cc: Chris Wilson <[email protected]>
Cc: Zhipeng Gong <[email protected]>
Reviewed-by: Chris Wilson <[email protected]>
Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
Testcase: igt/gem_exec_basic # bdw-gt3

drivers/gpu/drm/i915/i915_gem_execbuffer.c
include/uapi/drm/i915_drm.h

index 2dc08ce1079a0be8efb1cc3fb7c3530a35010850..5cb57f642ac131cd5192ccf94bd068196fe3cf39 100644 (file)
@@ -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",
index 6a19371391fab40770634a36378e3c52426d8baa..a5524cc95ff8b6acd1c7a79bb554b0f24cf7bc42 100644 (file)
@@ -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.