drm/i915/fb: move intel_surf_alignment() to intel_fb.c
authorJani Nikula <jani.nikula@intel.com>
Mon, 23 Aug 2021 12:25:35 +0000 (15:25 +0300)
committerJani Nikula <jani.nikula@intel.com>
Tue, 24 Aug 2021 17:47:14 +0000 (20:47 +0300)
Split out fb related stuff from intel_display.c to intel_fb.c.

Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/0b894be3a6acff5fe917b686771a084a6c2aa535.1629721467.git.jani.nikula@intel.com
drivers/gpu/drm/i915/display/intel_display.c
drivers/gpu/drm/i915/display/intel_display.h
drivers/gpu/drm/i915/display/intel_fb.c
drivers/gpu/drm/i915/display/intel_fb.h

index ddc6bd436b01f07c1058c7d0ef8415daf2c59754..a9e3ac07b20731d8039b8eeadbc03611aaf40d11 100644 (file)
@@ -901,70 +901,6 @@ unsigned int intel_remapped_info_size(const struct intel_remapped_info *rem_info
        return size;
 }
 
        return size;
 }
 
-static unsigned int intel_linear_alignment(const struct drm_i915_private *dev_priv)
-{
-       if (DISPLAY_VER(dev_priv) >= 9)
-               return 256 * 1024;
-       else if (IS_I965G(dev_priv) || IS_I965GM(dev_priv) ||
-                IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv))
-               return 128 * 1024;
-       else if (DISPLAY_VER(dev_priv) >= 4)
-               return 4 * 1024;
-       else
-               return 0;
-}
-
-unsigned int intel_surf_alignment(const struct drm_framebuffer *fb,
-                                 int color_plane)
-{
-       struct drm_i915_private *dev_priv = to_i915(fb->dev);
-
-       if (intel_fb_uses_dpt(fb))
-               return 512 * 4096;
-
-       /* AUX_DIST needs only 4K alignment */
-       if (is_ccs_plane(fb, color_plane))
-               return 4096;
-
-       if (is_semiplanar_uv_plane(fb, color_plane)) {
-               /*
-                * TODO: cross-check wrt. the bspec stride in bytes * 64 bytes
-                * alignment for linear UV planes on all platforms.
-                */
-               if (DISPLAY_VER(dev_priv) >= 12) {
-                       if (fb->modifier == DRM_FORMAT_MOD_LINEAR)
-                               return intel_linear_alignment(dev_priv);
-
-                       return intel_tile_row_size(fb, color_plane);
-               }
-
-               return 4096;
-       }
-
-       drm_WARN_ON(&dev_priv->drm, color_plane != 0);
-
-       switch (fb->modifier) {
-       case DRM_FORMAT_MOD_LINEAR:
-               return intel_linear_alignment(dev_priv);
-       case I915_FORMAT_MOD_X_TILED:
-               if (HAS_ASYNC_FLIPS(dev_priv))
-                       return 256 * 1024;
-               return 0;
-       case I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS:
-       case I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS:
-       case I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS_CC:
-               return 16 * 1024;
-       case I915_FORMAT_MOD_Y_TILED_CCS:
-       case I915_FORMAT_MOD_Yf_TILED_CCS:
-       case I915_FORMAT_MOD_Y_TILED:
-       case I915_FORMAT_MOD_Yf_TILED:
-               return 1 * 1024 * 1024;
-       default:
-               MISSING_CASE(fb->modifier);
-               return 0;
-       }
-}
-
 static bool intel_plane_uses_fence(const struct intel_plane_state *plane_state)
 {
        struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane);
 static bool intel_plane_uses_fence(const struct intel_plane_state *plane_state)
 {
        struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane);
index 695b874adacc92f1d3f16b3d57dc5c0a2a9ddb2e..4719ffc97fce9384bc969b763ff44dbeb7469291 100644 (file)
@@ -628,9 +628,6 @@ struct intel_encoder *
 intel_get_crtc_new_encoder(const struct intel_atomic_state *state,
                           const struct intel_crtc_state *crtc_state);
 
 intel_get_crtc_new_encoder(const struct intel_atomic_state *state,
                           const struct intel_crtc_state *crtc_state);
 
