[Intel-gfx] [PATCH] drm/i915/display: Apply interactive priority to explicit flip fences

Chris Wilson chris at chris-wilson.co.uk
Tue Jan 19 16:53:00 UTC 2021


Quoting Ville Syrjälä (2021-01-19 16:42:36)
> On Mon, Jan 18, 2021 at 11:59:29AM +0000, Chris Wilson wrote:
> > +void i915_gem_fence_wait_priority(struct dma_fence *fence,
> > +                               const struct i915_sched_attr *attr)
> > +{
> > +     if (dma_fence_is_signaled(fence))
> > +             return;
> > +
> > +     local_bh_disable();
> > +
> >       /* Recurse once into a fence-array */
> >       if (dma_fence_is_array(fence)) {
> >               struct dma_fence_array *array = to_dma_fence_array(fence);
> >               int i;
> >  
> >               for (i = 0; i < array->num_fences; i++)
> > -                     __fence_set_priority(array->fences[i], attr);
> > +                     fence_set_priority(array->fences[i], attr);
> > +     } else if (__dma_fence_is_chain(fence)) {
> > +             struct dma_fence *iter;
> > +
> > +             dma_fence_chain_for_each(iter, fence) {
> > +                     if (!fence_set_priority(to_dma_fence_chain(iter)->fence,
> > +                                             attr))
> > +                             break;
> 
> Does this mean the fence chain is ordered in some way, ie. the
> rest of the fences in the chain will have been signalled already?
> I couldn't find any description of what a fence chain really is
> anywhere.

Yes, a fence chain is a timeline constructed by fences. It is assumed
the individual fences are in order but that's not strictly enforced,
except that the chain is broken between different fence contexts.

For our purpose, we really just need to find the last i915_request as
once we apply the priority boost to that one, everything earlier will be
boosted by priority inheritance. We keep chasing the chain as extra
boosts will be redundant and skipped. So for simplicity, I opted to bump
the chain rather than work out if the boosts are no longer needed. Or we
could just stop after the first and expect it to work as well as we can
expect.
-Chris


More information about the Intel-gfx mailing list