[Intel-gfx] [PATCH 40/55] drm/i915: Refactor blocking waits

Chris Wilson chris at chris-wilson.co.uk
Wed Jul 27 07:04:41 UTC 2016


On Wed, Jul 27, 2016 at 09:04:03AM +0300, Joonas Lahtinen wrote:
> On ma, 2016-07-25 at 18:32 +0100, Chris Wilson wrote:
> > Tidy up the for loops that handle waiting for read/write vs read-only
> > access.
> > 
> > Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> > ---
> >  drivers/gpu/drm/i915/i915_gem.c | 158 +++++++++++++++++++---------------------
> >  1 file changed, 75 insertions(+), 83 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> > index 3f6b69dcaccb..2d86a0c3f295 100644
> > --- a/drivers/gpu/drm/i915/i915_gem.c
> > +++ b/drivers/gpu/drm/i915/i915_gem.c
> > @@ -1339,6 +1339,23 @@ put_rpm:
> >  	return ret;
> >  }
> >  
> > +static void
> > +i915_gem_object_retire_request(struct drm_i915_gem_object *obj,
> > +			       struct drm_i915_gem_request *req)
> > +{
> > +	int idx = req->engine->id;
> > +
> > +	if (i915_gem_active_peek(&obj->last_read[idx],
> > +				 &obj->base.dev->struct_mutex) == req)
> > +		i915_gem_object_retire__read(obj, idx);
> > +	else if (i915_gem_active_peek(&obj->last_write,
> > +				      &obj->base.dev->struct_mutex) == req)
> > +		i915_gem_object_retire__write(obj);
> 
> If these functions will use same mutex (be it different than
> struct_mutex) in all invocations, I'd make an alias for it.

Why? It is written like this to prevent the compiler doing anything when
not debugging.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx mailing list