[Intel-gfx] [PATCH 30/38] drm/i915: Make context pinning part of intel_context_ops

Chris Wilson chris at chris-wilson.co.uk
Tue Mar 5 18:00:49 UTC 2019


Quoting Tvrtko Ursulin (2019-03-05 17:31:23)
> 
> 
> On 01/03/2019 14:03, Chris Wilson wrote:
> > Push the intel_context pin callback down from intel_engine_cs onto the
> > context itself by virtue of having a central caller for
> > intel_context_pin() being able to lookup the intel_context itself.
> > 
> > Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> > ---
> > -static struct intel_context *
> > -execlists_context_pin(struct intel_engine_cs *engine,
> > -                   struct i915_gem_context *ctx)
> > +static int execlists_context_pin(struct intel_context *ce)
> >   {
> > -     struct intel_context *ce;
> > -
> > -     ce = intel_context_instance(ctx, engine);
> > -     if (IS_ERR(ce))
> > -             return ce;
> > -
> > -     lockdep_assert_held(&ctx->i915->drm.struct_mutex);
> > -     GEM_BUG_ON(!ctx->ppgtt);
> > -
> > -     if (likely(ce->pin_count++))
> > -             return ce;
> > -     GEM_BUG_ON(!ce->pin_count); /* no overflow please! */
> > -
> > -     return __execlists_context_pin(engine, ctx, ce);
> > +     return __execlists_context_pin(ce, ce->engine);
> >   }
> 
> Do you need this trivial wrapper for later?

Yes, it's being kept because virtual engine wants to feed a different
engine.
-Chris


More information about the Intel-gfx mailing list