drm/i915: Add i915_sched_engine destroy vfunc

This is required to allow backend specific cleanup

v2:
 (John H)
  - Rework commit message

Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: John Harrison <John.C.Harrison@Intel.com>
Signed-off-by: John Harrison <John.C.Harrison@Intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210727002348.97202-7-matthew.brost@intel.com
This commit is contained in:
Matthew Brost 2021-07-26 17:23:21 -07:00 committed by John Harrison
parent a95d116098
commit 27466222ab
3 changed files with 8 additions and 4 deletions

View File

@ -431,7 +431,7 @@ void i915_request_show_with_schedule(struct drm_printer *m,
rcu_read_unlock();
}
void i915_sched_engine_free(struct kref *kref)
static void default_destroy(struct kref *kref)
{
struct i915_sched_engine *sched_engine =
container_of(kref, typeof(*sched_engine), ref);
@ -453,6 +453,7 @@ i915_sched_engine_create(unsigned int subclass)
sched_engine->queue = RB_ROOT_CACHED;
sched_engine->queue_priority_hint = INT_MIN;
sched_engine->destroy = default_destroy;
INIT_LIST_HEAD(&sched_engine->requests);
INIT_LIST_HEAD(&sched_engine->hold);

View File

@ -51,8 +51,6 @@ static inline void i915_priolist_free(struct i915_priolist *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)
{
@ -63,7 +61,7 @@ i915_sched_engine_get(struct i915_sched_engine *sched_engine)
static inline void
i915_sched_engine_put(struct i915_sched_engine *sched_engine)
{
kref_put(&sched_engine->ref, i915_sched_engine_free);
kref_put(&sched_engine->ref, sched_engine->destroy);
}
static inline bool

View File

@ -163,6 +163,11 @@ struct i915_sched_engine {
*/
void *private_data;
/**
* @destroy: destroy schedule engine / cleanup in backend
*/
void (*destroy)(struct kref *kref);
/**
* @kick_backend: kick backend after a request's priority has changed
*/