Re: [PATCH] drm/i915: set initialised only when init_context callback is NULL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, May 12, 2017 at 10:49:24AM +0100, Chris Wilson wrote:
> On Thu, May 11, 2017 at 06:07:42PM +0800, Chuanxiao Dong wrote:
> > initialised is fixup by the GVT shadow context as true to avoid the init
> > from the host because it cannot take the settings from the host. Add a
> > check to let host driver only overwrite it when the init callback is NULL
> 
> During execlist_context_deferred_alloc() we presumed that the context is
> uninitialised (we only just allocated the state object for it!) and
> chose to optimise away the later call to engine->init_context() if
> engine->init_context were NULL. This breaks with GVT's contexts that are
> marked as pre-initialised to avoid us annoyingly calling 
> engine->init_context(). The fix is to not override ce->initialised if it
> is already true.
> 
> > Cc: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
> > Signed-off-by: Chuanxiao Dong <chuanxiao.dong@xxxxxxxxx>
> > ---
> >  drivers/gpu/drm/i915/intel_lrc.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
> > index 319d9a8..d0e9b61 100644
> > --- a/drivers/gpu/drm/i915/intel_lrc.c
> > +++ b/drivers/gpu/drm/i915/intel_lrc.c
> > @@ -1956,7 +1956,8 @@ static int execlists_context_deferred_alloc(struct i915_gem_context *ctx,
> >  
> >  	ce->ring = ring;
> >  	ce->state = vma;
> > -	ce->initialised = engine->init_context == NULL;
> > +	if (!engine->init_context)
> > +		ce->initialised = true;
> 
> Does the compiler generate a cmov?

Test and jump, may as well just use ce->initialised |= init_context ==
NULL;
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux