drm/i915/selftests: Fixup a missing legacy_idx
authorChris Wilson <chris@chris-wilson.co.uk>
Thu, 8 Aug 2019 19:45:25 +0000 (20:45 +0100)
committerChris Wilson <chris@chris-wilson.co.uk>
Thu, 8 Aug 2019 19:53:31 +0000 (20:53 +0100)
Grr, missed one*. For using the legacy engine map, we should use
engine->legacy_idx. Ideally, we should know the intel_context in the
selftest and avoid all the fiddling around with unwanted GEM contexts.

* In my defence, the conflict was added in another patch after it was
tested by CI.

v2: mock engines needs legacy love as well

Fixes: f1c4d157ab9b ("drm/i915: Fix up the inverse mapping for default ctx->engines[]")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Matthew Auld <matthew.auld@intel.com>
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190808194525.9410-2-chris@chris-wilson.co.uk
drivers/gpu/drm/i915/gt/mock_engine.c
drivers/gpu/drm/i915/selftests/i915_request.c
drivers/gpu/drm/i915/selftests/mock_gem_device.c

index c6479086479531c443878f1c427ececff8d0d94f..dd02e59b192fb5e3c04659c794e64d814e55f3e5 100644 (file)
@@ -263,6 +263,7 @@ struct intel_engine_cs *mock_engine(struct drm_i915_private *i915,
        snprintf(engine->base.name, sizeof(engine->base.name), "%s", name);
        engine->base.id = id;
        engine->base.mask = BIT(id);
+       engine->base.instance = id;
        engine->base.status_page.addr = (void *)(engine + 1);
 
        engine->base.cops = &mock_context_ops;
@@ -281,6 +282,8 @@ struct intel_engine_cs *mock_engine(struct drm_i915_private *i915,
        timer_setup(&engine->hw_delay, hw_delay_complete, 0);
        INIT_LIST_HEAD(&engine->hw_queue);
 
+       intel_engine_add_user(&engine->base);
+
        return &engine->base;
 }
 
index 2e0fd701bca71f731c905ded11e27d866cbe8525..3937d43c2961f745f5655115c5b59dff0a8d874b 100644 (file)
@@ -339,7 +339,7 @@ static int __igt_breadcrumbs_smoketest(void *arg)
 
                        mutex_lock(BKL);
 
-                       ce = i915_gem_context_get_engine(ctx, t->engine->id);
+                       ce = i915_gem_context_get_engine(ctx, t->engine->legacy_idx);
                        GEM_BUG_ON(IS_ERR(ce));
                        rq = t->request_alloc(ce);
                        intel_context_put(ce);
index fd4cc4809eb87ade84265c3020ee4561460a8015..01a89c071bf5c7ab7b8ddd311fb4c3474196efd5 100644 (file)
@@ -213,6 +213,7 @@ struct drm_i915_private *mock_gem_device(void)
        if (mock_engine_init(i915->engine[RCS0]))
                goto err_context;
 
+       intel_engines_driver_register(i915);
        mutex_unlock(&i915->drm.struct_mutex);
 
        WARN_ON(i915_gemfs_init(i915));