drm/i915: Reload PD tables after semaphore wait on gen8
authorChris Wilson <chris@chris-wilson.co.uk>
Fri, 29 Apr 2016 12:18:25 +0000 (13:18 +0100)
committerChris Wilson <chris@chris-wilson.co.uk>
Fri, 29 Apr 2016 12:59:56 +0000 (13:59 +0100)
When the engine idles waiting upon a semaphore, it loses its
pagetables and we must reload them before executing the batch.

v2: Restrict w/a to non-RCS rings (RCS works correctly apparently).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1461932305-14637-5-git-send-email-chris@chris-wilson.co.uk
drivers/gpu/drm/i915/intel_ringbuffer.c

index 533ebbd384f63eb4022e8214a56f8051fe1a1ce3..70738a54ed0fc307b825c0b7f8f8a5446fa22334 100644 (file)
@@ -1481,6 +1481,7 @@ gen8_ring_sync(struct drm_i915_gem_request *waiter_req,
 {
        struct intel_engine_cs *waiter = waiter_req->engine;
        struct drm_i915_private *dev_priv = waiter->dev->dev_private;
+       struct i915_hw_ppgtt *ppgtt;
        int ret;
 
        ret = intel_ring_begin(waiter_req, 4);
@@ -1496,6 +1497,15 @@ gen8_ring_sync(struct drm_i915_gem_request *waiter_req,
        intel_ring_emit(waiter,
                        upper_32_bits(GEN8_WAIT_OFFSET(waiter, signaller->id)));
        intel_ring_advance(waiter);
+
+       /* When the !RCS engines idle waiting upon a semaphore, they lose their
+        * pagetables and we must reload them before executing the batch.
+        * We do this on the i915_switch_context() following the wait and
+        * before the dispatch.
+        */
+       ppgtt = waiter_req->ctx->ppgtt;
+       if (ppgtt && waiter_req->engine->id != RCS)
+               ppgtt->pd_dirty_rings |= intel_engine_flag(waiter_req->engine);
        return 0;
 }