From: Ville Syrjala <ville.syrjala@linux.intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: intel-xe@lists.freedesktop.org
Subject: [PATCH 2/9] drm/i915: Clean up skl+ plane stride limits
Date: Mon, 6 May 2024 15:57:11 +0300 [thread overview]
Message-ID: <20240506125718.26001-3-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <20240506125718.26001-1-ville.syrjala@linux.intel.com>
From: Ville Syrjälä <ville.syrjala@linux.intel.com>
skl_plane_max_stride() is pretty messy. Streamline it and
split it into clear skl+ vs. adl+ variants.
TODO: Deal with icl and tgl strude limits properly
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
.../drm/i915/display/skl_universal_plane.c | 65 +++++++++++--------
1 file changed, 37 insertions(+), 28 deletions(-)
diff --git a/drivers/gpu/drm/i915/display/skl_universal_plane.c b/drivers/gpu/drm/i915/display/skl_universal_plane.c
index 0a8e781a3648..b8103d6ebc1f 100644
--- a/drivers/gpu/drm/i915/display/skl_universal_plane.c
+++ b/drivers/gpu/drm/i915/display/skl_universal_plane.c
@@ -461,41 +461,46 @@ static int icl_plane_max_height(const struct drm_framebuffer *fb,
}
static unsigned int
-skl_plane_max_stride(struct intel_plane *plane,
- u32 pixel_format, u64 modifier,
- unsigned int rotation)
+plane_max_stride(struct intel_plane *plane,
+ u32 pixel_format, u64 modifier,
+ unsigned int rotation,
+ unsigned int max_pixels,
+ unsigned int max_bytes)
{
- struct drm_i915_private *i915 = to_i915(plane->base.dev);
const struct drm_format_info *info = drm_format_info(pixel_format);
int cpp = info->cpp[0];
- int max_horizontal_pixels = 8192;
- int max_stride_bytes;
-
- if (DISPLAY_VER(i915) >= 13) {
- /*
- * The stride in bytes must not exceed of the size
- * of 128K bytes. For pixel formats of 64bpp will allow
- * for a 16K pixel surface.
- */
- max_stride_bytes = 131072;
- if (cpp == 8)
- max_horizontal_pixels = 16384;
- else
- max_horizontal_pixels = 65536;
- } else {
- /*
- * "The stride in bytes must not exceed the
- * of the size of 8K pixels and 32K bytes."
- */
- max_stride_bytes = 32768;
- }
if (drm_rotation_90_or_270(rotation))
- return min(max_horizontal_pixels, max_stride_bytes / cpp);
+ return min(max_pixels, max_bytes / cpp);
else
- return min(max_horizontal_pixels * cpp, max_stride_bytes);
+ return min(max_pixels * cpp, max_bytes);
}
+static unsigned int
+adl_plane_max_stride(struct intel_plane *plane,
+ u32 pixel_format, u64 modifier,
+ unsigned int rotation)
+{
+ unsigned int max_pixels = 65536; /* PLANE_OFFSET limit */
+ unsigned int max_bytes = 128 * 1024;
+
+ return plane_max_stride(plane, pixel_format,
+ modifier, rotation,
+ max_pixels, max_bytes);
+}
+
+static unsigned int
+skl_plane_max_stride(struct intel_plane *plane,
+ u32 pixel_format, u64 modifier,
+ unsigned int rotation)
+{
+ unsigned int max_pixels = 8192; /* PLANE_OFFSET limit */
+ unsigned int max_bytes = 32 * 1024;
+
+ return plane_max_stride(plane, pixel_format,
+ modifier, rotation,
+ max_pixels, max_bytes);
+}
/* Preoffset values for YUV to RGB Conversion */
#define PREOFF_YUV_TO_RGB_HI 0x1800
@@ -2357,7 +2362,11 @@ skl_universal_plane_create(struct drm_i915_private *dev_priv,
plane->min_cdclk = skl_plane_min_cdclk;
}
- plane->max_stride = skl_plane_max_stride;
+ if (DISPLAY_VER(dev_priv) >= 13)
+ plane->max_stride = adl_plane_max_stride;
+ else
+ plane->max_stride = skl_plane_max_stride;
+
if (DISPLAY_VER(dev_priv) >= 11) {
plane->update_noarm = icl_plane_update_noarm;
plane->update_arm = icl_plane_update_arm;
--
2.43.2
next prev parent reply other threads:[~2024-05-06 12:57 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-06 12:57 [PATCH 0/9] drm/i915: Plane fb refactoring Ville Syrjala
2024-05-06 12:57 ` [PATCH 1/9] drm/i915: Split gen2 vs. gen3 .max_stride() Ville Syrjala
2024-05-06 13:57 ` Jani Nikula
2024-05-06 12:57 ` Ville Syrjala [this message]
2024-05-06 14:03 ` [PATCH 2/9] drm/i915: Clean up skl+ plane stride limits Jani Nikula
2024-05-06 16:38 ` Ville Syrjälä
2024-05-07 9:02 ` Jani Nikula
2024-05-06 12:57 ` [PATCH 3/9] drm/i915: Drop 'uses_fence' parameter from intel_pin_fb_obj_dpt() Ville Syrjala
2024-05-06 14:04 ` Jani Nikula
2024-05-06 12:57 ` [PATCH 4/9] drm/i915: Extract intel_plane_needs_physical() Ville Syrjala
2024-05-06 14:05 ` Jani Nikula
2024-05-06 12:57 ` [PATCH 5/9] drm/i915: Polish types in fb calculations Ville Syrjala
2024-05-06 14:07 ` Jani Nikula
2024-05-06 12:57 ` [PATCH 6/9] drm/i915: Constify 'fb' in during pinning Ville Syrjala
2024-05-06 14:11 ` Jani Nikula
2024-05-06 12:57 ` [PATCH 7/9] drm/i915: Change intel_fbdev_fb_alloc() reuturn type Ville Syrjala
2024-05-06 14:16 ` Jani Nikula
2024-05-06 16:51 ` Ville Syrjälä
2024-05-06 18:19 ` Ville Syrjälä
2024-05-10 10:22 ` [PATCH v2 7/9] drm/i915: Change intel_fbdev_fb_alloc() return type Ville Syrjala
2024-05-10 11:30 ` Jani Nikula
2024-05-06 12:57 ` [PATCH 8/9] drm/i915: Cleanup fbdev fb setup Ville Syrjala
2024-05-10 10:22 ` [PATCH v2 " Ville Syrjala
2024-05-10 11:32 ` Jani Nikula
2024-05-06 12:57 ` [PATCH 9/9] drm/i915: Rename the fb pinning functions to indicate the address space Ville Syrjala
2024-05-10 11:35 ` Jani Nikula
2024-05-06 13:02 ` ✓ CI.Patch_applied: success for drm/i915: Plane fb refactoring Patchwork
2024-05-06 13:03 ` ✓ CI.checkpatch: " Patchwork
2024-05-06 13:03 ` ✓ CI.KUnit: " Patchwork
2024-05-06 13:15 ` ✓ CI.Build: " Patchwork
2024-05-06 13:18 ` ✓ CI.Hooks: " Patchwork
2024-05-06 13:19 ` ✗ CI.checksparse: warning " Patchwork
2024-05-06 13:53 ` ✓ CI.BAT: success " Patchwork
2024-05-06 15:07 ` ✓ CI.FULL: " Patchwork
2024-05-10 10:52 ` ✓ CI.Patch_applied: success for drm/i915: Plane fb refactoring (rev3) Patchwork
2024-05-10 10:53 ` ✓ CI.checkpatch: " Patchwork
2024-05-10 10:55 ` ✓ CI.KUnit: " Patchwork
2024-05-10 11:07 ` ✓ CI.Build: " Patchwork
2024-05-10 11:10 ` ✓ CI.Hooks: " Patchwork
2024-05-10 11:11 ` ✗ CI.checksparse: warning " Patchwork
2024-05-10 11:43 ` ✗ CI.BAT: failure " Patchwork
2024-05-10 13:54 ` ✓ CI.FULL: success " Patchwork
2024-05-10 16:55 ` [PATCH 0/9] drm/i915: Plane fb refactoring Ville Syrjälä
2024-05-11 19:00 ` Lucas De Marchi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240506125718.26001-3-ville.syrjala@linux.intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox