Commit 27466222 authored by Matthew Brost's avatar Matthew Brost Committed by John Harrison

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: default avatarMatthew Brost <matthew.brost@intel.com>
Reviewed-by: default avatarJohn Harrison <John.C.Harrison@Intel.com>
Signed-off-by: default avatarJohn Harrison <John.C.Harrison@Intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210727002348.97202-7-matthew.brost@intel.com
parent a95d1160
...@@ -431,7 +431,7 @@ void i915_request_show_with_schedule(struct drm_printer *m, ...@@ -431,7 +431,7 @@ void i915_request_show_with_schedule(struct drm_printer *m,
rcu_read_unlock(); rcu_read_unlock();
} }
void i915_sched_engine_free(struct kref *kref) static void default_destroy(struct kref *kref)
{ {
struct i915_sched_engine *sched_engine = struct i915_sched_engine *sched_engine =
container_of(kref, typeof(*sched_engine), ref); container_of(kref, typeof(*sched_engine), ref);
...@@ -453,6 +453,7 @@ i915_sched_engine_create(unsigned int subclass) ...@@ -453,6 +453,7 @@ i915_sched_engine_create(unsigned int subclass)
sched_engine->queue = RB_ROOT_CACHED; sched_engine->queue = RB_ROOT_CACHED;
sched_engine->queue_priority_hint = INT_MIN; sched_engine->queue_priority_hint = INT_MIN;
sched_engine->destroy = default_destroy;
INIT_LIST_HEAD(&sched_engine->requests); INIT_LIST_HEAD(&sched_engine->requests);
INIT_LIST_HEAD(&sched_engine->hold); INIT_LIST_HEAD(&sched_engine->hold);
......
...@@ -51,8 +51,6 @@ static inline void i915_priolist_free(struct i915_priolist *p) ...@@ -51,8 +51,6 @@ static inline void i915_priolist_free(struct i915_priolist *p)
struct i915_sched_engine * struct i915_sched_engine *
i915_sched_engine_create(unsigned int subclass); i915_sched_engine_create(unsigned int subclass);
void i915_sched_engine_free(struct kref *kref);
static inline struct i915_sched_engine * static inline struct i915_sched_engine *
i915_sched_engine_get(struct i915_sched_engine *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) ...@@ -63,7 +61,7 @@ i915_sched_engine_get(struct i915_sched_engine *sched_engine)
static inline void static inline void
i915_sched_engine_put(struct i915_sched_engine *sched_engine) 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 static inline bool
......
...@@ -163,6 +163,11 @@ struct i915_sched_engine { ...@@ -163,6 +163,11 @@ struct i915_sched_engine {
*/ */
void *private_data; 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 * @kick_backend: kick backend after a request's priority has changed
*/ */
......
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