diff mbox series

drm/i915: Allow gen11 to use over 32k long strides

Message ID 1569233870-15007-1-git-send-email-juhapekka.heikkila@gmail.com (mailing list archive)
State New, archived
Headers show
Series drm/i915: Allow gen11 to use over 32k long strides | expand

Commit Message

Juha-Pekka Heikkila Sept. 23, 2019, 10:17 a.m. UTC
The stride in bytes must not exceed the size of 8K pixels.
Linear 64 bpp pixel format maximum stride in tiles is 1024
which would mean gen11 support 64k long stride.

Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
---
 drivers/gpu/drm/i915/display/intel_sprite.c | 30 +++++++++++++++++++++++------
 1 file changed, 24 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_sprite.c b/drivers/gpu/drm/i915/display/intel_sprite.c
index 7a7078d..9456a11 100644
--- a/drivers/gpu/drm/i915/display/intel_sprite.c
+++ b/drivers/gpu/drm/i915/display/intel_sprite.c
@@ -330,16 +330,34 @@  skl_plane_max_stride(struct intel_plane *plane,
 		     unsigned int rotation)
 {
 	const struct drm_format_info *info = drm_format_info(pixel_format);
+	struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
 	int cpp = info->cpp[0];
+	int max_stride_bytes;
+
+	if (INTEL_GEN(dev_priv) >= 11) {
+		/*
+		 * The stride in bytes must not exceed the
+		 * size of 8K pixels. Linear 64 bpp pixel format
+		 * Maximum Stride in tiles = 1024
+		 * which would mean ICL support 64k long stride.
+		 * Linear modifier seems to not work with maximum length.
+		 */
+		if (modifier == DRM_FORMAT_MOD_LINEAR)
+			max_stride_bytes = 65536-64;
+		else
+			max_stride_bytes = 65536;
+	} else {
+		/*
+		 * "The stride in bytes must not exceed the
+		 * of the size of 8K pixels and 32K bytes."
+		 */
+		max_stride_bytes = 32768;
+	}
 
-	/*
-	 * "The stride in bytes must not exceed the
-	 * of the size of 8K pixels and 32K bytes."
-	 */
 	if (drm_rotation_90_or_270(rotation))
-		return min(8192, 32768 / cpp);
+		return min(8192, max_stride_bytes / cpp);
 	else
-		return min(8192 * cpp, 32768);
+		return min(8192 * cpp, max_stride_bytes);
 }
 
 static void