[Intel-gfx] [PATCH] drm/i915: Check for a second VCS engine more carefully

Chris Wilson chris at chris-wilson.co.uk
Fri Aug 9 05:13:54 UTC 2019


To use the legacy BSD selector, you must have a second VCS engine, or
else the ABI simply maps the request for another engine onto VCS0.
However, we only checked a single VCS1 location and overlooking the
possibility of a sparse VCS set being mapped to the dense ABI.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
Cc: Mika Kuoppala <mika.kuoppala at linux.intel.com>
---
 drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
index 566e8a4844cf..a43a9bd48bc5 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
@@ -2200,7 +2200,10 @@ eb_select_legacy_ring(struct i915_execbuffer *eb,
 		return -1;
 	}
 
-	if (user_ring_id == I915_EXEC_BSD && HAS_ENGINE(i915, VCS1)) {
+	BUILD_BUG_ON(I915_MAX_VCS > 8); /* see hweight8() below */
+	if (user_ring_id == I915_EXEC_BSD &&
+	    hweight8((INTEL_INFO(i915)->engine_mask >> VCS0) &
+		     (BIT(I915_MAX_VCS) - 1)) > 1) { /* silly abi is abi */
 		unsigned int bsd_idx = args->flags & I915_EXEC_BSD_MASK;
 
 		if (bsd_idx == I915_EXEC_BSD_DEFAULT) {
-- 
2.23.0.rc1



More information about the Intel-gfx mailing list