Commit 074bb195 authored by Matthew Brost's avatar Matthew Brost Committed by Matt Roper

drm/i915: Add i915_sched_engine_is_empty function

Add wrapper function around RB tree to determine if i915_sched_engine is
empty.
Signed-off-by: default avatarMatthew Brost <matthew.brost@intel.com>
Reviewed-by: default avatarJason Ekstrand <jason@jlekstrand.net>
Signed-off-by: default avatarMatt Roper <matthew.d.roper@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210618010638.98941-3-matthew.brost@intel.com
parent 3e28d371
...@@ -1259,7 +1259,7 @@ bool intel_engine_is_idle(struct intel_engine_cs *engine) ...@@ -1259,7 +1259,7 @@ bool intel_engine_is_idle(struct intel_engine_cs *engine)
intel_engine_flush_submission(engine); intel_engine_flush_submission(engine);
/* ELSP is empty, but there are ready requests? E.g. after reset */ /* ELSP is empty, but there are ready requests? E.g. after reset */
if (!RB_EMPTY_ROOT(&engine->sched_engine->queue.rb_root)) if (!i915_sched_engine_is_empty(engine->sched_engine))
return false; return false;
/* Ring stopped? */ /* Ring stopped? */
......
...@@ -384,7 +384,7 @@ __unwind_incomplete_requests(struct intel_engine_cs *engine) ...@@ -384,7 +384,7 @@ __unwind_incomplete_requests(struct intel_engine_cs *engine)
prio = rq_prio(rq); prio = rq_prio(rq);
pl = i915_sched_lookup_priolist(engine, prio); pl = i915_sched_lookup_priolist(engine, prio);
} }
GEM_BUG_ON(RB_EMPTY_ROOT(&engine->sched_engine->queue.rb_root)); GEM_BUG_ON(i915_sched_engine_is_empty(engine->sched_engine));
list_move(&rq->sched.link, pl); list_move(&rq->sched.link, pl);
set_bit(I915_FENCE_FLAG_PQUEUE, &rq->fence.flags); set_bit(I915_FENCE_FLAG_PQUEUE, &rq->fence.flags);
...@@ -1139,7 +1139,7 @@ static bool needs_timeslice(const struct intel_engine_cs *engine, ...@@ -1139,7 +1139,7 @@ static bool needs_timeslice(const struct intel_engine_cs *engine,
} }
/* Otherwise, ELSP[0] is by itself, but may be waiting in the queue */ /* Otherwise, ELSP[0] is by itself, but may be waiting in the queue */
if (!RB_EMPTY_ROOT(&engine->sched_engine->queue.rb_root)) { if (!i915_sched_engine_is_empty(engine->sched_engine)) {
ENGINE_TRACE(engine, "timeslice required for queue\n"); ENGINE_TRACE(engine, "timeslice required for queue\n");
return true; return true;
} }
...@@ -2487,7 +2487,7 @@ static void execlists_submit_request(struct i915_request *request) ...@@ -2487,7 +2487,7 @@ static void execlists_submit_request(struct i915_request *request)
} else { } else {
queue_request(engine, request); queue_request(engine, request);
GEM_BUG_ON(RB_EMPTY_ROOT(&engine->sched_engine->queue.rb_root)); GEM_BUG_ON(i915_sched_engine_is_empty(engine->sched_engine));
GEM_BUG_ON(list_empty(&request->sched.link)); GEM_BUG_ON(list_empty(&request->sched.link));
if (submit_queue(engine, request)) if (submit_queue(engine, request))
......
...@@ -515,7 +515,7 @@ static void guc_submit_request(struct i915_request *rq) ...@@ -515,7 +515,7 @@ static void guc_submit_request(struct i915_request *rq)
queue_request(engine, rq, rq_prio(rq)); queue_request(engine, rq, rq_prio(rq));
GEM_BUG_ON(RB_EMPTY_ROOT(&engine->sched_engine->queue.rb_root)); GEM_BUG_ON(i915_sched_engine_is_empty(engine->sched_engine));
GEM_BUG_ON(list_empty(&rq->sched.link)); GEM_BUG_ON(list_empty(&rq->sched.link));
tasklet_hi_schedule(&engine->execlists.tasklet); tasklet_hi_schedule(&engine->execlists.tasklet);
......
...@@ -66,6 +66,12 @@ i915_sched_engine_put(struct i915_sched_engine *sched_engine) ...@@ -66,6 +66,12 @@ i915_sched_engine_put(struct i915_sched_engine *sched_engine)
kref_put(&sched_engine->ref, i915_sched_engine_free); kref_put(&sched_engine->ref, i915_sched_engine_free);
} }
static inline bool
i915_sched_engine_is_empty(struct i915_sched_engine *sched_engine)
{
return RB_EMPTY_ROOT(&sched_engine->queue.rb_root);
}
void i915_request_show_with_schedule(struct drm_printer *m, void i915_request_show_with_schedule(struct drm_printer *m,
const struct i915_request *rq, const struct i915_request *rq,
const char *prefix, const char *prefix,
......
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