diff mbox series

[4/5] drm/i915/fbc: Split plane rotation checks per-platform

Message ID 20230914113854.10008-4-ville.syrjala@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series [1/5] drm/i915/fbc: Remove ancient 16k plane stride limit | expand

Commit Message

Ville Syrjala Sept. 14, 2023, 11:38 a.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Carve up rotation_is_valid() into per-platform variants to
make it easier to see what limits are actually being imposed.

TODO: maybe go for vfuncs later

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

Comments

Vinod Govindapillai Oct. 1, 2023, 11:03 a.m. UTC | #1
On Thu, 2023-09-14 at 14:38 +0300, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Carve up rotation_is_valid() into per-platform variants to
> make it easier to see what limits are actually being imposed.
> 
> TODO: maybe go for vfuncs later
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_fbc.c | 30 +++++++++++++++++++-----
>  1 file changed, 24 insertions(+), 6 deletions(-)

Reviewed-by: Vinod Govindapillai <vinod.govindapillai@intel.com>

> 
> diff --git a/drivers/gpu/drm/i915/display/intel_fbc.c b/drivers/gpu/drm/i915/display/intel_fbc.c
> index 052f9d8b53d4..1a6931e66d5d 100644
> --- a/drivers/gpu/drm/i915/display/intel_fbc.c
> +++ b/drivers/gpu/drm/i915/display/intel_fbc.c
> @@ -935,22 +935,40 @@ static bool pixel_format_is_valid(const struct intel_plane_state
> *plane_state)
>         }
>  }
>  
> -static bool rotation_is_valid(const struct intel_plane_state *plane_state)
> +static bool i8xx_fbc_rotation_is_valid(const struct intel_plane_state *plane_state)
> +{
> +       return plane_state->hw.rotation == DRM_MODE_ROTATE_0;
> +}
> +
> +static bool g4x_fbc_rotation_is_valid(const struct intel_plane_state *plane_state)
> +{
> +       return true;
> +}
> +
> +static bool skl_fbc_rotation_is_valid(const struct intel_plane_state *plane_state)
>  {
> -       struct drm_i915_private *i915 = to_i915(plane_state->uapi.plane->dev);
>         const struct drm_framebuffer *fb = plane_state->hw.fb;
>         unsigned int rotation = plane_state->hw.rotation;
>  
> -       if (DISPLAY_VER(i915) >= 9 && fb->format->format == DRM_FORMAT_RGB565 &&
> +       if (fb->format->format == DRM_FORMAT_RGB565 &&
>             drm_rotation_90_or_270(rotation))
>                 return false;
> -       else if (DISPLAY_VER(i915) <= 4 && !IS_G4X(i915) &&
> -                rotation != DRM_MODE_ROTATE_0)
> -               return false;
>  
>         return true;
>  }
>  
> +static bool rotation_is_valid(const struct intel_plane_state *plane_state)
> +{
> +       struct drm_i915_private *i915 = to_i915(plane_state->uapi.plane->dev);
> +
> +       if (DISPLAY_VER(i915) >= 9)
> +               return skl_fbc_rotation_is_valid(plane_state);
> +       else if (DISPLAY_VER(i915) >= 5 || IS_G4X(i915))
> +               return g4x_fbc_rotation_is_valid(plane_state);
> +       else
> +               return i8xx_fbc_rotation_is_valid(plane_state);
> +}
> +
>  /*
>   * For some reason, the hardware tracking starts looking at whatever we
>   * programmed as the display plane base address register. It does not look at
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 052f9d8b53d4..1a6931e66d5d 100644
--- a/drivers/gpu/drm/i915/display/intel_fbc.c
+++ b/drivers/gpu/drm/i915/display/intel_fbc.c
@@ -935,22 +935,40 @@  static bool pixel_format_is_valid(const struct intel_plane_state *plane_state)
 	}
 }
 
-static bool rotation_is_valid(const struct intel_plane_state *plane_state)
+static bool i8xx_fbc_rotation_is_valid(const struct intel_plane_state *plane_state)
+{
+	return plane_state->hw.rotation == DRM_MODE_ROTATE_0;
+}
+
+static bool g4x_fbc_rotation_is_valid(const struct intel_plane_state *plane_state)
+{
+	return true;
+}
+
+static bool skl_fbc_rotation_is_valid(const struct intel_plane_state *plane_state)
 {
-	struct drm_i915_private *i915 = to_i915(plane_state->uapi.plane->dev);
 	const struct drm_framebuffer *fb = plane_state->hw.fb;
 	unsigned int rotation = plane_state->hw.rotation;
 
-	if (DISPLAY_VER(i915) >= 9 && fb->format->format == DRM_FORMAT_RGB565 &&
+	if (fb->format->format == DRM_FORMAT_RGB565 &&
 	    drm_rotation_90_or_270(rotation))
 		return false;
-	else if (DISPLAY_VER(i915) <= 4 && !IS_G4X(i915) &&
-		 rotation != DRM_MODE_ROTATE_0)
-		return false;
 
 	return true;
 }
 
+static bool rotation_is_valid(const struct intel_plane_state *plane_state)
+{
+	struct drm_i915_private *i915 = to_i915(plane_state->uapi.plane->dev);
+
+	if (DISPLAY_VER(i915) >= 9)
+		return skl_fbc_rotation_is_valid(plane_state);
+	else if (DISPLAY_VER(i915) >= 5 || IS_G4X(i915))
+		return g4x_fbc_rotation_is_valid(plane_state);
+	else
+		return i8xx_fbc_rotation_is_valid(plane_state);
+}
+
 /*
  * For some reason, the hardware tracking starts looking at whatever we
  * programmed as the display plane base address register. It does not look at