]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/i915: Reuse vlv_primary_min_alignment() for sprites as well
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Wed, 9 Oct 2024 18:22:03 +0000 (21:22 +0300)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Mon, 20 Jan 2025 19:59:54 +0000 (21:59 +0200)
Rename vlv_primary_min_alignment() to vlv_plane_min_alignment()
and use it to replace vlv_sprite_min_alignment() since the
behaviour is now identical when the plane init doesn't set up
any async flips stuff.

Technically VLV/CHV sprites do support async flips, so this
also makes us a bit more future proof if/when we extend async
flip support to more than one plane.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20241009182207.22900-6-ville.syrjala@linux.intel.com
Reviewed-by: Jouni Högander <jouni.hogander@intel.com>
drivers/gpu/drm/i915/display/i9xx_plane.c
drivers/gpu/drm/i915/display/i9xx_plane.h
drivers/gpu/drm/i915/display/intel_sprite.c

index d05a12434f013e4ab44fda4a8b5b9927a3c9d61d..ed171fbf8720c0d188f673054359d9cc6c8939f1 100644 (file)
@@ -776,9 +776,9 @@ i8xx_plane_max_stride(struct intel_plane *plane,
                return 8 * 1024;
 }
 
-static unsigned int vlv_primary_min_alignment(struct intel_plane *plane,
-                                             const struct drm_framebuffer *fb,
-                                             int color_plane)
+unsigned int vlv_plane_min_alignment(struct intel_plane *plane,
+                                    const struct drm_framebuffer *fb,
+                                    int color_plane)
 {
        if (intel_plane_can_async_flip(plane, fb->modifier))
                return 256 * 1024;
@@ -939,7 +939,7 @@ intel_primary_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe)
        }
 
        if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv))
-               plane->min_alignment = vlv_primary_min_alignment;
+               plane->min_alignment = vlv_plane_min_alignment;
        else if (DISPLAY_VER(dev_priv) >= 5 || IS_G4X(dev_priv))
                plane->min_alignment = g4x_primary_min_alignment;
        else if (DISPLAY_VER(dev_priv) == 4)
index 0ca12d1e683936d1075dc1a6c27180b73729989c..457f4bccf1062b37b78488baef1d8fd87345b7ef 100644 (file)
@@ -9,6 +9,7 @@
 #include <linux/types.h>
 
 enum pipe;
+struct drm_framebuffer;
 struct drm_i915_private;
 struct intel_crtc;
 struct intel_initial_plane_config;
@@ -19,6 +20,9 @@ struct intel_plane_state;
 unsigned int i965_plane_max_stride(struct intel_plane *plane,
                                   u32 pixel_format, u64 modifier,
                                   unsigned int rotation);
+unsigned int vlv_plane_min_alignment(struct intel_plane *plane,
+                                    const struct drm_framebuffer *fb,
+                                    int colot_plane);
 int i9xx_check_plane_surface(struct intel_plane_state *plane_state);
 
 struct intel_plane *
index e6fadcef58e06cadeb5ca4389d45dd2e26958720..13996d7059ad1879fe9892e817a2fbd63aa2c913 100644 (file)
@@ -253,21 +253,6 @@ int vlv_plane_min_cdclk(const struct intel_crtc_state *crtc_state,
        return DIV_ROUND_UP(pixel_rate * num, den);
 }
 
-static unsigned int vlv_sprite_min_alignment(struct intel_plane *plane,
-                                            const struct drm_framebuffer *fb,
-                                            int color_plane)
-{
-       switch (fb->modifier) {
-       case I915_FORMAT_MOD_X_TILED:
-               return 4 * 1024;
-       case DRM_FORMAT_MOD_LINEAR:
-               return 128 * 1024;
-       default:
-               MISSING_CASE(fb->modifier);
-               return 0;
-       }
-}
-
 static u32 vlv_sprite_ctl_crtc(const struct intel_crtc_state *crtc_state)
 {
        u32 sprctl = 0;
@@ -1616,7 +1601,7 @@ intel_sprite_plane_create(struct drm_i915_private *dev_priv,
                plane->get_hw_state = vlv_sprite_get_hw_state;
                plane->check_plane = vlv_sprite_check;
                plane->max_stride = i965_plane_max_stride;
-               plane->min_alignment = vlv_sprite_min_alignment;
+               plane->min_alignment = vlv_plane_min_alignment;
                plane->min_cdclk = vlv_plane_min_cdclk;
 
                if (IS_CHERRYVIEW(dev_priv) && pipe == PIPE_B) {