aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/intel_context.h
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2019-03-18 21:23:47 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2019-03-19 08:21:13 +0000
commit4c5896dc4c671cc46035c40b2d80bf4f4ed1598e (patch)
treee4ad6b6fbcaa07ca80c961fcf1e43fae65fcec17 /drivers/gpu/drm/i915/intel_context.h
parentdrm/i915: Lock the gem_context->active_list while dropping the link (diff)
downloadlinux-dev-4c5896dc4c671cc46035c40b2d80bf4f4ed1598e.tar.xz
linux-dev-4c5896dc4c671cc46035c40b2d80bf4f4ed1598e.zip
drm/i915: Hold a reference to the active HW context
For virtual engines, we need to keep the HW context alive while it remains in use. For regular HW contexts, they are created and kept alive until the end of the GEM context. For simplicity, generalise the requirements and keep an active reference to each HW context. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20190318212347.30146-2-chris@chris-wilson.co.uk
Diffstat (limited to 'drivers/gpu/drm/i915/intel_context.h')
-rw-r--r--drivers/gpu/drm/i915/intel_context.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/gpu/drm/i915/intel_context.h b/drivers/gpu/drm/i915/intel_context.h
index 9546d932406a..ebc861b1a49e 100644
--- a/drivers/gpu/drm/i915/intel_context.h
+++ b/drivers/gpu/drm/i915/intel_context.h
@@ -73,4 +73,15 @@ static inline void __intel_context_pin(struct intel_context *ce)
void intel_context_unpin(struct intel_context *ce);
+static inline struct intel_context *intel_context_get(struct intel_context *ce)
+{
+ kref_get(&ce->ref);
+ return ce;
+}
+
+static inline void intel_context_put(struct intel_context *ce)
+{
+ kref_put(&ce->ref, ce->ops->destroy);
+}
+
#endif /* __INTEL_CONTEXT_H__ */