Commit df8cf31e authored by Chris Wilson's avatar Chris Wilson

drm/i915/gt: Hook up intel_context_fini()

Prior to freeing the struct, call the fini function to cleanup the
common members. Currently this only calls the debug functions to mark
the structs as destroyed, but may be extended to real work in future.
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190718070024.21781-2-chris@chris-wilson.co.uk
parent f3bcb0cc
...@@ -204,6 +204,12 @@ intel_context_init(struct intel_context *ce, ...@@ -204,6 +204,12 @@ intel_context_init(struct intel_context *ce,
__intel_context_active, __intel_context_retire); __intel_context_active, __intel_context_retire);
} }
void intel_context_fini(struct intel_context *ce)
{
mutex_destroy(&ce->pin_mutex);
i915_active_fini(&ce->active);
}
static void i915_global_context_shrink(void) static void i915_global_context_shrink(void)
{ {
kmem_cache_shrink(global.slab_ce); kmem_cache_shrink(global.slab_ce);
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
void intel_context_init(struct intel_context *ce, void intel_context_init(struct intel_context *ce,
struct i915_gem_context *ctx, struct i915_gem_context *ctx,
struct intel_engine_cs *engine); struct intel_engine_cs *engine);
void intel_context_fini(struct intel_context *ce);
struct intel_context * struct intel_context *
intel_context_create(struct i915_gem_context *ctx, intel_context_create(struct i915_gem_context *ctx,
......
...@@ -1566,6 +1566,7 @@ static void execlists_context_destroy(struct kref *kref) ...@@ -1566,6 +1566,7 @@ static void execlists_context_destroy(struct kref *kref)
if (ce->state) if (ce->state)
__execlists_context_fini(ce); __execlists_context_fini(ce);
intel_context_fini(ce);
intel_context_free(ce); intel_context_free(ce);
} }
...@@ -3199,6 +3200,7 @@ static void virtual_context_destroy(struct kref *kref) ...@@ -3199,6 +3200,7 @@ static void virtual_context_destroy(struct kref *kref)
if (ve->context.state) if (ve->context.state)
__execlists_context_fini(&ve->context); __execlists_context_fini(&ve->context);
intel_context_fini(&ve->context);
kfree(ve->bonds); kfree(ve->bonds);
kfree(ve); kfree(ve);
......
...@@ -1388,6 +1388,7 @@ static void ring_context_destroy(struct kref *ref) ...@@ -1388,6 +1388,7 @@ static void ring_context_destroy(struct kref *ref)
if (ce->state) if (ce->state)
__ring_context_fini(ce); __ring_context_fini(ce);
intel_context_fini(ce);
intel_context_free(ce); intel_context_free(ce);
} }
......
...@@ -142,6 +142,7 @@ static void mock_context_destroy(struct kref *ref) ...@@ -142,6 +142,7 @@ static void mock_context_destroy(struct kref *ref)
if (ce->ring) if (ce->ring)
mock_ring_free(ce->ring); mock_ring_free(ce->ring);
intel_context_fini(ce);
intel_context_free(ce); intel_context_free(ce);
} }
......
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