Commit 3e28d371 authored by Matthew Brost's avatar Matthew Brost Committed by Matt Roper

drm/i915: Move priolist to new i915_sched_engine object

Introduce i915_sched_engine object which is lower level data structure
that i915_scheduler / generic code can operate on without touching
execlist specific structures. This allows additional submission backends
to be added without breaking the layering. Currently the execlists
backend uses 1 of these object per each engine (physical or virtual) but
future backends like the GuC will point to less instances utilizing the
reference counting.

This is a bit of detour to integrating the i915 with the DRM scheduler
but this object will still exist when the DRM scheduler lands in the
i915. It will however look a bit different. It will encapsulate the
drm_gpu_scheduler object plus and common variables (to the backends)
related to scheduling. Regardless this is a step in the right direction.

This patch starts the aforementioned transition by moving the priolist
into the i915_sched_engine object.

v3:
 (Jason Ekstrand)
  Update comment next to intel_engine_cs.virtual
  Add kernel doc
 (Checkpatch)
  Fix double the in commit message
v4:
 (Daniele)
  Update comment message.
  Add comment about subclass field
Signed-off-by: default avatarMatthew Brost <matthew.brost@intel.com>
Reviewed-by: default avatarDaniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Signed-off-by: default avatarMatt Roper <matthew.d.roper@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210618010638.98941-2-matthew.brost@intel.com
parent 59bd8ae7
...@@ -425,6 +425,11 @@ User Batchbuffer Execution ...@@ -425,6 +425,11 @@ User Batchbuffer Execution
.. kernel-doc:: drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c .. kernel-doc:: drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
:doc: User command execution :doc: User command execution
Scheduling
----------
.. kernel-doc:: drivers/gpu/drm/i915/i915_scheduler_types.h
:functions: i915_sched_engine
Logical Rings, Logical Ring Contexts and Execlists Logical Rings, Logical Ring Contexts and Execlists
-------------------------------------------------- --------------------------------------------------
......
...@@ -585,9 +585,6 @@ void intel_engine_init_execlists(struct intel_engine_cs *engine) ...@@ -585,9 +585,6 @@ void intel_engine_init_execlists(struct intel_engine_cs *engine)
memset(execlists->pending, 0, sizeof(execlists->pending)); memset(execlists->pending, 0, sizeof(execlists->pending));
execlists->active = execlists->active =
memset(execlists->inflight, 0, sizeof(execlists->inflight)); memset(execlists->inflight, 0, sizeof(execlists->inflight));
execlists->queue_priority_hint = INT_MIN;
execlists->queue = RB_ROOT_CACHED;
} }
static void cleanup_status_page(struct intel_engine_cs *engine) static void cleanup_status_page(struct intel_engine_cs *engine)
...@@ -714,6 +711,12 @@ static int engine_setup_common(struct intel_engine_cs *engine) ...@@ -714,6 +711,12 @@ static int engine_setup_common(struct intel_engine_cs *engine)
goto err_status; goto err_status;
} }
engine->sched_engine = i915_sched_engine_create(ENGINE_PHYSICAL);
if (!engine->sched_engine) {
err = -ENOMEM;
goto err_sched_engine;
}
err = intel_engine_init_cmd_parser(engine); err = intel_engine_init_cmd_parser(engine);
if (err) if (err)
goto err_cmd_parser; goto err_cmd_parser;
...@@ -737,6 +740,8 @@ static int engine_setup_common(struct intel_engine_cs *engine) ...@@ -737,6 +740,8 @@ static int engine_setup_common(struct intel_engine_cs *engine)
return 0; return 0;
err_cmd_parser: err_cmd_parser:
i915_sched_engine_put(engine->sched_engine);
err_sched_engine:
intel_breadcrumbs_free(engine->breadcrumbs); intel_breadcrumbs_free(engine->breadcrumbs);
err_status: err_status:
cleanup_status_page(engine); cleanup_status_page(engine);
...@@ -967,6 +972,7 @@ void intel_engine_cleanup_common(struct intel_engine_cs *engine) ...@@ -967,6 +972,7 @@ void intel_engine_cleanup_common(struct intel_engine_cs *engine)
GEM_BUG_ON(!list_empty(&engine->active.requests)); GEM_BUG_ON(!list_empty(&engine->active.requests));
tasklet_kill(&engine->execlists.tasklet); /* flush the callback */ tasklet_kill(&engine->execlists.tasklet); /* flush the callback */
i915_sched_engine_put(engine->sched_engine);
intel_breadcrumbs_free(engine->breadcrumbs); intel_breadcrumbs_free(engine->breadcrumbs);
intel_engine_fini_retire(engine); intel_engine_fini_retire(engine);
...@@ -1253,7 +1259,7 @@ bool intel_engine_is_idle(struct intel_engine_cs *engine) ...@@ -1253,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->execlists.queue.rb_root)) if (!RB_EMPTY_ROOT(&engine->sched_engine->queue.rb_root))
return false; return false;
/* Ring stopped? */ /* Ring stopped? */
......
...@@ -275,12 +275,12 @@ static int __engine_park(struct intel_wakeref *wf) ...@@ -275,12 +275,12 @@ static int __engine_park(struct intel_wakeref *wf)
intel_breadcrumbs_park(engine->breadcrumbs); intel_breadcrumbs_park(engine->breadcrumbs);
/* Must be reset upon idling, or we may miss the busy wakeup. */ /* Must be reset upon idling, or we may miss the busy wakeup. */
GEM_BUG_ON(engine->execlists.queue_priority_hint != INT_MIN); GEM_BUG_ON(engine->sched_engine->queue_priority_hint != INT_MIN);
if (engine->park) if (engine->park)
engine->park(engine); engine->park(engine);
engine->execlists.no_priolist = false; engine->sched_engine->no_priolist = false;
/* While gt calls i915_vma_parked(), we have to break the lock cycle */ /* While gt calls i915_vma_parked(), we have to break the lock cycle */
intel_gt_pm_put_async(engine->gt); intel_gt_pm_put_async(engine->gt);
......
...@@ -59,6 +59,7 @@ struct drm_i915_reg_table; ...@@ -59,6 +59,7 @@ struct drm_i915_reg_table;
struct i915_gem_context; struct i915_gem_context;
struct i915_request; struct i915_request;
struct i915_sched_attr; struct i915_sched_attr;
struct i915_sched_engine;
struct intel_gt; struct intel_gt;
struct intel_ring; struct intel_ring;
struct intel_uncore; struct intel_uncore;
...@@ -152,11 +153,6 @@ struct intel_engine_execlists { ...@@ -152,11 +153,6 @@ struct intel_engine_execlists {
*/ */
struct timer_list preempt; struct timer_list preempt;
/**
* @default_priolist: priority list for I915_PRIORITY_NORMAL
*/
struct i915_priolist default_priolist;
/** /**
* @ccid: identifier for contexts submitted to this engine * @ccid: identifier for contexts submitted to this engine
*/ */
...@@ -191,11 +187,6 @@ struct intel_engine_execlists { ...@@ -191,11 +187,6 @@ struct intel_engine_execlists {
*/ */
u32 reset_ccid; u32 reset_ccid;
/**
* @no_priolist: priority lists disabled
*/
bool no_priolist;
/** /**
* @submit_reg: gen-specific execlist submission register * @submit_reg: gen-specific execlist submission register
* set to the ExecList Submission Port (elsp) register pre-Gen11 and to * set to the ExecList Submission Port (elsp) register pre-Gen11 and to
...@@ -238,23 +229,10 @@ struct intel_engine_execlists { ...@@ -238,23 +229,10 @@ struct intel_engine_execlists {
unsigned int port_mask; unsigned int port_mask;
/** /**
* @queue_priority_hint: Highest pending priority. * @virtual: Queue of requets on a virtual engine, sorted by priority.
* * Each RB entry is a struct i915_priolist containing a list of requests
* When we add requests into the queue, or adjust the priority of * of the same priority.
* executing requests, we compute the maximum priority of those
* pending requests. We can then use this value to determine if
* we need to preempt the executing requests to service the queue.
* However, since the we may have recorded the priority of an inflight
* request we wanted to preempt but since completed, at the time of
* dequeuing the priority hint may no longer may match the highest
* available request priority.
*/ */
int queue_priority_hint;
/**
* @queue: queue of requests, in priority lists
*/
struct rb_root_cached queue;
struct rb_root_cached virtual; struct rb_root_cached virtual;
/** /**
...@@ -332,6 +310,8 @@ struct intel_engine_cs { ...@@ -332,6 +310,8 @@ struct intel_engine_cs {
struct list_head hold; /* ready requests, but on hold */ struct list_head hold; /* ready requests, but on hold */
} active; } active;
struct i915_sched_engine *sched_engine;
/* keep a request in reserve for a [pm] barrier under oom */ /* keep a request in reserve for a [pm] barrier under oom */
struct i915_request *request_pool; struct i915_request *request_pool;
......
...@@ -283,6 +283,7 @@ static void mock_engine_release(struct intel_engine_cs *engine) ...@@ -283,6 +283,7 @@ static void mock_engine_release(struct intel_engine_cs *engine)
GEM_BUG_ON(timer_pending(&mock->hw_delay)); GEM_BUG_ON(timer_pending(&mock->hw_delay));
i915_sched_engine_put(engine->sched_engine);
intel_breadcrumbs_free(engine->breadcrumbs); intel_breadcrumbs_free(engine->breadcrumbs);
intel_context_unpin(engine->kernel_context); intel_context_unpin(engine->kernel_context);
...@@ -345,6 +346,10 @@ int mock_engine_init(struct intel_engine_cs *engine) ...@@ -345,6 +346,10 @@ int mock_engine_init(struct intel_engine_cs *engine)
{ {
struct intel_context *ce; struct intel_context *ce;
engine->sched_engine = i915_sched_engine_create(ENGINE_MOCK);
if (!engine->sched_engine)
return -ENOMEM;
intel_engine_init_active(engine, ENGINE_MOCK); intel_engine_init_active(engine, ENGINE_MOCK);
intel_engine_init_execlists(engine); intel_engine_init_execlists(engine);
intel_engine_init__pm(engine); intel_engine_init__pm(engine);
...@@ -352,7 +357,7 @@ int mock_engine_init(struct intel_engine_cs *engine) ...@@ -352,7 +357,7 @@ int mock_engine_init(struct intel_engine_cs *engine)
engine->breadcrumbs = intel_breadcrumbs_create(NULL); engine->breadcrumbs = intel_breadcrumbs_create(NULL);
if (!engine->breadcrumbs) if (!engine->breadcrumbs)
return -ENOMEM; goto err_schedule;
ce = create_kernel_context(engine); ce = create_kernel_context(engine);
if (IS_ERR(ce)) if (IS_ERR(ce))
...@@ -366,6 +371,8 @@ int mock_engine_init(struct intel_engine_cs *engine) ...@@ -366,6 +371,8 @@ int mock_engine_init(struct intel_engine_cs *engine)
err_breadcrumbs: err_breadcrumbs:
intel_breadcrumbs_free(engine->breadcrumbs); intel_breadcrumbs_free(engine->breadcrumbs);
err_schedule:
i915_sched_engine_put(engine->sched_engine);
return -ENOMEM; return -ENOMEM;
} }
......
...@@ -182,6 +182,7 @@ static void schedule_out(struct i915_request *rq) ...@@ -182,6 +182,7 @@ static void schedule_out(struct i915_request *rq)
static void __guc_dequeue(struct intel_engine_cs *engine) static void __guc_dequeue(struct intel_engine_cs *engine)
{ {
struct intel_engine_execlists * const execlists = &engine->execlists; struct intel_engine_execlists * const execlists = &engine->execlists;
struct i915_sched_engine * const sched_engine = engine->sched_engine;
struct i915_request **first = execlists->inflight; struct i915_request **first = execlists->inflight;
struct i915_request ** const last_port = first + execlists->port_mask; struct i915_request ** const last_port = first + execlists->port_mask;
struct i915_request *last = first[0]; struct i915_request *last = first[0];
...@@ -204,7 +205,7 @@ static void __guc_dequeue(struct intel_engine_cs *engine) ...@@ -204,7 +205,7 @@ static void __guc_dequeue(struct intel_engine_cs *engine)
* event. * event.
*/ */
port = first; port = first;
while ((rb = rb_first_cached(&execlists->queue))) { while ((rb = rb_first_cached(&sched_engine->queue))) {
struct i915_priolist *p = to_priolist(rb); struct i915_priolist *p = to_priolist(rb);
struct i915_request *rq, *rn; struct i915_request *rq, *rn;
...@@ -224,11 +225,11 @@ static void __guc_dequeue(struct intel_engine_cs *engine) ...@@ -224,11 +225,11 @@ static void __guc_dequeue(struct intel_engine_cs *engine)
last = rq; last = rq;
} }
rb_erase_cached(&p->node, &execlists->queue); rb_erase_cached(&p->node, &sched_engine->queue);
i915_priolist_free(p); i915_priolist_free(p);
} }
done: done:
execlists->queue_priority_hint = sched_engine->queue_priority_hint =
rb ? to_priolist(rb)->priority : INT_MIN; rb ? to_priolist(rb)->priority : INT_MIN;
if (submit) { if (submit) {
*port = schedule_in(last, port - execlists->inflight); *port = schedule_in(last, port - execlists->inflight);
...@@ -338,7 +339,7 @@ static void guc_reset_rewind(struct intel_engine_cs *engine, bool stalled) ...@@ -338,7 +339,7 @@ static void guc_reset_rewind(struct intel_engine_cs *engine, bool stalled)
static void guc_reset_cancel(struct intel_engine_cs *engine) static void guc_reset_cancel(struct intel_engine_cs *engine)
{ {
struct intel_engine_execlists * const execlists = &engine->execlists; struct i915_sched_engine * const sched_engine = engine->sched_engine;
struct i915_request *rq, *rn; struct i915_request *rq, *rn;
struct rb_node *rb; struct rb_node *rb;
unsigned long flags; unsigned long flags;
...@@ -368,7 +369,7 @@ static void guc_reset_cancel(struct intel_engine_cs *engine) ...@@ -368,7 +369,7 @@ static void guc_reset_cancel(struct intel_engine_cs *engine)
} }
/* Flush the queued requests to the timeline list (for retiring). */ /* Flush the queued requests to the timeline list (for retiring). */
while ((rb = rb_first_cached(&execlists->queue))) { while ((rb = rb_first_cached(&sched_engine->queue))) {
struct i915_priolist *p = to_priolist(rb); struct i915_priolist *p = to_priolist(rb);
priolist_for_each_request_consume(rq, rn, p) { priolist_for_each_request_consume(rq, rn, p) {
...@@ -378,14 +379,14 @@ static void guc_reset_cancel(struct intel_engine_cs *engine) ...@@ -378,14 +379,14 @@ static void guc_reset_cancel(struct intel_engine_cs *engine)
i915_request_mark_complete(rq); i915_request_mark_complete(rq);
} }
rb_erase_cached(&p->node, &execlists->queue); rb_erase_cached(&p->node, &sched_engine->queue);
i915_priolist_free(p); i915_priolist_free(p);
} }
/* Remaining _unready_ requests will be nop'ed when submitted */ /* Remaining _unready_ requests will be nop'ed when submitted */
execlists->queue_priority_hint = INT_MIN; sched_engine->queue_priority_hint = INT_MIN;
execlists->queue = RB_ROOT_CACHED; sched_engine->queue = RB_ROOT_CACHED;
spin_unlock_irqrestore(&engine->active.lock, flags); spin_unlock_irqrestore(&engine->active.lock, flags);
} }
...@@ -514,7 +515,7 @@ static void guc_submit_request(struct i915_request *rq) ...@@ -514,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->execlists.queue.rb_root)); GEM_BUG_ON(RB_EMPTY_ROOT(&engine->sched_engine->queue.rb_root));
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);
......
...@@ -40,7 +40,7 @@ static inline struct i915_priolist *to_priolist(struct rb_node *rb) ...@@ -40,7 +40,7 @@ static inline struct i915_priolist *to_priolist(struct rb_node *rb)
return rb_entry(rb, struct i915_priolist, node); return rb_entry(rb, struct i915_priolist, node);
} }
static void assert_priolists(struct intel_engine_execlists * const execlists) static void assert_priolists(struct i915_sched_engine * const sched_engine)
{ {
struct rb_node *rb; struct rb_node *rb;
long last_prio; long last_prio;
...@@ -48,11 +48,11 @@ static void assert_priolists(struct intel_engine_execlists * const execlists) ...@@ -48,11 +48,11 @@ static void assert_priolists(struct intel_engine_execlists * const execlists)
if (!IS_ENABLED(CONFIG_DRM_I915_DEBUG_GEM)) if (!IS_ENABLED(CONFIG_DRM_I915_DEBUG_GEM))
return; return;
GEM_BUG_ON(rb_first_cached(&execlists->queue) != GEM_BUG_ON(rb_first_cached(&sched_engine->queue) !=
rb_first(&execlists->queue.rb_root)); rb_first(&sched_engine->queue.rb_root));
last_prio = INT_MAX; last_prio = INT_MAX;
for (rb = rb_first_cached(&execlists->queue); rb; rb = rb_next(rb)) { for (rb = rb_first_cached(&sched_engine->queue); rb; rb = rb_next(rb)) {
const struct i915_priolist *p = to_priolist(rb); const struct i915_priolist *p = to_priolist(rb);
GEM_BUG_ON(p->priority > last_prio); GEM_BUG_ON(p->priority > last_prio);
...@@ -63,21 +63,21 @@ static void assert_priolists(struct intel_engine_execlists * const execlists) ...@@ -63,21 +63,21 @@ static void assert_priolists(struct intel_engine_execlists * const execlists)
struct list_head * struct list_head *
i915_sched_lookup_priolist(struct intel_engine_cs *engine, int prio) i915_sched_lookup_priolist(struct intel_engine_cs *engine, int prio)
{ {
struct intel_engine_execlists * const execlists = &engine->execlists; struct i915_sched_engine * const sched_engine = engine->sched_engine;
struct i915_priolist *p; struct i915_priolist *p;
struct rb_node **parent, *rb; struct rb_node **parent, *rb;
bool first = true; bool first = true;
lockdep_assert_held(&engine->active.lock); lockdep_assert_held(&engine->active.lock);
assert_priolists(execlists); assert_priolists(sched_engine);
if (unlikely(execlists->no_priolist)) if (unlikely(sched_engine->no_priolist))
prio = I915_PRIORITY_NORMAL; prio = I915_PRIORITY_NORMAL;
find_priolist: find_priolist:
/* most positive priority is scheduled first, equal priorities fifo */ /* most positive priority is scheduled first, equal priorities fifo */
rb = NULL; rb = NULL;
parent = &execlists->queue.rb_root.rb_node; parent = &sched_engine->queue.rb_root.rb_node;
while (*parent) { while (*parent) {
rb = *parent; rb = *parent;
p = to_priolist(rb); p = to_priolist(rb);
...@@ -92,7 +92,7 @@ i915_sched_lookup_priolist(struct intel_engine_cs *engine, int prio) ...@@ -92,7 +92,7 @@ i915_sched_lookup_priolist(struct intel_engine_cs *engine, int prio)
} }
if (prio == I915_PRIORITY_NORMAL) { if (prio == I915_PRIORITY_NORMAL) {
p = &execlists->default_priolist; p = &sched_engine->default_priolist;
} else { } else {
p = kmem_cache_alloc(global.slab_priorities, GFP_ATOMIC); p = kmem_cache_alloc(global.slab_priorities, GFP_ATOMIC);
/* Convert an allocation failure to a priority bump */ /* Convert an allocation failure to a priority bump */
...@@ -107,7 +107,7 @@ i915_sched_lookup_priolist(struct intel_engine_cs *engine, int prio) ...@@ -107,7 +107,7 @@ i915_sched_lookup_priolist(struct intel_engine_cs *engine, int prio)
* requests, so if userspace lied about their * requests, so if userspace lied about their
* dependencies that reordering may be visible. * dependencies that reordering may be visible.
*/ */
execlists->no_priolist = true; sched_engine->no_priolist = true;
goto find_priolist; goto find_priolist;
} }
} }
...@@ -116,7 +116,7 @@ i915_sched_lookup_priolist(struct intel_engine_cs *engine, int prio) ...@@ -116,7 +116,7 @@ i915_sched_lookup_priolist(struct intel_engine_cs *engine, int prio)
INIT_LIST_HEAD(&p->requests); INIT_LIST_HEAD(&p->requests);
rb_link_node(&p->node, rb, parent); rb_link_node(&p->node, rb, parent);
rb_insert_color_cached(&p->node, &execlists->queue, first); rb_insert_color_cached(&p->node, &sched_engine->queue, first);
return &p->requests; return &p->requests;
} }
...@@ -184,7 +184,7 @@ static void kick_submission(struct intel_engine_cs *engine, ...@@ -184,7 +184,7 @@ static void kick_submission(struct intel_engine_cs *engine,
* We only need to kick the tasklet once for the high priority * We only need to kick the tasklet once for the high priority
* new context we add into the queue. * new context we add into the queue.
*/ */
if (prio <= engine->execlists.queue_priority_hint) if (prio <= engine->sched_engine->queue_priority_hint)
return; return;
rcu_read_lock(); rcu_read_lock();
...@@ -208,7 +208,7 @@ static void kick_submission(struct intel_engine_cs *engine, ...@@ -208,7 +208,7 @@ static void kick_submission(struct intel_engine_cs *engine,
inflight->fence.context, inflight->fence.seqno, inflight->fence.context, inflight->fence.seqno,
inflight->sched.attr.priority); inflight->sched.attr.priority);
engine->execlists.queue_priority_hint = prio; engine->sched_engine->queue_priority_hint = prio;
if (need_preempt(prio, rq_prio(inflight))) if (need_preempt(prio, rq_prio(inflight)))
tasklet_hi_schedule(&engine->execlists.tasklet); tasklet_hi_schedule(&engine->execlists.tasklet);
...@@ -489,6 +489,33 @@ void i915_request_show_with_schedule(struct drm_printer *m, ...@@ -489,6 +489,33 @@ void i915_request_show_with_schedule(struct drm_printer *m,
rcu_read_unlock(); rcu_read_unlock();
} }
void i915_sched_engine_free(struct kref *kref)
{
struct i915_sched_engine *sched_engine =
container_of(kref, typeof(*sched_engine), ref);
kfree(sched_engine);
}
struct i915_sched_engine *
i915_sched_engine_create(unsigned int subclass)
{
struct i915_sched_engine *sched_engine;
sched_engine = kzalloc(sizeof(*sched_engine), GFP_KERNEL);
if (!sched_engine)
return NULL;
kref_init(&sched_engine->ref);
sched_engine->queue = RB_ROOT_CACHED;
sched_engine->queue_priority_hint = INT_MIN;
/* subclass is used in a follow up patch */
return sched_engine;
}
static void i915_global_scheduler_shrink(void) static void i915_global_scheduler_shrink(void)
{ {
kmem_cache_shrink(global.slab_dependencies); kmem_cache_shrink(global.slab_dependencies);
......
...@@ -48,6 +48,24 @@ static inline void i915_priolist_free(struct i915_priolist *p) ...@@ -48,6 +48,24 @@ static inline void i915_priolist_free(struct i915_priolist *p)
__i915_priolist_free(p); __i915_priolist_free(p);
} }
struct i915_sched_engine *
i915_sched_engine_create(unsigned int subclass);
void i915_sched_engine_free(struct kref *kref);
static inline struct i915_sched_engine *
i915_sched_engine_get(struct i915_sched_engine *sched_engine)
{
kref_get(&sched_engine->ref);
return sched_engine;
}
static inline void
i915_sched_engine_put(struct i915_sched_engine *sched_engine)
{
kref_put(&sched_engine->ref, i915_sched_engine_free);
}
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,
......
...@@ -91,4 +91,51 @@ struct i915_dependency { ...@@ -91,4 +91,51 @@ struct i915_dependency {
&(rq__)->sched.signalers_list, \ &(rq__)->sched.signalers_list, \
signal_link) signal_link)
/**
* struct i915_sched_engine - scheduler engine
*
* A schedule engine represents a submission queue with different priority
* bands. It contains all the common state (relative to the backend) to queue,
* track, and submit a request.
*
* This object at the moment is quite i915 specific but will transition into a
* container for the drm_gpu_scheduler plus a few other variables once the i915
* is integrated with the DRM scheduler.
*/
struct i915_sched_engine {
/**
* @ref: reference count of schedule engine object
*/
struct kref ref;
/**
* @default_priolist: priority list for I915_PRIORITY_NORMAL
*/
struct i915_priolist default_priolist;
/**
* @queue_priority_hint: Highest pending priority.
*
* When we add requests into the queue, or adjust the priority of
* executing requests, we compute the maximum priority of those
* pending requests. We can then use this value to determine if
* we need to preempt the executing requests to service the queue.
* However, since the we may have recorded the priority of an inflight
* request we wanted to preempt but since completed, at the time of
* dequeuing the priority hint may no longer may match the highest
* available request priority.
*/
int queue_priority_hint;
/**
* @queue: queue of requests, in priority lists
*/
struct rb_root_cached queue;
/**
* @no_priolist: priority lists disabled
*/
bool no_priolist;
};
#endif /* _I915_SCHEDULER_TYPES_H_ */ #endif /* _I915_SCHEDULER_TYPES_H_ */
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