summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/i915/i915_drv.h
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2016-12-18 18:37:21 +0300
committerChris Wilson <chris@chris-wilson.co.uk>2016-12-18 19:18:53 +0300
commit69df05e11ab8c10e57bb5aaaa3e6d3d1b251b333 (patch)
tree3379ae73970f6d9f492db95994179a8f3e6b356f /drivers/gpu/drm/i915/i915_drv.h
parente8a9c58fcd9a5081f71f57f370af1347ed6a310b (diff)
downloadlinux-69df05e11ab8c10e57bb5aaaa3e6d3d1b251b333.tar.xz
drm/i915: Simplify releasing context reference
A few users only take the struct_mutex in order to release a reference to a context. We can expose a kref_put_mutex() wrapper in order to simplify these users, and optimise taking of the mutex to the final unref. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Link: http://patchwork.freedesktop.org/patch/msgid/20161218153724.8439-4-chris@chris-wilson.co.uk
Diffstat (limited to 'drivers/gpu/drm/i915/i915_drv.h')
-rw-r--r--drivers/gpu/drm/i915/i915_drv.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index c89b012af914..202a6ac51c05 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -3518,6 +3518,13 @@ static inline void i915_gem_context_put(struct i915_gem_context *ctx)
kref_put(&ctx->ref, i915_gem_context_free);
}
+static inline void i915_gem_context_put_unlocked(struct i915_gem_context *ctx)
+{
+ kref_put_mutex(&ctx->ref,
+ i915_gem_context_free,
+ &ctx->i915->drm.struct_mutex);
+}
+
static inline struct intel_timeline *
i915_gem_context_lookup_timeline(struct i915_gem_context *ctx,
struct intel_engine_cs *engine)