diff mbox series

[04/20] drm/i915/fbc: Relocate intel_fbc_override_cfb_stride()

Message ID 20211124113652.22090-5-ville.syrjala@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915/fbc: More FBC refactoring | expand

Commit Message

Ville Syrjälä Nov. 24, 2021, 11:36 a.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Move intel_fbc_override_cfb_stride() next to its cousins.
Helps with later patches.

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

Comments

Kahola, Mika Nov. 30, 2021, 1:22 p.m. UTC | #1
> -----Original Message-----
> From: Intel-gfx <intel-gfx-bounces@lists.freedesktop.org> On Behalf Of Ville
> Syrjala
> Sent: Wednesday, November 24, 2021 1:37 PM
> To: intel-gfx@lists.freedesktop.org
> Subject: [Intel-gfx] [PATCH 04/20] drm/i915/fbc: Relocate
> intel_fbc_override_cfb_stride()
> 
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Move intel_fbc_override_cfb_stride() next to its cousins.
> Helps with later patches.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Reviewed-by: Mika Kahola <mika.kahola@intel.com>

> ---
>  drivers/gpu/drm/i915/display/intel_fbc.c | 42 ++++++++++++------------
>  1 file changed, 21 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_fbc.c
> b/drivers/gpu/drm/i915/display/intel_fbc.c
> index 8bde3681b96e..6368dddf977c 100644
> --- a/drivers/gpu/drm/i915/display/intel_fbc.c
> +++ b/drivers/gpu/drm/i915/display/intel_fbc.c
> @@ -142,6 +142,27 @@ static unsigned int intel_fbc_cfb_size(struct intel_fbc
> *fbc,
>  	return lines * intel_fbc_cfb_stride(fbc, cache);  }
> 
> +static u16 intel_fbc_override_cfb_stride(struct intel_fbc *fbc,
> +					 const struct intel_fbc_state_cache
> *cache) {
> +	unsigned int stride = _intel_fbc_cfb_stride(cache);
> +	unsigned int stride_aligned = intel_fbc_cfb_stride(fbc, cache);
> +
> +	/*
> +	 * Override stride in 64 byte units per 4 line segment.
> +	 *
> +	 * Gen9 hw miscalculates cfb stride for linear as
> +	 * PLANE_STRIDE*512 instead of PLANE_STRIDE*64, so
> +	 * we always need to use the override there.
> +	 */
> +	if (stride != stride_aligned ||
> +	    (DISPLAY_VER(fbc->i915) == 9 &&
> +	     cache->fb.modifier == DRM_FORMAT_MOD_LINEAR))
> +		return stride_aligned * 4 / 64;
> +
> +	return 0;
> +}
> +
>  static u32 i8xx_fbc_ctl(struct intel_fbc *fbc)  {
>  	const struct intel_fbc_reg_params *params = &fbc->params; @@ -
> 950,27 +971,6 @@ static bool intel_fbc_cfb_size_changed(struct intel_fbc *fbc)
>  		fbc->compressed_fb.size * fbc->limit;  }
> 
> -static u16 intel_fbc_override_cfb_stride(struct intel_fbc *fbc,
> -					 const struct intel_fbc_state_cache
> *cache)
> -{
> -	unsigned int stride = _intel_fbc_cfb_stride(cache);
> -	unsigned int stride_aligned = intel_fbc_cfb_stride(fbc, cache);
> -
> -	/*
> -	 * Override stride in 64 byte units per 4 line segment.
> -	 *
> -	 * Gen9 hw miscalculates cfb stride for linear as
> -	 * PLANE_STRIDE*512 instead of PLANE_STRIDE*64, so
> -	 * we always need to use the override there.
> -	 */
> -	if (stride != stride_aligned ||
> -	    (DISPLAY_VER(fbc->i915) == 9 &&
> -	     cache->fb.modifier == DRM_FORMAT_MOD_LINEAR))
> -		return stride_aligned * 4 / 64;
> -
> -	return 0;
> -}
> -
>  static bool intel_fbc_can_enable(struct intel_fbc *fbc)  {
>  	struct drm_i915_private *i915 = fbc->i915;
> --
> 2.32.0
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_fbc.c b/drivers/gpu/drm/i915/display/intel_fbc.c
index 8bde3681b96e..6368dddf977c 100644
--- a/drivers/gpu/drm/i915/display/intel_fbc.c
+++ b/drivers/gpu/drm/i915/display/intel_fbc.c
@@ -142,6 +142,27 @@  static unsigned int intel_fbc_cfb_size(struct intel_fbc *fbc,
 	return lines * intel_fbc_cfb_stride(fbc, cache);
 }
 
+static u16 intel_fbc_override_cfb_stride(struct intel_fbc *fbc,
+					 const struct intel_fbc_state_cache *cache)
+{
+	unsigned int stride = _intel_fbc_cfb_stride(cache);
+	unsigned int stride_aligned = intel_fbc_cfb_stride(fbc, cache);
+
+	/*
+	 * Override stride in 64 byte units per 4 line segment.
+	 *
+	 * Gen9 hw miscalculates cfb stride for linear as
+	 * PLANE_STRIDE*512 instead of PLANE_STRIDE*64, so
+	 * we always need to use the override there.
+	 */
+	if (stride != stride_aligned ||
+	    (DISPLAY_VER(fbc->i915) == 9 &&
+	     cache->fb.modifier == DRM_FORMAT_MOD_LINEAR))
+		return stride_aligned * 4 / 64;
+
+	return 0;
+}
+
 static u32 i8xx_fbc_ctl(struct intel_fbc *fbc)
 {
 	const struct intel_fbc_reg_params *params = &fbc->params;
@@ -950,27 +971,6 @@  static bool intel_fbc_cfb_size_changed(struct intel_fbc *fbc)
 		fbc->compressed_fb.size * fbc->limit;
 }
 
-static u16 intel_fbc_override_cfb_stride(struct intel_fbc *fbc,
-					 const struct intel_fbc_state_cache *cache)
-{
-	unsigned int stride = _intel_fbc_cfb_stride(cache);
-	unsigned int stride_aligned = intel_fbc_cfb_stride(fbc, cache);
-
-	/*
-	 * Override stride in 64 byte units per 4 line segment.
-	 *
-	 * Gen9 hw miscalculates cfb stride for linear as
-	 * PLANE_STRIDE*512 instead of PLANE_STRIDE*64, so
-	 * we always need to use the override there.
-	 */
-	if (stride != stride_aligned ||
-	    (DISPLAY_VER(fbc->i915) == 9 &&
-	     cache->fb.modifier == DRM_FORMAT_MOD_LINEAR))
-		return stride_aligned * 4 / 64;
-
-	return 0;
-}
-
 static bool intel_fbc_can_enable(struct intel_fbc *fbc)
 {
 	struct drm_i915_private *i915 = fbc->i915;