[3/5] drm/i915: Prefer to use the pipe to index the ddb entries
diff mbox series

Message ID 20200115190813.17971-3-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>

Let's use the pipe rather than the silly 'i' iterator from
for_each_oldnew_intel_crtc_in_state() for indexing the ddb
entries array. Maybe one day we can assume c99 and hide the
'i' entirely from sight.

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

Comments

José Roberto de Souza Jan. 16, 2020, 12:19 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>
> 
> Let's use the pipe rather than the silly 'i' iterator from
> for_each_oldnew_intel_crtc_in_state() for indexing the ddb
> entries array. Maybe one day we can assume c99 and hide the
> 'i' entirely from sight.
> 

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 | 20 +++++++++++-------
> --
>  1 file changed, 11 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c
> b/drivers/gpu/drm/i915/display/intel_display.c
> index e68af024e13c..64a377d61ce0 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -15106,15 +15106,17 @@ static void
> skl_commit_modeset_enables(struct intel_atomic_state *state)
>  	int i;
>  
>  	for_each_oldnew_intel_crtc_in_state(state, crtc,
> old_crtc_state, new_crtc_state, i) {
> +		enum pipe pipe = crtc->pipe;
> +
>  		if (!new_crtc_state->hw.active)
>  			continue;
>  
>  		/* ignore allocations for crtc's that have been turned
> off. */
>  		if (!needs_modeset(new_crtc_state)) {
> -			entries[i] = old_crtc_state->wm.skl.ddb;
> -			update_pipes |= BIT(crtc->pipe);
> +			entries[pipe] = old_crtc_state->wm.skl.ddb;
> +			update_pipes |= BIT(pipe);
>  		} else {
> -			modeset_pipes |= BIT(crtc->pipe);
> +			modeset_pipes |= BIT(pipe);
>  		}
>  	}
>  
> @@ -15140,10 +15142,10 @@ static void
> skl_commit_modeset_enables(struct intel_atomic_state *state)
>  				continue;
>  
>  			if
> (skl_ddb_allocation_overlaps(&new_crtc_state->wm.skl.ddb,
> -							entries,
> num_pipes, i))
> +							entries,
> num_pipes, pipe))
>  				continue;
>  
> -			entries[i] = new_crtc_state->wm.skl.ddb;
> +			entries[pipe] = new_crtc_state->wm.skl.ddb;
>  			update_pipes &= ~BIT(pipe);
>  
>  			intel_update_crtc(crtc, state, old_crtc_state,
> @@ -15178,9 +15180,9 @@ static void skl_commit_modeset_enables(struct
> intel_atomic_state *state)
>  			continue;
>  
>  		WARN_ON(skl_ddb_allocation_overlaps(&new_crtc_state-
> >wm.skl.ddb,
> -						    entries, num_pipes,
> i));
> +						    entries, num_pipes,
> pipe));
>  
> -		entries[i] = new_crtc_state->wm.skl.ddb;
> +		entries[pipe] = new_crtc_state->wm.skl.ddb;
>  		modeset_pipes &= ~BIT(pipe);
>  
>  		if (is_trans_port_sync_mode(new_crtc_state)) {
> @@ -15213,9 +15215,9 @@ static void skl_commit_modeset_enables(struct
> intel_atomic_state *state)
>  			continue;
>  
>  		WARN_ON(skl_ddb_allocation_overlaps(&new_crtc_state-
> >wm.skl.ddb,
> -						    entries, num_pipes,
> i));
> +						    entries, num_pipes,
> pipe));
>  
> -		entries[i] = new_crtc_state->wm.skl.ddb;
> +		entries[pipe] = new_crtc_state->wm.skl.ddb;
>  		modeset_pipes &= ~BIT(pipe);
>  
>  		intel_update_crtc(crtc, state, old_crtc_state,
> new_crtc_state);

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 e68af024e13c..64a377d61ce0 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -15106,15 +15106,17 @@  static void skl_commit_modeset_enables(struct intel_atomic_state *state)
 	int i;
 
 	for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) {
+		enum pipe pipe = crtc->pipe;
+
 		if (!new_crtc_state->hw.active)
 			continue;
 
 		/* ignore allocations for crtc's that have been turned off. */
 		if (!needs_modeset(new_crtc_state)) {
-			entries[i] = old_crtc_state->wm.skl.ddb;
-			update_pipes |= BIT(crtc->pipe);
+			entries[pipe] = old_crtc_state->wm.skl.ddb;
+			update_pipes |= BIT(pipe);
 		} else {
-			modeset_pipes |= BIT(crtc->pipe);
+			modeset_pipes |= BIT(pipe);
 		}
 	}
 
@@ -15140,10 +15142,10 @@  static void skl_commit_modeset_enables(struct intel_atomic_state *state)
 				continue;
 
 			if (skl_ddb_allocation_overlaps(&new_crtc_state->wm.skl.ddb,
-							entries, num_pipes, i))
+							entries, num_pipes, pipe))
 				continue;
 
-			entries[i] = new_crtc_state->wm.skl.ddb;
+			entries[pipe] = new_crtc_state->wm.skl.ddb;
 			update_pipes &= ~BIT(pipe);
 
 			intel_update_crtc(crtc, state, old_crtc_state,
@@ -15178,9 +15180,9 @@  static void skl_commit_modeset_enables(struct intel_atomic_state *state)
 			continue;
 
 		WARN_ON(skl_ddb_allocation_overlaps(&new_crtc_state->wm.skl.ddb,
-						    entries, num_pipes, i));
+						    entries, num_pipes, pipe));
 
-		entries[i] = new_crtc_state->wm.skl.ddb;
+		entries[pipe] = new_crtc_state->wm.skl.ddb;
 		modeset_pipes &= ~BIT(pipe);
 
 		if (is_trans_port_sync_mode(new_crtc_state)) {
@@ -15213,9 +15215,9 @@  static void skl_commit_modeset_enables(struct intel_atomic_state *state)
 			continue;
 
 		WARN_ON(skl_ddb_allocation_overlaps(&new_crtc_state->wm.skl.ddb,
-						    entries, num_pipes, i));
+						    entries, num_pipes, pipe));
 
-		entries[i] = new_crtc_state->wm.skl.ddb;
+		entries[pipe] = new_crtc_state->wm.skl.ddb;
 		modeset_pipes &= ~BIT(pipe);
 
 		intel_update_crtc(crtc, state, old_crtc_state, new_crtc_state);