summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/intel_lrc.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2019-03-08 14:25:16 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2019-03-08 14:59:41 +0100
commit7e3d9a59410d8ea1b4240952485731252ac15f34 (patch)
treecd78aec0e944e0da2c89b8684c7daa40495377f7 /drivers/gpu/drm/i915/intel_lrc.c
parentdrm/i915/dp: use single point of truth for PPS divisor register (diff)
downloadlinux-7e3d9a59410d8ea1b4240952485731252ac15f34.tar.xz
linux-7e3d9a59410d8ea1b4240952485731252ac15f34.zip
drm/i915: Track active engines within a context
For use in the next patch, if we track which engines have been used by the HW, we can reduce the work required to flush our state off the HW to those engines. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20190308132522.21573-1-chris@chris-wilson.co.uk
Diffstat (limited to 'drivers/gpu/drm/i915/intel_lrc.c')
-rw-r--r--drivers/gpu/drm/i915/intel_lrc.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
index f0ba20f2b41d..a9a47dbeac88 100644
--- a/drivers/gpu/drm/i915/intel_lrc.c
+++ b/drivers/gpu/drm/i915/intel_lrc.c
@@ -1282,6 +1282,7 @@ static void execlists_context_unpin(struct intel_context *ce)
i915_gem_object_unpin_map(ce->state->obj);
i915_vma_unpin(ce->state);
+ list_del(&ce->active_link);
i915_gem_context_put(ce->gem_context);
}
@@ -1366,6 +1367,11 @@ __execlists_context_pin(struct intel_engine_cs *engine,
__execlists_update_reg_state(engine, ce);
ce->state->obj->pin_global++;
+
+ mutex_lock(&ctx->mutex);
+ list_add(&ce->active_link, &ctx->active_engines);
+ mutex_unlock(&ctx->mutex);
+
i915_gem_context_get(ctx);
return ce;
@@ -2887,9 +2893,8 @@ error_deref_obj:
void intel_lr_context_resume(struct drm_i915_private *i915)
{
- struct intel_engine_cs *engine;
struct i915_gem_context *ctx;
- enum intel_engine_id id;
+ struct intel_context *ce;
/*
* Because we emit WA_TAIL_DWORDS there may be a disparity
@@ -2903,17 +2908,10 @@ void intel_lr_context_resume(struct drm_i915_private *i915)
* simplicity, we just zero everything out.
*/
list_for_each_entry(ctx, &i915->contexts.list, link) {
- for_each_engine(engine, i915, id) {
- struct intel_context *ce =
- to_intel_context(ctx, engine);
-
- if (!ce->state)
- continue;
-
+ list_for_each_entry(ce, &ctx->active_engines, active_link) {
+ GEM_BUG_ON(!ce->ring);
intel_ring_reset(ce->ring, 0);
-
- if (ce->pin_count) /* otherwise done in context_pin */
- __execlists_update_reg_state(engine, ce);
+ __execlists_update_reg_state(ce->engine, ce);
}
}
}