diff mbox

[2/5] drm/i915: Remove I915_MAX_PIPES dependency for DDB allocation

Message ID 1505375586-23015-3-git-send-email-mika.kahola@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Mika Kahola Sept. 14, 2017, 7:53 a.m. UTC
From: "Kahola, Mika" <mika.kahola@intel.com>

Remove dependency for I915_MAX_PIPES by replacing it with
for_each_pipe() macro.

Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
Signed-off-by: Kahola, Mika <mika.kahola@intel.com>
---
 drivers/gpu/drm/i915/intel_display.c | 5 ++++-
 drivers/gpu/drm/i915/intel_drv.h     | 3 ++-
 drivers/gpu/drm/i915/intel_pm.c      | 6 ++++--
 3 files changed, 10 insertions(+), 4 deletions(-)

Comments

Ville Syrjälä Oct. 10, 2017, 9:15 a.m. UTC | #1
On Thu, Sep 14, 2017 at 10:53:03AM +0300, Mika Kahola wrote:
> From: "Kahola, Mika" <mika.kahola@intel.com>
> 
> Remove dependency for I915_MAX_PIPES by replacing it with
> for_each_pipe() macro.
> 
> Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
> Signed-off-by: Kahola, Mika <mika.kahola@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_display.c | 5 ++++-
>  drivers/gpu/drm/i915/intel_drv.h     | 3 ++-
>  drivers/gpu/drm/i915/intel_pm.c      | 6 ++++--
>  3 files changed, 10 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 8599e42..7811b65 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -12220,7 +12220,10 @@ static void skl_update_crtcs(struct drm_atomic_state *state)
>  			if (updated & cmask || !cstate->base.active)
>  				continue;
>  
> -			if (skl_ddb_allocation_overlaps(entries, &cstate->wm.skl.ddb, i))
> +			if (skl_ddb_allocation_overlaps(dev_priv,
> +							entries,
> +							&cstate->wm.skl.ddb,
> +							i))
>  				continue;
>  
>  			updated |= cmask;
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index 3078076..bb61fd7 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -1891,7 +1891,8 @@ int intel_enable_sagv(struct drm_i915_private *dev_priv);
>  int intel_disable_sagv(struct drm_i915_private *dev_priv);
>  bool skl_wm_level_equals(const struct skl_wm_level *l1,
>  			 const struct skl_wm_level *l2);
> -bool skl_ddb_allocation_overlaps(const struct skl_ddb_entry **entries,
> +bool skl_ddb_allocation_overlaps(struct drm_i915_private *dev_priv,
> +				 const struct skl_ddb_entry **entries,
>  				 const struct skl_ddb_entry *ddb,
>  				 int ignore);
>  bool ilk_disable_lp_wm(struct drm_device *dev);
> diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
> index fa9055a..7e66141 100644
> --- a/drivers/gpu/drm/i915/intel_pm.c
> +++ b/drivers/gpu/drm/i915/intel_pm.c
> @@ -4821,16 +4821,18 @@ static inline bool skl_ddb_entries_overlap(const struct skl_ddb_entry *a,
>  	return a->start < b->end && b->start < a->end;
>  }
>  
> -bool skl_ddb_allocation_overlaps(const struct skl_ddb_entry **entries,
> +bool skl_ddb_allocation_overlaps(struct drm_i915_private *dev_priv,
> +				 const struct skl_ddb_entry **entries,
>  				 const struct skl_ddb_entry *ddb,
>  				 int ignore)
>  {
>  	int i;

I would change this to 'enum pipe pipe' for a bit of extra clarity.

>  
> -	for (i = 0; i < I915_MAX_PIPES; i++)
> +	for_each_pipe(dev_priv, i) {
>  		if (i != ignore && entries[i] &&
>  		    skl_ddb_entries_overlap(ddb, entries[i]))
>  			return true;
> +	}
>  
>  	return false;
>  }
> -- 
> 2.7.4
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 8599e42..7811b65 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -12220,7 +12220,10 @@  static void skl_update_crtcs(struct drm_atomic_state *state)
 			if (updated & cmask || !cstate->base.active)
 				continue;
 
-			if (skl_ddb_allocation_overlaps(entries, &cstate->wm.skl.ddb, i))
+			if (skl_ddb_allocation_overlaps(dev_priv,
+							entries,
+							&cstate->wm.skl.ddb,
+							i))
 				continue;
 
 			updated |= cmask;
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 3078076..bb61fd7 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -1891,7 +1891,8 @@  int intel_enable_sagv(struct drm_i915_private *dev_priv);
 int intel_disable_sagv(struct drm_i915_private *dev_priv);
 bool skl_wm_level_equals(const struct skl_wm_level *l1,
 			 const struct skl_wm_level *l2);
-bool skl_ddb_allocation_overlaps(const struct skl_ddb_entry **entries,
+bool skl_ddb_allocation_overlaps(struct drm_i915_private *dev_priv,
+				 const struct skl_ddb_entry **entries,
 				 const struct skl_ddb_entry *ddb,
 				 int ignore);
 bool ilk_disable_lp_wm(struct drm_device *dev);
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index fa9055a..7e66141 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -4821,16 +4821,18 @@  static inline bool skl_ddb_entries_overlap(const struct skl_ddb_entry *a,
 	return a->start < b->end && b->start < a->end;
 }
 
-bool skl_ddb_allocation_overlaps(const struct skl_ddb_entry **entries,
+bool skl_ddb_allocation_overlaps(struct drm_i915_private *dev_priv,
+				 const struct skl_ddb_entry **entries,
 				 const struct skl_ddb_entry *ddb,
 				 int ignore)
 {
 	int i;
 
-	for (i = 0; i < I915_MAX_PIPES; i++)
+	for_each_pipe(dev_priv, i) {
 		if (i != ignore && entries[i] &&
 		    skl_ddb_entries_overlap(ddb, entries[i]))
 			return true;
+	}
 
 	return false;
 }