[Intel-gfx] [PATCH v2] drm/i915: Add missing NULL check before calling initial_watermarks

Imre Deak imre.deak at intel.com
Mon Feb 29 21:35:44 UTC 2016


On Mon, 2016-02-29 at 13:06 -0800, Matt Roper wrote:
> On Mon, Feb 29, 2016 at 10:10:33PM +0200, Imre Deak wrote:
> > Not all platforms set this callback, so NULL check it before
> > calling it.
> > 
> > v2:
> > - Call intel_update_watermarks() on HSW+ where the callback is not
> > set.
> >   (Matt)
> > 
> > CC: Matt Roper <matthew.d.roper at intel.com>
> > Fixes: commit ed4a6a7c ("drm/i915: Add two-stage ILK-style
> > watermark programming (v11)")
> > Signed-off-by: Imre Deak <imre.deak at intel.com>
> 
> Reviewed-by: Matt Roper <matthew.d.roper at intel.com>
> 
> Technically the change in ironlake_crtc_enable() shouldn't be
> necessary
> since all platforms that use that do have atomic watermarks, but
> adding
> the check certainly doesn't hurt anything.

The callback is set only conditionally even on those platforms,
depending on whether the WM readout succeeded, so I thought it's safer
this way.

--Imre

> Matt
> 
> > ---
> >  drivers/gpu/drm/i915/intel_display.c | 8 ++++++--
> >  1 file changed, 6 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/intel_display.c
> > b/drivers/gpu/drm/i915/intel_display.c
> > index 79bf527..d4b0ad0 100644
> > --- a/drivers/gpu/drm/i915/intel_display.c
> > +++ b/drivers/gpu/drm/i915/intel_display.c
> > @@ -4957,7 +4957,8 @@ static void ironlake_crtc_enable(struct
> > drm_crtc *crtc)
> >  	 */
> >  	intel_crtc_load_lut(crtc);
> >  
> > -	dev_priv->display.initial_watermarks(intel_crtc->config);
> > +	if (dev_priv->display.initial_watermarks != NULL)
> > +		dev_priv->display.initial_watermarks(intel_crtc-
> > >config);
> >  	intel_enable_pipe(intel_crtc);
> >  
> >  	if (intel_crtc->config->has_pch_encoder)
> > @@ -5056,7 +5057,10 @@ static void haswell_crtc_enable(struct
> > drm_crtc *crtc)
> >  	if (!intel_crtc->config->has_dsi_encoder)
> >  		intel_ddi_enable_transcoder_func(crtc);
> >  
> > -	dev_priv->display.initial_watermarks(pipe_config);
> > +	if (dev_priv->display.initial_watermarks != NULL)
> > +		dev_priv->display.initial_watermarks(pipe_config);
> > +	else
> > +		intel_update_watermarks(crtc);
> >  	intel_enable_pipe(intel_crtc);
> >  
> >  	if (intel_crtc->config->has_pch_encoder)
> > -- 
> > 2.5.0
> > 
> 


More information about the Intel-gfx mailing list