Commit 097a9481 authored by Michał Winiarski's avatar Michał Winiarski Committed by Chris Wilson

drm/i915/execlists: Cache the last priolist lookup

Avoid the repeated rbtree lookup for each request as we unwind them by
tracking the last priolist.

v2: Fix up my unhelpful suggestion of using default_priolist.
Signed-off-by: default avatarMichał Winiarski <michal.winiarski@intel.com>
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: default avatarJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20170928193910.17988-4-chris@chris-wilson.co.uk
parent 7d1ea609
...@@ -358,25 +358,31 @@ static void unwind_wa_tail(struct drm_i915_gem_request *rq) ...@@ -358,25 +358,31 @@ static void unwind_wa_tail(struct drm_i915_gem_request *rq)
static void unwind_incomplete_requests(struct intel_engine_cs *engine) static void unwind_incomplete_requests(struct intel_engine_cs *engine)
{ {
struct drm_i915_gem_request *rq, *rn; struct drm_i915_gem_request *rq, *rn;
struct i915_priolist *uninitialized_var(p);
int last_prio = I915_PRIORITY_INVALID;
lockdep_assert_held(&engine->timeline->lock); lockdep_assert_held(&engine->timeline->lock);
list_for_each_entry_safe_reverse(rq, rn, list_for_each_entry_safe_reverse(rq, rn,
&engine->timeline->requests, &engine->timeline->requests,
link) { link) {
struct i915_priolist *p;
if (i915_gem_request_completed(rq)) if (i915_gem_request_completed(rq))
return; return;
__i915_gem_request_unsubmit(rq); __i915_gem_request_unsubmit(rq);
unwind_wa_tail(rq); unwind_wa_tail(rq);
p = lookup_priolist(engine, GEM_BUG_ON(rq->priotree.priority == I915_PRIORITY_INVALID);
&rq->priotree, if (rq->priotree.priority != last_prio) {
rq->priotree.priority); p = lookup_priolist(engine,
list_add(&rq->priotree.link, &rq->priotree,
&ptr_mask_bits(p, 1)->requests); rq->priotree.priority);
p = ptr_mask_bits(p, 1);
last_prio = rq->priotree.priority;
}
list_add(&rq->priotree.link, &p->requests);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment