drm/i915: Relocate intel_{rotation,remapped}_info_size()
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Thu, 13 Feb 2025 15:02:18 +0000 (17:02 +0200)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Sat, 15 Feb 2025 19:04:06 +0000 (21:04 +0200)
Move intel_{rotation,remapped}_info_size() into intel_fb.c as
that seems a slightly better place than intel_display.c. I suppose
these should live somewhere outside the display code as they are
also used by the gem code.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20250213150220.13580-11-ville.syrjala@linux.intel.com
Reviewed-by: Jani Nikula <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
drivers/gpu/drm/i915/i915_vma.c

index dc1ec1b94c4005b76196fd39981ec1953a24d8e4..759f05a08e626135d78fb05456a74cb98ba021f9 100644 (file)
@@ -600,42 +600,6 @@ void intel_disable_transcoder(const struct intel_crtc_state *old_crtc_state)
                intel_wait_for_pipe_off(old_crtc_state);
 }
 
-unsigned int intel_rotation_info_size(const struct intel_rotation_info *rot_info)
-{
-       unsigned int size = 0;
-       int i;
-
-       for (i = 0 ; i < ARRAY_SIZE(rot_info->plane); i++)
-               size += rot_info->plane[i].dst_stride * rot_info->plane[i].width;
-
-       return size;
-}
-
-unsigned int intel_remapped_info_size(const struct intel_remapped_info *rem_info)
-{
-       unsigned int size = 0;
-       int i;
-
-       for (i = 0 ; i < ARRAY_SIZE(rem_info->plane); i++) {
-               unsigned int plane_size;
-
-               if (rem_info->plane[i].linear)
-                       plane_size = rem_info->plane[i].size;
-               else
-                       plane_size = rem_info->plane[i].dst_stride * rem_info->plane[i].height;
-
-               if (plane_size == 0)
-                       continue;
-
-               if (rem_info->plane_alignment)
-                       size = ALIGN(size, rem_info->plane_alignment);
-
-               size += plane_size;
-       }
-
-       return size;
-}
-
 /*
  * Convert the x/y offsets into a linear offset.
  * Only valid with 0/180 degree rotation, which is fine since linear
index 7b958e66a69c36520286fabbe9c9e313d393758c..bd3b38632ef9db86dd7ccf07dd0dd351149efe41 100644 (file)
@@ -59,8 +59,6 @@ struct intel_link_m_n;
 struct intel_plane;
 struct intel_plane_state;
 struct intel_power_domain_mask;
-struct intel_remapped_info;
-struct intel_rotation_info;
 struct pci_dev;
 struct work_struct;
 
@@ -465,8 +463,6 @@ unsigned int intel_fb_xy_to_linear(int x, int y,
                                   int plane);
 void intel_add_fb_offsets(int *x, int *y,
                          const struct intel_plane_state *state, int plane);
-unsigned int intel_rotation_info_size(const struct intel_rotation_info *rot_info);
-unsigned int intel_remapped_info_size(const struct intel_remapped_info *rem_info);
 bool intel_has_pending_fb_unpin(struct drm_i915_private *dev_priv);
 void intel_encoder_destroy(struct drm_encoder *encoder);
 struct drm_display_mode *
index 5875af2b61e666bf81fed6fd4ee3c3a917ed0aa2..c1923b4c13d66780343ff5fed03826d7e34df8e1 100644 (file)
@@ -1891,6 +1891,42 @@ static void intel_plane_remap_gtt(struct intel_plane_state *plane_state)
        }
 }
 
+unsigned int intel_rotation_info_size(const struct intel_rotation_info *rot_info)
+{
+       unsigned int size = 0;
+       int i;
+
+       for (i = 0 ; i < ARRAY_SIZE(rot_info->plane); i++)
+               size += rot_info->plane[i].dst_stride * rot_info->plane[i].width;
+
+       return size;
+}
+
+unsigned int intel_remapped_info_size(const struct intel_remapped_info *rem_info)
+{
+       unsigned int size = 0;
+       int i;
+
+       for (i = 0 ; i < ARRAY_SIZE(rem_info->plane); i++) {
+               unsigned int plane_size;
+
+               if (rem_info->plane[i].linear)
+                       plane_size = rem_info->plane[i].size;
+               else
+                       plane_size = rem_info->plane[i].dst_stride * rem_info->plane[i].height;
+
+               if (plane_size == 0)
+                       continue;
+
+               if (rem_info->plane_alignment)
+                       size = ALIGN(size, rem_info->plane_alignment);
+
+               size += plane_size;
+       }
+
+       return size;
+}
+
 void intel_fb_fill_view(const struct intel_framebuffer *fb, unsigned int rotation,
                        struct intel_fb_view *view)
 {
index 63728520eb062e415e7f1df972681df0cf00624b..d04d9274bb712e74feff7ec85cd3736e6302e3e2 100644 (file)
@@ -19,6 +19,8 @@ struct intel_fb_view;
 struct intel_framebuffer;
 struct intel_plane;
 struct intel_plane_state;
+struct intel_remapped_info;
+struct intel_rotation_info;
 
 #define INTEL_PLANE_CAP_NONE           0
 #define INTEL_PLANE_CAP_CCS_RC         BIT(0)
@@ -80,6 +82,9 @@ bool intel_fb_needs_pot_stride_remap(const struct intel_framebuffer *fb);
 bool intel_plane_uses_fence(const struct intel_plane_state *plane_state);
 bool intel_fb_supports_90_270_rotation(const struct intel_framebuffer *fb);
 
+unsigned int intel_rotation_info_size(const struct intel_rotation_info *rot_info);
+unsigned int intel_remapped_info_size(const struct intel_remapped_info *rem_info);
+
 int intel_fill_fb_info(struct intel_display *display, struct intel_framebuffer *fb);
 void intel_fb_fill_view(const struct intel_framebuffer *fb, unsigned int rotation,
                        struct intel_fb_view *view);
index 61b49007ecd48a584dfe93a9043bcce295cbe372..632e316f8b0522243a32f7e80924806a6ffe6227 100644 (file)
@@ -26,7 +26,7 @@
 #include <linux/dma-fence-array.h>
 #include <drm/drm_gem.h>
 
-#include "display/intel_display.h"
+#include "display/intel_fb.h"
 #include "display/intel_frontbuffer.h"
 #include "gem/i915_gem_lmem.h"
 #include "gem/i915_gem_object_frontbuffer.h"