[2/5] drm/i915: Clear most of crtc state when disabling the crtc
diff mbox series

Message ID 20200115190813.17971-2-ville.syrjala@linux.intel.com
State New
Headers show
Series
  • [1/5] drm/i915: Fix post-fastset modeset check for port sync
Related show

Commit Message

Ville Syrjälä Jan. 15, 2020, 7:08 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Currently we don't call intel_crtc_prepare_cleared_state() for crtcs
that are going to be entirely disabled (uapi.enable==false). That
means such crtcs will leave state junk lying around in their states
and we have to sprinkle hw.enable checks all over before we can
look at the states. Let's change that a bit so that we aways do
the state clearing, even for fully disabled crtcs.

Note that we still keep some parts of the old state (see
intel_crtc_prepare_cleared_state() for the details) so probably
can't trust things 100% when hw.enable==false. But at least there's
less chance now that we end up looking at stale junk.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/display/intel_display.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

Comments

Souza, Jose Jan. 16, 2020, 12:14 a.m. UTC | #1
On Wed, 2020-01-15 at 21:08 +0200, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Currently we don't call intel_crtc_prepare_cleared_state() for crtcs
> that are going to be entirely disabled (uapi.enable==false). That
> means such crtcs will leave state junk lying around in their states
> and we have to sprinkle hw.enable checks all over before we can
> look at the states. Let's change that a bit so that we aways do
> the state clearing, even for fully disabled crtcs.
> 
> Note that we still keep some parts of the old state (see
> intel_crtc_prepare_cleared_state() for the details) so probably
> can't trust things 100% when hw.enable==false. But at least there's
> less chance now that we end up looking at stale junk.
> 

Reviewed-by: José Roberto de Souza <jose.souza@intel.com>

> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_display.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c
> b/drivers/gpu/drm/i915/display/intel_display.c
> index b397816ce253..e68af024e13c 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -14607,15 +14607,13 @@ static int intel_atomic_check(struct
> drm_device *dev,
>  			continue;
>  		}
>  
> -		if (!new_crtc_state->uapi.enable) {
> -			intel_crtc_copy_uapi_to_hw_state(new_crtc_state
> );
> -			continue;
> -		}
> -
>  		ret = intel_crtc_prepare_cleared_state(new_crtc_state);
>  		if (ret)
>  			goto fail;
>  
> +		if (!new_crtc_state->hw.enable)
> +			continue;
> +
>  		ret = intel_modeset_pipe_config(new_crtc_state);
>  		if (ret)
>  			goto fail;

Patch
diff mbox series

diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index b397816ce253..e68af024e13c 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -14607,15 +14607,13 @@  static int intel_atomic_check(struct drm_device *dev,
 			continue;
 		}
 
-		if (!new_crtc_state->uapi.enable) {
-			intel_crtc_copy_uapi_to_hw_state(new_crtc_state);
-			continue;
-		}
-
 		ret = intel_crtc_prepare_cleared_state(new_crtc_state);
 		if (ret)
 			goto fail;
 
+		if (!new_crtc_state->hw.enable)
+			continue;
+
 		ret = intel_modeset_pipe_config(new_crtc_state);
 		if (ret)
 			goto fail;