[Intel-gfx] [PATCH v3 02/10] drm/i915: Move legacy kernel context pinning to intel_ringbuffer.c

Chris Wilson chris at chris-wilson.co.uk
Thu May 26 12:27:53 UTC 2016


On Thu, May 26, 2016 at 03:04:11PM +0300, Mika Kuoppala wrote:
> > +	if (ce->state) {
> > +		i915_gem_context_reference(kctx);
> > +
> > +		/* We may need to do things with the shrinker which
> > +		 * require us to immediately switch back to the default
> > +		 * context. This can cause a problem as pinning the
> > +		 * default context also requires GTT space which may not
> > +		 * be available. To avoid this we always pin the default
> > +		 * context.
> > +		 */
> > +		ret = i915_gem_obj_ggtt_pin(ce->state,
> > +					    kctx->ggtt_alignment,
> > +					    0);
> > +		if (ret)
> > +			goto error;
> > +
> 
> If you fail here, you will unpin regardless. Is that a problem?

To be here, ce->pin_count == 1 (because it is locked and we only init if
ce->pin_count == 0 on entry). So on error we restore it back to 0.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx mailing list