drm/i915: Split cursor alignment to per-platform vfuncs
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Wed, 12 Jun 2024 20:47:08 +0000 (23:47 +0300)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Mon, 24 Jun 2024 14:12:32 +0000 (17:12 +0300)
Split intel_cursor_alignment() into per-platform variants.

Reviewed-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240612204712.31404-6-ville.syrjala@linux.intel.com
drivers/gpu/drm/i915/display/intel_cursor.c
drivers/gpu/drm/i915/display/intel_fb.c
drivers/gpu/drm/i915/display/intel_fb.h

index 46f39ab17e43f88eda5c2298ed92253baa0a7ef1..2bd8d02f87034f920cf3963fcd76178e3058d0c5 100644 (file)
@@ -194,6 +194,13 @@ i845_cursor_max_stride(struct intel_plane *plane,
        return 2048;
 }
 
+static unsigned int i845_cursor_min_alignment(struct intel_plane *plane,
+                                             const struct drm_framebuffer *fb,
+                                             int color_plane)
+{
+       return 32;
+}
+
 static u32 i845_cursor_ctl_crtc(const struct intel_crtc_state *crtc_state)
 {
        u32 cntl = 0;
@@ -344,6 +351,28 @@ i9xx_cursor_max_stride(struct intel_plane *plane,
        return plane->base.dev->mode_config.cursor_width * 4;
 }
 
+static unsigned int i830_cursor_min_alignment(struct intel_plane *plane,
+                                             const struct drm_framebuffer *fb,
+                                             int color_plane)
+{
+       /* "AlmadorM Errata – Requires 32-bpp cursor data to be 16KB aligned." */
+       return 16 * 1024; /* physical */
+}
+
+static unsigned int i85x_cursor_min_alignment(struct intel_plane *plane,
+                                             const struct drm_framebuffer *fb,
+                                             int color_plane)
+{
+       return 256; /* physical */
+}
+
+static unsigned int i9xx_cursor_min_alignment(struct intel_plane *plane,
+                                             const struct drm_framebuffer *fb,
+                                             int color_plane)
+{
+       return 4 * 1024; /* physical for i915/i945 */
+}
+
 static u32 i9xx_cursor_ctl_crtc(const struct intel_crtc_state *crtc_state)
 {
        struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
@@ -942,20 +971,27 @@ intel_cursor_plane_create(struct drm_i915_private *dev_priv,
 
        if (IS_I845G(dev_priv) || IS_I865G(dev_priv)) {
                cursor->max_stride = i845_cursor_max_stride;
+               cursor->min_alignment = i845_cursor_min_alignment;
                cursor->update_arm = i845_cursor_update_arm;
                cursor->disable_arm = i845_cursor_disable_arm;
                cursor->get_hw_state = i845_cursor_get_hw_state;
                cursor->check_plane = i845_check_cursor;
        } else {
                cursor->max_stride = i9xx_cursor_max_stride;
+
+               if (IS_I830(dev_priv))
+                       cursor->min_alignment = i830_cursor_min_alignment;
+               else if (IS_I85X(dev_priv))
+                       cursor->min_alignment = i85x_cursor_min_alignment;
+               else
+                       cursor->min_alignment = i9xx_cursor_min_alignment;
+
                cursor->update_arm = i9xx_cursor_update_arm;
                cursor->disable_arm = i9xx_cursor_disable_arm;
                cursor->get_hw_state = i9xx_cursor_get_hw_state;
                cursor->check_plane = i9xx_check_cursor;
        }
 
-       cursor->min_alignment = intel_cursor_alignment;
-
        cursor->cursor.base = ~0;
        cursor->cursor.cntl = ~0;
 
index 0abb80972885003058acac569407d5861a9d20f0..b5d31ccf013ac89db83e644f69c49c5fe63bd45a 100644 (file)
@@ -777,22 +777,6 @@ bool intel_fb_uses_dpt(const struct drm_framebuffer *fb)
                intel_fb_modifier_uses_dpt(to_i915(fb->dev), fb->modifier);
 }
 
-unsigned int intel_cursor_alignment(struct intel_plane *plane,
-                                   const struct drm_framebuffer *fb,
-                                   int color_plane)
-{
-       struct drm_i915_private *i915 = to_i915(plane->base.dev);
-
-       if (IS_I830(i915))
-               return 16 * 1024;
-       else if (IS_I85X(i915))
-               return 256;
-       else if (IS_I845G(i915) || IS_I865G(i915))
-               return 32;
-       else
-               return 4 * 1024;
-}
-
 static unsigned int intel_linear_alignment(const struct drm_i915_private *dev_priv)
 {
        if (DISPLAY_VER(dev_priv) >= 9)
index 86c01a3ce81eebbadd1c3e466e6a27a1c6617a0e..16ebb573643f92b02893905d1157993f5a77be3e 100644 (file)
@@ -60,9 +60,6 @@ unsigned int intel_tile_height(const struct drm_framebuffer *fb, int color_plane
 unsigned int intel_tile_row_size(const struct drm_framebuffer *fb, int color_plane);
 unsigned int intel_fb_align_height(const struct drm_framebuffer *fb,
                                   int color_plane, unsigned int height);
-unsigned int intel_cursor_alignment(struct intel_plane *plane,
-                                   const struct drm_framebuffer *fb,
-                                   int color_plane);
 unsigned int intel_surf_alignment(struct intel_plane *plane,
                                  const struct drm_framebuffer *fb,
                                  int color_plane);