[PATCH 3/8] drm/i915/cdclk: Only compute squash waveform when necessary

Matt Roper matthew.d.roper at intel.com
Mon Mar 4 22:04:19 UTC 2024


On Mon, Mar 04, 2024 at 03:30:22PM -0300, Gustavo Sousa wrote:
> It is no use computing the squash waveform if we are not going to use
> it. Move the call to cdclk_squash_waveform() inside the block guarded by
> HAS_CDCLK_SQUASH(dev_priv).
> 
> Signed-off-by: Gustavo Sousa <gustavo.sousa at intel.com>

You could also move the 'u32 waveform' declaration from the top of the
function inside the block too to help prevent any future mistakes of
using it unitialized.

Either way,

Reviewed-by: Matt Roper <matthew.d.roper at intel.com>

> ---
>  drivers/gpu/drm/i915/display/intel_cdclk.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_cdclk.c b/drivers/gpu/drm/i915/display/intel_cdclk.c
> index bf84bf27213f..cdf3ae766f9e 100644
> --- a/drivers/gpu/drm/i915/display/intel_cdclk.c
> +++ b/drivers/gpu/drm/i915/display/intel_cdclk.c
> @@ -2023,10 +2023,11 @@ static void _bxt_set_cdclk(struct drm_i915_private *dev_priv,
>  	} else
>  		bxt_cdclk_pll_update(dev_priv, vco);
>  
> -	waveform = cdclk_squash_waveform(dev_priv, cdclk);
> +	if (HAS_CDCLK_SQUASH(dev_priv)) {
> +		waveform = cdclk_squash_waveform(dev_priv, cdclk);
>  
> -	if (HAS_CDCLK_SQUASH(dev_priv))
>  		dg2_cdclk_squash_program(dev_priv, waveform);
> +	}
>  
>  	intel_de_write(dev_priv, CDCLK_CTL, bxt_cdclk_ctl(dev_priv, cdclk_config, pipe));
>  
> -- 
> 2.44.0
> 

-- 
Matt Roper
Graphics Software Engineer
Linux GPU Platform Enablement
Intel Corporation


More information about the Intel-xe mailing list