|
@@ -765,6 +765,7 @@ intel_logical_ring_advance_and_submit(struct drm_i915_gem_request *request)
|
|
{
|
|
{
|
|
struct intel_ringbuffer *ringbuf = request->ringbuf;
|
|
struct intel_ringbuffer *ringbuf = request->ringbuf;
|
|
struct drm_i915_private *dev_priv = request->i915;
|
|
struct drm_i915_private *dev_priv = request->i915;
|
|
|
|
+ struct intel_engine_cs *engine = request->ring;
|
|
|
|
|
|
intel_logical_ring_advance(ringbuf);
|
|
intel_logical_ring_advance(ringbuf);
|
|
request->tail = ringbuf->tail;
|
|
request->tail = ringbuf->tail;
|
|
@@ -779,9 +780,20 @@ intel_logical_ring_advance_and_submit(struct drm_i915_gem_request *request)
|
|
intel_logical_ring_emit(ringbuf, MI_NOOP);
|
|
intel_logical_ring_emit(ringbuf, MI_NOOP);
|
|
intel_logical_ring_advance(ringbuf);
|
|
intel_logical_ring_advance(ringbuf);
|
|
|
|
|
|
- if (intel_ring_stopped(request->ring))
|
|
|
|
|
|
+ if (intel_ring_stopped(engine))
|
|
return 0;
|
|
return 0;
|
|
|
|
|
|
|
|
+ if (engine->last_context != request->ctx) {
|
|
|
|
+ if (engine->last_context)
|
|
|
|
+ intel_lr_context_unpin(engine->last_context, engine);
|
|
|
|
+ if (request->ctx != request->i915->kernel_context) {
|
|
|
|
+ intel_lr_context_pin(request->ctx, engine);
|
|
|
|
+ engine->last_context = request->ctx;
|
|
|
|
+ } else {
|
|
|
|
+ engine->last_context = NULL;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
if (dev_priv->guc.execbuf_client)
|
|
if (dev_priv->guc.execbuf_client)
|
|
i915_guc_submit(dev_priv->guc.execbuf_client, request);
|
|
i915_guc_submit(dev_priv->guc.execbuf_client, request);
|
|
else
|
|
else
|
|
@@ -1131,7 +1143,7 @@ void intel_lr_context_unpin(struct intel_context *ctx,
|
|
{
|
|
{
|
|
struct drm_i915_gem_object *ctx_obj = ctx->engine[engine->id].state;
|
|
struct drm_i915_gem_object *ctx_obj = ctx->engine[engine->id].state;
|
|
|
|
|
|
- WARN_ON(!mutex_is_locked(&engine->dev->struct_mutex));
|
|
|
|
|
|
+ WARN_ON(!mutex_is_locked(&ctx->i915->dev->struct_mutex));
|
|
|
|
|
|
if (WARN_ON_ONCE(!ctx_obj))
|
|
if (WARN_ON_ONCE(!ctx_obj))
|
|
return;
|
|
return;
|