-unsigned int intel_surf_alignment(const struct drm_framebuffer *fb,
-                                 int color_plane);
-
 void intel_display_driver_register(struct drm_i915_private *i915);
 void intel_display_driver_unregister(struct drm_i915_private *i915);
 
 void intel_display_driver_register(struct drm_i915_private *i915);
 void intel_display_driver_unregister(struct drm_i915_private *i915);
 
index 9e722cc1a7fdeb1525551fbc8d938c34d91e920b..e24ee2a28ebfd86c58e5e4714d50e0be0b539850 100644 (file)
@@ -184,6 +184,70 @@ unsigned int intel_cursor_alignment(const struct drm_i915_private *i915)
                return 4 * 1024;
 }
 
                return 4 * 1024;
 }
 
+static unsigned int intel_linear_alignment(const struct drm_i915_private *dev_priv)
+{
+       if (DISPLAY_VER(dev_priv) >= 9)
+               return 256 * 1024;
+       else if (IS_I965G(dev_priv) || IS_I965GM(dev_priv) ||
+                IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv))
+               return 128 * 1024;
+       else if (DISPLAY_VER(dev_priv) >= 4)
+               return 4 * 1024;
+       else
+               return 0;
+}
+
+unsigned int intel_surf_alignment(const struct drm_framebuffer *fb,
+                                 int color_plane)
+{
+       struct drm_i915_private *dev_priv = to_i915(fb->dev);
+
+       if (intel_fb_uses_dpt(fb))
+               return 512 * 4096;
+
+       /* AUX_DIST needs only 4K alignment */
+       if (is_ccs_plane(fb, color_plane))
+               return 4096;
+
+       if (is_semiplanar_uv_plane(fb, color_plane)) {
+               /*
+                * TODO: cross-check wrt. the bspec stride in bytes * 64 bytes
+                * alignment for linear UV planes on all platforms.
+                */
+               if (DISPLAY_VER(dev_priv) >= 12) {
+                       if (fb->modifier == DRM_FORMAT_MOD_LINEAR)
+                               return intel_linear_alignment(dev_priv);
+
+                       return intel_tile_row_size(fb, color_plane);
+               }
+
+               return 4096;
+       }
+
+       drm_WARN_ON(&dev_priv->drm, color_plane != 0);
+
+       switch (fb->modifier) {
+       case DRM_FORMAT_MOD_LINEAR:
+               return intel_linear_alignment(dev_priv);
+       case I915_FORMAT_MOD_X_TILED:
+               if (HAS_ASYNC_FLIPS(dev_priv))
+                       return 256 * 1024;
+               return 0;
+       case I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS:
+       case I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS:
+       case I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS_CC:
+               return 16 * 1024;
+       case I915_FORMAT_MOD_Y_TILED_CCS:
+       case I915_FORMAT_MOD_Yf_TILED_CCS:
+       case I915_FORMAT_MOD_Y_TILED:
+       case I915_FORMAT_MOD_Yf_TILED:
+               return 1 * 1024 * 1024;
+       default:
+               MISSING_CASE(fb->modifier);
+               return 0;
+       }
+}
+
 void intel_fb_plane_get_subsampling(int *hsub, int *vsub,
                                    const struct drm_framebuffer *fb,
                                    int color_plane)
 void intel_fb_plane_get_subsampling(int *hsub, int *vsub,
                                    const struct drm_framebuffer *fb,
                                    int color_plane)
index f3d677cd6b6e9c7ede8aee6b882b6287752df6a1..0b0a831394623cd3d34423748a1331bb32de19fa 100644 (file)
@@ -34,6 +34,8 @@ unsigned int intel_tile_row_size(const struct drm_framebuffer *fb, int color_pla
 unsigned int intel_fb_align_height(const struct drm_framebuffer *fb,
                                   int color_plane, unsigned int height);
 unsigned int intel_cursor_alignment(const struct drm_i915_private *i915);
 unsigned int intel_fb_align_height(const struct drm_framebuffer *fb,
                                   int color_plane, unsigned int height);
 unsigned int intel_cursor_alignment(const struct drm_i915_private *i915);
+unsigned int intel_surf_alignment(const struct drm_framebuffer *fb,
+                                 int color_plane);
 
 void intel_fb_plane_get_subsampling(int *hsub, int *vsub,
                                    const struct drm_framebuffer *fb,
 
 void intel_fb_plane_get_subsampling(int *hsub, int *vsub,
                                    const struct drm_framebuffer *fb,