]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/i915/gt: Wait for the wa batch to be pinned
authorChris Wilson <chris@chris-wilson.co.uk>
Sat, 7 Mar 2020 12:24:25 +0000 (12:24 +0000)
committerChris Wilson <chris@chris-wilson.co.uk>
Sat, 7 Mar 2020 17:10:35 +0000 (17:10 +0000)
Be sure to wait for the vma to be in place before we tell the GPU to
execute from the wa batch. Since initialisation is mostly synchronous
(or rather at some point during start up we will need to sync anyway),
we can affort to do an explicit i915_vma_sync() during wa batch
construction rather than check for a required await on every context
switch. (We don't expect to change the wa bb at run time so paying the
cost once up front seems preferrable.)

Fixes: 27f7853a6589 ("drm/i915: Add mechanism to submit a context WA on ring submission")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200307122425.29114-1-chris@chris-wilson.co.uk
drivers/gpu/drm/i915/gt/intel_ring_submission.c
drivers/gpu/drm/i915/gt/selftest_ring_submission.c

index 6881317a747e0ab07b54f8f20b9c0a93c2649b78..1424582e4a9bcaac8c897d51ec397274c59c42c0 100644 (file)
@@ -2015,6 +2015,10 @@ static int gen7_ctx_switch_bb_init(struct intel_engine_cs *engine)
        if (err)
                goto err_private;
 
+       err = i915_vma_sync(vma);
+       if (err)
+               goto err_unpin;
+
        err = gen7_ctx_switch_bb_setup(engine, vma);
        if (err)
                goto err_unpin;
index fcfddcd2a63d1615cd6f5733e947c3fdfb5a4cb7..9995faadd7e81b6a0dc5ed58baa0ab4b0d020f90 100644 (file)
@@ -29,6 +29,12 @@ static struct i915_vma *create_wally(struct intel_engine_cs *engine)
                return ERR_PTR(err);
        }
 
+       err = i915_vma_sync(vma);
+       if (err) {
+               i915_gem_object_put(obj);
+               return ERR_PTR(err);
+       }
+
        cs = i915_gem_object_pin_map(obj, I915_MAP_WC);
        if (IS_ERR(cs)) {
                i915_gem_object_put(obj);