[Intel-gfx] [PATCH] drm/i915: Only allocate preempt context when required

Chris Wilson chris at chris-wilson.co.uk
Tue Jan 30 19:09:41 UTC 2018


Quoting Lis, Tomasz (2018-01-30 18:47:55)
> 
> 
> On 2018-01-27 21:28, Chris Wilson wrote:
> > If we remove some hardcoded assumptions about the preempt context having
> > a fixed id, reserved from use by normal user contexts, we may only
> > allocate the i915_gem_context when required. Then the subsequent
> > decisions on using preemption reduce to having the preempt context
> > available.
> >
> > Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> > Cc: Michal Winiarski <michal.winiarski at intel.com>
> > Cc: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
> > Cc: Arkadiusz Hiler <arkadiusz.hiler at intel.com>
> > Cc: Mika Kuoppala <mika.kuoppala at intel.com>
> > Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio at intel.com>
> > ---
> >   drivers/gpu/drm/i915/i915_drv.c                  |  2 +-
> >   drivers/gpu/drm/i915/i915_gem_context.c          | 24 +++++++++---------------
> >   drivers/gpu/drm/i915/intel_engine_cs.c           |  6 +++---
> >   drivers/gpu/drm/i915/intel_guc_submission.c      | 24 +++++++++++++-----------
> >   drivers/gpu/drm/i915/intel_lrc.c                 | 15 ++++++++++-----
> >   drivers/gpu/drm/i915/intel_ringbuffer.h          |  5 +++++
> >   drivers/gpu/drm/i915/selftests/mock_gem_device.c |  6 ------
> >   7 files changed, 41 insertions(+), 41 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> > index 1ec12add34b2..a7fc87e87fcf 100644
> > --- a/drivers/gpu/drm/i915/i915_drv.c
> > +++ b/drivers/gpu/drm/i915/i915_drv.c
> > @@ -376,7 +376,7 @@ static int i915_getparam(struct drm_device *dev, void *data,
> >               if (dev_priv->engine[RCS] && dev_priv->engine[RCS]->schedule) {
> >                       value |= I915_SCHEDULER_CAP_ENABLED;
> >                       value |= I915_SCHEDULER_CAP_PRIORITY;
> > -                     if (HAS_LOGICAL_RING_PREEMPTION(dev_priv))
> > +                     if (dev_priv->preempt_context)
> >                               value |= I915_SCHEDULER_CAP_PREEMPTION;
> >               }
> >               break;
> We cannot put equality to not having preempt_context and having 
> preemption disabled. The preempt_context will not be required on 
> platforms which support preempting directly to idle.
Sure, but that is not part of the current code. As of today, disabling
the preempt-context means no preemption. And since no one has presented
code that successfully does away with the preempt context...
-Chris


More information about the Intel-gfx mailing list