[Intel-gfx] [PATCH 04/10] drm/i915: Move crtc_state to tighter scope

Manasi Navare manasi.d.navare at intel.com
Thu Nov 14 00:09:18 UTC 2019


On Tue, Nov 12, 2019 at 04:14:57PM +0200, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala at linux.intel.com>
> 
> intel_modeset_setup_hw_state() doesn't need the crtc_state at the
> top level scope. Move it to where it's needed.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>

Looks good even though it does add to the code size since we need to derive it in
3 different places and might be more in the future.
But logically makes sense to limit its scop to for loops where its needed.

Reviewed-by: Manasi Navare <manasi.d.navare at intel.com>

Manasi

> ---
>  drivers/gpu/drm/i915/display/intel_display.c | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> index 89d150b45520..e52ea9643790 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -17716,7 +17716,6 @@ intel_modeset_setup_hw_state(struct drm_device *dev,
>  			     struct drm_modeset_acquire_ctx *ctx)
>  {
>  	struct drm_i915_private *dev_priv = to_i915(dev);
> -	struct intel_crtc_state *crtc_state;
>  	struct intel_encoder *encoder;
>  	struct intel_crtc *crtc;
>  	intel_wakeref_t wakeref;
> @@ -17749,7 +17748,8 @@ intel_modeset_setup_hw_state(struct drm_device *dev,
>  	 * waits, so we need vblank interrupts restored beforehand.
>  	 */
>  	for_each_intel_crtc(&dev_priv->drm, crtc) {
> -		crtc_state = to_intel_crtc_state(crtc->base.state);
> +		struct intel_crtc_state *crtc_state =
> +			to_intel_crtc_state(crtc->base.state);
>  
>  		drm_crtc_vblank_reset(&crtc->base);
>  
> @@ -17763,7 +17763,9 @@ intel_modeset_setup_hw_state(struct drm_device *dev,
>  		intel_sanitize_encoder(encoder);
>  
>  	for_each_intel_crtc(&dev_priv->drm, crtc) {
> -		crtc_state = to_intel_crtc_state(crtc->base.state);
> +		struct intel_crtc_state *crtc_state =
> +			crtc_state = to_intel_crtc_state(crtc->base.state);
> +
>  		intel_sanitize_crtc(crtc, ctx);
>  		intel_dump_pipe_config(crtc_state, NULL, "[setup_hw_state]");
>  	}
> @@ -17796,9 +17798,10 @@ intel_modeset_setup_hw_state(struct drm_device *dev,
>  	}
>  
>  	for_each_intel_crtc(dev, crtc) {
> +		struct intel_crtc_state *crtc_state =
> +			to_intel_crtc_state(crtc->base.state);
>  		u64 put_domains;
>  
> -		crtc_state = to_intel_crtc_state(crtc->base.state);
>  		put_domains = modeset_get_crtc_power_domains(crtc_state);
>  		if (WARN_ON(put_domains))
>  			modeset_put_power_domains(dev_priv, put_domains);
> -- 
> 2.23.0
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx


More information about the Intel-gfx mailing list