]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
drm/i915: Supply the engine-id for our mock_engine()
authorChris Wilson <chris@chris-wilson.co.uk>
Wed, 9 Aug 2017 16:39:30 +0000 (17:39 +0100)
committerChris Wilson <chris@chris-wilson.co.uk>
Thu, 10 Aug 2017 11:18:35 +0000 (12:18 +0100)
In the original selftest, we didn't care what the engine->id was, just
that it could uniquely identify it. Later though, we started tracking
the mock engines in the fixed size arrays around the drm_i915_private and
so we now require their indices to be correct. This becomes an issue when
using the standalone harness which runs all available tests at module load,
and so we quickly assign an out-of-bounds index to an engine as we
reallocate the mock GEM device between tests. It doesn't show up in
igt/drv_selftest as that runs each subtest individually.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102045
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20170809163930.26470-1-chris@chris-wilson.co.uk
Reviewed-by: Mika Kuoppala <mika.kuoppala@intel.com>
drivers/gpu/drm/i915/selftests/mock_engine.c
drivers/gpu/drm/i915/selftests/mock_engine.h
drivers/gpu/drm/i915/selftests/mock_gem_device.c

index 5b18a2dc19a87a9fd98fae33a5a8b00fb2eb3cdc..fc0fd7498689dc38626241140f944aba117ab436 100644 (file)
@@ -123,10 +123,12 @@ static struct intel_ring *mock_ring(struct intel_engine_cs *engine)
 }
 
 struct intel_engine_cs *mock_engine(struct drm_i915_private *i915,
-                                   const char *name)
+                                   const char *name,
+                                   int id)
 {
        struct mock_engine *engine;
-       static int id;
+
+       GEM_BUG_ON(id >= I915_NUM_ENGINES);
 
        engine = kzalloc(sizeof(*engine) + PAGE_SIZE, GFP_KERNEL);
        if (!engine)
@@ -141,7 +143,7 @@ struct intel_engine_cs *mock_engine(struct drm_i915_private *i915,
        /* minimal engine setup for requests */
        engine->base.i915 = i915;
        snprintf(engine->base.name, sizeof(engine->base.name), "%s", name);
-       engine->base.id = id++;
+       engine->base.id = id;
        engine->base.status_page.page_addr = (void *)(engine + 1);
 
        engine->base.context_pin = mock_context_pin;
index e5e240216ba3989b3091afbabafa9dbdd3cf8e48..133d0c21790ddb3b095eb21571aec13249299a9e 100644 (file)
@@ -40,7 +40,8 @@ struct mock_engine {
 };
 
 struct intel_engine_cs *mock_engine(struct drm_i915_private *i915,
-                                   const char *name);
+                                   const char *name,
+                                   int id);
 void mock_engine_flush(struct intel_engine_cs *engine);
 void mock_engine_reset(struct intel_engine_cs *engine);
 void mock_engine_free(struct intel_engine_cs *engine);
index ec92b6569b50cf294415cf5948eb8ac977291b5a..678723430d78f0d28683cb607b77590a7d53b9b1 100644 (file)
@@ -226,7 +226,7 @@ struct drm_i915_private *mock_gem_device(void)
        mutex_unlock(&i915->drm.struct_mutex);
 
        mkwrite_device_info(i915)->ring_mask = BIT(0);
-       i915->engine[RCS] = mock_engine(i915, "mock");
+       i915->engine[RCS] = mock_engine(i915, "mock", RCS);
        if (!i915->engine[RCS])
                goto err_priorities;