]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
drm/i915: Relocate intel_plane_check_src_coordinates()
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Tue, 14 Mar 2023 13:02:54 +0000 (15:02 +0200)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Fri, 17 Mar 2023 13:24:27 +0000 (15:24 +0200)
Move intel_plane_check_src_coordinates() from the pre-skl sprite
plane specific code to a more suitable place for common plane code.

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

index 719a60e278f39c326a43bbba5d37a08e19dcd4e3..40de9f0f171b479b6623e2a4197c2a75f08961f6 100644 (file)
@@ -32,6 +32,7 @@
  */
 
 #include <drm/drm_atomic_helper.h>
+#include <drm/drm_blend.h>
 #include <drm/drm_fourcc.h>
 
 #include "i915_config.h"
@@ -42,7 +43,6 @@
 #include "intel_display_types.h"
 #include "intel_fb.h"
 #include "intel_fb_pin.h"
-#include "intel_sprite.h"
 #include "skl_scaler.h"
 #include "skl_watermark.h"
 
@@ -940,6 +940,64 @@ int intel_atomic_plane_check_clipping(struct intel_plane_state *plane_state,
        return 0;
 }
 
+int intel_plane_check_src_coordinates(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;
+       struct drm_rect *src = &plane_state->uapi.src;
+       u32 src_x, src_y, src_w, src_h, hsub, vsub;
+       bool rotated = drm_rotation_90_or_270(plane_state->hw.rotation);
+
+       /*
+        * FIXME hsub/vsub vs. block size is a mess. Pre-tgl CCS
+        * abuses hsub/vsub so we can't use them here. But as they
+        * are limited to 32bpp RGB formats we don't actually need
+        * to check anything.
+        */
+       if (fb->modifier == I915_FORMAT_MOD_Y_TILED_CCS ||
+           fb->modifier == I915_FORMAT_MOD_Yf_TILED_CCS)
+               return 0;
+
+       /*
+        * Hardware doesn't handle subpixel coordinates.
+        * Adjust to (macro)pixel boundary, but be careful not to
+        * increase the source viewport size, because that could
+        * push the downscaling factor out of bounds.
+        */
+       src_x = src->x1 >> 16;
+       src_w = drm_rect_width(src) >> 16;
+       src_y = src->y1 >> 16;
+       src_h = drm_rect_height(src) >> 16;
+
+       drm_rect_init(src, src_x << 16, src_y << 16,
+                     src_w << 16, src_h << 16);
+
+       if (fb->format->format == DRM_FORMAT_RGB565 && rotated) {
+               hsub = 2;
+               vsub = 2;
+       } else {
+               hsub = fb->format->hsub;
+               vsub = fb->format->vsub;
+       }
+
+       if (rotated)
+               hsub = vsub = max(hsub, vsub);
+
+       if (src_x % hsub || src_w % hsub) {
+               drm_dbg_kms(&i915->drm, "src x/w (%u, %u) must be a multiple of %u (rotated: %s)\n",
+                           src_x, src_w, hsub, str_yes_no(rotated));
+               return -EINVAL;
+       }
+
+       if (src_y % vsub || src_h % vsub) {
+               drm_dbg_kms(&i915->drm, "src y/h (%u, %u) must be a multiple of %u (rotated: %s)\n",
+                           src_y, src_h, vsub, str_yes_no(rotated));
+               return -EINVAL;
+       }
+
+       return 0;
+}
+
 /**
  * intel_prepare_plane_fb - Prepare fb for usage on plane
  * @_plane: drm plane to prepare for
index 74b6d3b169a72d8faa9dc60a428750b0b46a3107..191dad0efc8e6223d7e1700b598d64b050674ef7 100644 (file)
@@ -62,6 +62,7 @@ int intel_atomic_plane_check_clipping(struct intel_plane_state *plane_state,
                                      struct intel_crtc_state *crtc_state,
                                      int min_scale, int max_scale,
                                      bool can_position);
+int intel_plane_check_src_coordinates(struct intel_plane_state *plane_state);
 void intel_plane_set_invisible(struct intel_crtc_state *crtc_state,
                               struct intel_plane_state *plane_state);
 void intel_plane_helper_add(struct intel_plane *plane);
index c3173c0c2068756022d12b7412686e99b6eb043f..31bef04273779e0aa9b5811f8e0569227a6c9972 100644 (file)
@@ -21,7 +21,6 @@
 #include "intel_fb_pin.h"
 #include "intel_frontbuffer.h"
 #include "intel_psr.h"
-#include "intel_sprite.h"
 #include "skl_watermark.h"
 
 /* Cursor formats */
