diff mbox series

[v2,3/9] drm/i915: Disable all planes before modesetting any pipes

Message ID 20211022103304.24164-4-ville.syrjala@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915: Fix bigjoiner state readout | expand

Commit Message

Ville Syrjälä Oct. 22, 2021, 10:32 a.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Let's disable planes on all pipes affected by the modeset before
we start doing the actual modeset. This means we have less
random planes enabled during the modeset, and it also mirrors
what we already do when enabling pipes on skl+ since we enable
planes on all pipes as the very last step. As a bonus we also
nuke a bunch og bigjoiner special casing.

I've occasionally pondered about going even furher here and
doing the pre_plane_update() stuff for all pipes first, then
actually disabling the planes, and finally running the rest
of the modeset sequence. This would potentially allow
parallelizing all the extra vblank waits across multiple pipes,
and would make the plane disable even more atomic. But let's
go one step a time here.

Cc: José Roberto de Souza <jose.souza@intel.com>
Reviewed-by: Manasi Navare <manasi.d.navare@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/display/intel_display.c | 28 +++++++++-----------
 1 file changed, 13 insertions(+), 15 deletions(-)

Comments

Souza, Jose Oct. 26, 2021, 7:39 p.m. UTC | #1
On Fri, 2021-10-22 at 13:32 +0300, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Let's disable planes on all pipes affected by the modeset before
> we start doing the actual modeset. This means we have less
> random planes enabled during the modeset, and it also mirrors
> what we already do when enabling pipes on skl+ since we enable
> planes on all pipes as the very last step. As a bonus we also
> nuke a bunch og bigjoiner special casing.
> 
> I've occasionally pondered about going even furher here and
> doing the pre_plane_update() stuff for all pipes first, then
> actually disabling the planes, and finally running the rest
> of the modeset sequence. This would potentially allow
> parallelizing all the extra vblank waits across multiple pipes,
> and would make the plane disable even more atomic. But let's
> go one step a time here.
> 

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

> Cc: José Roberto de Souza <jose.souza@intel.com>
> Reviewed-by: Manasi Navare <manasi.d.navare@intel.com>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_display.c | 28 +++++++++-----------
>  1 file changed, 13 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> index 3d2a1cba78c1..1d920ba83521 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -8251,18 +8251,13 @@ static void intel_old_crtc_state_disables(struct intel_atomic_state *state,
>  
>  	drm_WARN_ON(&dev_priv->drm, old_crtc_state->bigjoiner_slave);
>  
> -	intel_crtc_disable_planes(state, crtc);
> -
>  	/*
>  	 * We still need special handling for disabling bigjoiner master
>  	 * and slaves since for slave we do not have encoder or plls
>  	 * so we dont need to disable those.
>  	 */
> -	if (old_crtc_state->bigjoiner) {
> -		intel_crtc_disable_planes(state,
> -					  old_crtc_state->bigjoiner_linked_crtc);
> +	if (old_crtc_state->bigjoiner)
>  		old_crtc_state->bigjoiner_linked_crtc->active = false;
> -	}
>  
>  	/*
>  	 * We need to disable pipe CRC before disabling the pipe,
> @@ -8288,6 +8283,18 @@ static void intel_commit_modeset_disables(struct intel_atomic_state *state)
>  	u32 handled = 0;
>  	int i;
>  
> +	for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state,
> +					    new_crtc_state, i) {
> +		if (!intel_crtc_needs_modeset(new_crtc_state))
> +			continue;
> +
> +		if (!old_crtc_state->hw.active)
> +			continue;
> +
> +		intel_pre_plane_update(state, crtc);
> +		intel_crtc_disable_planes(state, crtc);
> +	}
> +
>  	/* Only disable port sync and MST slaves */
>  	for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state,
>  					    new_crtc_state, i) {
> @@ -8306,7 +8313,6 @@ static void intel_commit_modeset_disables(struct intel_atomic_state *state)
>  		    !intel_dp_mst_is_slave_trans(old_crtc_state))
>  			continue;
>  
> -		intel_pre_plane_update(state, crtc);
>  		intel_old_crtc_state_disables(state, old_crtc_state,
>  					      new_crtc_state, crtc);
>  		handled |= BIT(crtc->pipe);
> @@ -8320,14 +8326,6 @@ static void intel_commit_modeset_disables(struct intel_atomic_state *state)
>  		    old_crtc_state->bigjoiner_slave)
>  			continue;
>  
> -		intel_pre_plane_update(state, crtc);
> -		if (old_crtc_state->bigjoiner) {
> -			struct intel_crtc *slave =
> -				old_crtc_state->bigjoiner_linked_crtc;
> -
> -			intel_pre_plane_update(state, slave);
> -		}
> -
>  		if (old_crtc_state->hw.active)
>  			intel_old_crtc_state_disables(state, old_crtc_state,
>  						      new_crtc_state, crtc);
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index 3d2a1cba78c1..1d920ba83521 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -8251,18 +8251,13 @@  static void intel_old_crtc_state_disables(struct intel_atomic_state *state,
 
 	drm_WARN_ON(&dev_priv->drm, old_crtc_state->bigjoiner_slave);
 
-	intel_crtc_disable_planes(state, crtc);
-
 	/*
 	 * We still need special handling for disabling bigjoiner master
 	 * and slaves since for slave we do not have encoder or plls
 	 * so we dont need to disable those.
 	 */
-	if (old_crtc_state->bigjoiner) {
-		intel_crtc_disable_planes(state,
-					  old_crtc_state->bigjoiner_linked_crtc);
+	if (old_crtc_state->bigjoiner)
 		old_crtc_state->bigjoiner_linked_crtc->active = false;
-	}
 
 	/*
 	 * We need to disable pipe CRC before disabling the pipe,
@@ -8288,6 +8283,18 @@  static void intel_commit_modeset_disables(struct intel_atomic_state *state)
 	u32 handled = 0;
 	int i;
 
+	for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state,
+					    new_crtc_state, i) {
+		if (!intel_crtc_needs_modeset(new_crtc_state))
+			continue;
+
+		if (!old_crtc_state->hw.active)
+			continue;
+
+		intel_pre_plane_update(state, crtc);
+		intel_crtc_disable_planes(state, crtc);
+	}
+
 	/* Only disable port sync and MST slaves */
 	for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state,
 					    new_crtc_state, i) {
@@ -8306,7 +8313,6 @@  static void intel_commit_modeset_disables(struct intel_atomic_state *state)
 		    !intel_dp_mst_is_slave_trans(old_crtc_state))
 			continue;
 
-		intel_pre_plane_update(state, crtc);
 		intel_old_crtc_state_disables(state, old_crtc_state,
 					      new_crtc_state, crtc);
 		handled |= BIT(crtc->pipe);
@@ -8320,14 +8326,6 @@  static void intel_commit_modeset_disables(struct intel_atomic_state *state)
 		    old_crtc_state->bigjoiner_slave)
 			continue;
 
-		intel_pre_plane_update(state, crtc);
-		if (old_crtc_state->bigjoiner) {
-			struct intel_crtc *slave =
-				old_crtc_state->bigjoiner_linked_crtc;
-
-			intel_pre_plane_update(state, slave);
-		}
-
 		if (old_crtc_state->hw.active)
 			intel_old_crtc_state_disables(state, old_crtc_state,
 						      new_crtc_state, crtc);