[Intel-gfx] [PATCH 1/4] drm/i915: move modeset checks out of save/restore_modeset_reg

Imre Deak imre.deak at intel.com
Mon Jan 28 11:54:26 CET 2013


On Fri, 2013-01-25 at 17:53 +0100, Daniel Vetter wrote:
> That way the control flow is clearer, and it prepares the stage
> to extract these ums functions and hide them somewhere.
> 
> There's still tons of display stuff outside of these, but that
> requires more work.
> 
> Signed-off-by: Daniel Vetter <daniel.vetter at ffwll.ch>
> ---
>  drivers/gpu/drm/i915/i915_suspend.c | 38 +++++++++++++++----------------------
>  1 file changed, 15 insertions(+), 23 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_suspend.c b/drivers/gpu/drm/i915/i915_suspend.c
> index 63d4d30..2e3a8a6 100644
> --- a/drivers/gpu/drm/i915/i915_suspend.c
> +++ b/drivers/gpu/drm/i915/i915_suspend.c
> @@ -240,9 +240,6 @@ static void i915_save_modeset_reg(struct drm_device *dev)
>  	struct drm_i915_private *dev_priv = dev->dev_private;
>  	int i;
>  
> -	if (drm_core_check_feature(dev, DRIVER_MODESET))
> -		return;
> -
>  	/* Cursor state */
>  	dev_priv->regfile.saveCURACNTR = I915_READ(_CURACNTR);
>  	dev_priv->regfile.saveCURAPOS = I915_READ(_CURAPOS);
> @@ -410,8 +407,17 @@ static void i915_restore_modeset_reg(struct drm_device *dev)
>  	int dpll_b_reg, fpb0_reg, fpb1_reg;
>  	int i;
>  
> -	if (drm_core_check_feature(dev, DRIVER_MODESET))
> -		return;
> +	/* Display port ratios (must be done before clock is set) */
> +	if (SUPPORTS_INTEGRATED_DP(dev)) {
> +		I915_WRITE(_PIPEA_GMCH_DATA_M, dev_priv->regfile.savePIPEA_GMCH_DATA_M);
> +		I915_WRITE(_PIPEB_GMCH_DATA_M, dev_priv->regfile.savePIPEB_GMCH_DATA_M);
> +		I915_WRITE(_PIPEA_GMCH_DATA_N, dev_priv->regfile.savePIPEA_GMCH_DATA_N);
> +		I915_WRITE(_PIPEB_GMCH_DATA_N, dev_priv->regfile.savePIPEB_GMCH_DATA_N);
> +		I915_WRITE(_PIPEA_DP_LINK_M, dev_priv->regfile.savePIPEA_DP_LINK_M);
> +		I915_WRITE(_PIPEB_DP_LINK_M, dev_priv->regfile.savePIPEB_DP_LINK_M);
> +		I915_WRITE(_PIPEA_DP_LINK_N, dev_priv->regfile.savePIPEA_DP_LINK_N);
> +		I915_WRITE(_PIPEB_DP_LINK_N, dev_priv->regfile.savePIPEB_DP_LINK_N);
> +	}
>  
>  	/* Fences */
>  	switch (INTEL_INFO(dev)->gen) {
> @@ -624,7 +630,8 @@ static void i915_save_display(struct drm_device *dev)
>  
>  	/* This is only meaningful in non-KMS mode */
>  	/* Don't regfile.save them in KMS mode */
> -	i915_save_modeset_reg(dev);
> +	if (!drm_core_check_feature(dev, DRIVER_MODESET))
> +		i915_save_modeset_reg(dev);
>  
>  	/* LVDS state */
>  	if (HAS_PCH_SPLIT(dev)) {
> @@ -709,23 +716,8 @@ static void i915_restore_display(struct drm_device *dev)
>  	/* Display arbitration */
>  	I915_WRITE(DSPARB, dev_priv->regfile.saveDSPARB);
>  
> -	if (!drm_core_check_feature(dev, DRIVER_MODESET)) {
> -		/* Display port ratios (must be done before clock is set) */
> -		if (SUPPORTS_INTEGRATED_DP(dev)) {
> -			I915_WRITE(_PIPEA_GMCH_DATA_M, dev_priv->regfile.savePIPEA_GMCH_DATA_M);
> -			I915_WRITE(_PIPEB_GMCH_DATA_M, dev_priv->regfile.savePIPEB_GMCH_DATA_M);
> -			I915_WRITE(_PIPEA_GMCH_DATA_N, dev_priv->regfile.savePIPEA_GMCH_DATA_N);
> -			I915_WRITE(_PIPEB_GMCH_DATA_N, dev_priv->regfile.savePIPEB_GMCH_DATA_N);
> -			I915_WRITE(_PIPEA_DP_LINK_M, dev_priv->regfile.savePIPEA_DP_LINK_M);
> -			I915_WRITE(_PIPEB_DP_LINK_M, dev_priv->regfile.savePIPEB_DP_LINK_M);
> -			I915_WRITE(_PIPEA_DP_LINK_N, dev_priv->regfile.savePIPEA_DP_LINK_N);
> -			I915_WRITE(_PIPEB_DP_LINK_N, dev_priv->regfile.savePIPEB_DP_LINK_N);
> -		}
> -	}
> -
> -	/* This is only meaningful in non-KMS mode */
> -	/* Don't restore them in KMS mode */
> -	i915_restore_modeset_reg(dev);
> +	if (!drm_core_check_feature(dev, DRIVER_MODESET))
> +		i915_restore_modeset_reg(dev);

s/modeset/display/ as discussed on IRC. Also would be nice to use
format-patch -C for things like patch 2/4 in the future, as that'd make
reviewing easier imo. Otherwise on the series:

Reviewed-by: Imre Deak <imre.deak at intel.com>

>  
>  	/* LVDS state */
>  	if (INTEL_INFO(dev)->gen >= 4 && !HAS_PCH_SPLIT(dev))





More information about the Intel-gfx mailing list