diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2019-04-24 21:07:15 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2019-04-24 22:25:32 +0100 |
commit | 6eee33e87f6d1f6263162ce0874c1ef503eff041 (patch) | |
tree | 6df409ca2539ebdcac21e0d62bf661030f4ea798 /drivers/gpu/drm/i915/gt/intel_context.c | |
parent | 23c3c3d04fa7fcc60c91f1368cc5652a6774626b (diff) |
drm/i915: Introduce context->enter() and context->exit()
We wish to start segregating the power management into different control
domains, both with respect to the hardware and the user interface. The
first step is that at the lowest level flow of requests, we want to
process a context event (and not a global GEM operation). In this patch,
we introduce the context callbacks that in future patches will be
redirected to per-engine interfaces leading to global operations as
required.
The intent is that this will be guarded by the timeline->mutex, except
that retiring has not quite finished transitioning over from being
guarded by struct_mutex. So at the moment it is protected by
struct_mutex with a reminded to switch.
v2: Rename default handlers to intel_context_enter_engine.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190424200717.1686-3-chris@chris-wilson.co.uk
Diffstat (limited to 'drivers/gpu/drm/i915/gt/intel_context.c')
-rw-r--r-- | drivers/gpu/drm/i915/gt/intel_context.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/gpu/drm/i915/gt/intel_context.c b/drivers/gpu/drm/i915/gt/intel_context.c index ebd1e5919a4a..4410e20e8e13 100644 --- a/drivers/gpu/drm/i915/gt/intel_context.c +++ b/drivers/gpu/drm/i915/gt/intel_context.c @@ -266,3 +266,20 @@ int __init i915_global_context_init(void) i915_global_register(&global.base); return 0; } + +void intel_context_enter_engine(struct intel_context *ce) +{ + struct drm_i915_private *i915 = ce->gem_context->i915; + + if (!i915->gt.active_requests++) + i915_gem_unpark(i915); +} + +void intel_context_exit_engine(struct intel_context *ce) +{ + struct drm_i915_private *i915 = ce->gem_context->i915; + + GEM_BUG_ON(!i915->gt.active_requests); + if (!--i915->gt.active_requests) + i915_gem_park(i915); +} |