diff mbox series

[v2,03/12] drm/i915: Update connector atomic state before crtc sanitize-disabling

Message ID 20230503231048.432368-4-imre.deak@intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915/tc: Add a workaround for an IOM/TCSS firmware hang issue | expand

Commit Message

Imre Deak May 3, 2023, 11:10 p.m. UTC
During HW state readout/sanitization an up-to-date connector atomic
state will be required by a follow-up patch, which can disable CRTCs
with an encoder (and calling the correct encoder hooks happens via the
connector atomic state encoder pointer). So update the connector state
already before the CRTC sanitize/disable step. For now this doesn't make
a difference, since intel_modeset_update_connector_atomic_state() will
update/enable the atomic state only for connectors that have an enabled
encoder/CRTC. Such CRTCs/encoders will not be affected by
intel_sanitize_crtc().

v2: Add comment about why the connector state needs to be up-to-date.

Signed-off-by: Imre Deak <imre.deak@intel.com>
---
 drivers/gpu/drm/i915/display/intel_modeset_setup.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

Ville Syrjälä May 4, 2023, 2:42 p.m. UTC | #1
On Thu, May 04, 2023 at 02:10:39AM +0300, Imre Deak wrote:
> During HW state readout/sanitization an up-to-date connector atomic
> state will be required by a follow-up patch, which can disable CRTCs
> with an encoder (and calling the correct encoder hooks happens via the
> connector atomic state encoder pointer). So update the connector state
> already before the CRTC sanitize/disable step. For now this doesn't make
> a difference, since intel_modeset_update_connector_atomic_state() will
> update/enable the atomic state only for connectors that have an enabled
> encoder/CRTC. Such CRTCs/encoders will not be affected by
> intel_sanitize_crtc().
> 
> v2: Add comment about why the connector state needs to be up-to-date.
> 
> Signed-off-by: Imre Deak <imre.deak@intel.com>

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

> ---
>  drivers/gpu/drm/i915/display/intel_modeset_setup.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_modeset_setup.c b/drivers/gpu/drm/i915/display/intel_modeset_setup.c
> index 2ca66e49d8863..c1a4a7bcc56ae 100644
> --- a/drivers/gpu/drm/i915/display/intel_modeset_setup.c
> +++ b/drivers/gpu/drm/i915/display/intel_modeset_setup.c
> @@ -701,6 +701,12 @@ void intel_modeset_setup_hw_state(struct drm_i915_private *i915,
>  	for_each_intel_encoder(&i915->drm, encoder)
>  		intel_sanitize_encoder(encoder);
>  
> +	/*
> +	 * Sanitizing CRTCs needs their connector atomic state to be
> +	 * up-to-date, so ensure that already here.
> +	 */
> +	intel_modeset_update_connector_atomic_state(i915);
> +
>  	for_each_intel_crtc(&i915->drm, crtc) {
>  		struct intel_crtc_state *crtc_state =
>  			to_intel_crtc_state(crtc->base.state);
> @@ -709,8 +715,6 @@ void intel_modeset_setup_hw_state(struct drm_i915_private *i915,
>  		intel_crtc_state_dump(crtc_state, NULL, "setup_hw_state");
>  	}
>  
> -	intel_modeset_update_connector_atomic_state(i915);
> -
>  	intel_dpll_sanitize_state(i915);
>  
>  	intel_wm_get_hw_state(i915);
> -- 
> 2.37.2
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_modeset_setup.c b/drivers/gpu/drm/i915/display/intel_modeset_setup.c
index 2ca66e49d8863..c1a4a7bcc56ae 100644
--- a/drivers/gpu/drm/i915/display/intel_modeset_setup.c
+++ b/drivers/gpu/drm/i915/display/intel_modeset_setup.c
@@ -701,6 +701,12 @@  void intel_modeset_setup_hw_state(struct drm_i915_private *i915,
 	for_each_intel_encoder(&i915->drm, encoder)
 		intel_sanitize_encoder(encoder);
 
+	/*
+	 * Sanitizing CRTCs needs their connector atomic state to be
+	 * up-to-date, so ensure that already here.
+	 */
+	intel_modeset_update_connector_atomic_state(i915);
+
 	for_each_intel_crtc(&i915->drm, crtc) {
 		struct intel_crtc_state *crtc_state =
 			to_intel_crtc_state(crtc->base.state);
@@ -709,8 +715,6 @@  void intel_modeset_setup_hw_state(struct drm_i915_private *i915,
 		intel_crtc_state_dump(crtc_state, NULL, "setup_hw_state");
 	}
 
-	intel_modeset_update_connector_atomic_state(i915);
-
 	intel_dpll_sanitize_state(i915);
 
 	intel_wm_get_hw_state(i915);