index c531fee888a49da298f602a4b24eb588e15133ba..8d5b73594657839bd9e4df008e8a5fc82ceeb61b 100644 (file)
@@ -65,7 +65,6 @@
 #include "intel_psr.h"
 #include "intel_quirks.h"
 #include "intel_snps_phy.h"
-#include "intel_sprite.h"
 #include "intel_tc.h"
 #include "intel_vdsc.h"
 #include "intel_vdsc_regs.h"
index b8691bcdf4092cb2acc7fa5b6695bd355671e045..7305ad6592d3877438620c4187f47c54fef41ed5 100644 (file)
 #include "intel_quirks.h"
 #include "intel_sdvo.h"
 #include "intel_snps_phy.h"
-#include "intel_sprite.h"
 #include "intel_tc.h"
 #include "intel_tv.h"
 #include "intel_vblank.h"
index a16e56a60c305d2882bc64f23d996c1eef82e384..3563fecee838b68c7def739ee731f31f9908455f 100644 (file)
 #include "intel_sprite.h"
 #include "intel_vrr.h"
 
-int intel_plane_check_src_coordinates(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;
-       struct drm_rect *src = &plane_state->uapi.src;
-       u32 src_x, src_y, src_w, src_h, hsub, vsub;
-       bool rotated = drm_rotation_90_or_270(plane_state->hw.rotation);
-
-       /*
-        * FIXME hsub/vsub vs. block size is a mess. Pre-tgl CCS
-        * abuses hsub/vsub so we can't use them here. But as they
-        * are limited to 32bpp RGB formats we don't actually need
-        * to check anything.
-        */
-       if (fb->modifier == I915_FORMAT_MOD_Y_TILED_CCS ||
-           fb->modifier == I915_FORMAT_MOD_Yf_TILED_CCS)
-               return 0;
-
-       /*
-        * Hardware doesn't handle subpixel coordinates.
-        * Adjust to (macro)pixel boundary, but be careful not to
-        * increase the source viewport size, because that could
-        * push the downscaling factor out of bounds.
-        */
-       src_x = src->x1 >> 16;
-       src_w = drm_rect_width(src) >> 16;
-       src_y = src->y1 >> 16;
-       src_h = drm_rect_height(src) >> 16;
-
-       drm_rect_init(src, src_x << 16, src_y << 16,
-                     src_w << 16, src_h << 16);
-
-       if (fb->format->format == DRM_FORMAT_RGB565 && rotated) {
-               hsub = 2;
-               vsub = 2;
-       } else {
-               hsub = fb->format->hsub;
-               vsub = fb->format->vsub;
-       }
-
-       if (rotated)
-               hsub = vsub = max(hsub, vsub);
-
-       if (src_x % hsub || src_w % hsub) {
-               drm_dbg_kms(&i915->drm, "src x/w (%u, %u) must be a multiple of %u (rotated: %s)\n",
-                           src_x, src_w, hsub, str_yes_no(rotated));
-               return -EINVAL;
-       }
-
-       if (src_y % vsub || src_h % vsub) {
-               drm_dbg_kms(&i915->drm, "src y/h (%u, %u) must be a multiple of %u (rotated: %s)\n",
-                           src_y, src_h, vsub, str_yes_no(rotated));
-               return -EINVAL;
-       }
-
-       return 0;
-}
-
 static void i9xx_plane_linear_gamma(u16 gamma[8])
 {
        /* The points are not evenly spaced. */
index ce55b8f09301ba50436251bb14d2d5918c3d2716..fd0065a46ec5f7e017900c2df3bb180974bbafc9 100644 (file)
@@ -17,7 +17,6 @@
 #include "intel_fb.h"
 #include "intel_fbc.h"
 #include "intel_psr.h"
-#include "intel_sprite.h"
 #include "skl_scaler.h"
 #include "skl_universal_plane.h"
 #include "skl_watermark.h"