lede/target/linux/bcm27xx/patches-6.12/950-0938-drm-vc4-plane-Ensure-fetch_count-is-sufficient-for-h.patch
=?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= d81c03f05e bcm27xx: add 6.12 patches from RPi repo
These patches were generated from:
https://github.com/raspberrypi/linux/commits/rpi-6.12.y
With the following command:
git format-patch -N v6.12.27..HEAD
(HEAD -> 8d3206ee456a5ecdf9ddbfd8e5e231e4f0cd716e)

Exceptions:
- (def)configs patches
- github workflows patches
- applied & reverted patches
- readme patches
- wireless patches

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2025-06-20 17:01:06 +08:00

74 lines
2.5 KiB
Diff

From 350deb5c2d225a8ac1689b881d06000eb0c3de45 Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
Date: Mon, 31 Mar 2025 17:03:40 +0100
Subject: [PATCH] drm/vc4: plane: Ensure fetch_count is sufficient for hw in
SAND mode
The number of words to fetch for SAND formats on vc6 needs to account
for all pixels requested by width.
If cropping fractional pixels, then the width was being increased, but
fetch_count had already been computed. That led to insufficient words
being fetched, and the HVS locked up solid.
Apply the fixup for fractional pixel source cropping before computing
fetch_count.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
---
drivers/gpu/drm/vc4/vc4_plane.c | 36 ++++++++++++++++-----------------
1 file changed, 18 insertions(+), 18 deletions(-)
--- a/drivers/gpu/drm/vc4/vc4_plane.c
+++ b/drivers/gpu/drm/vc4/vc4_plane.c
@@ -1892,6 +1892,24 @@ static int vc6_plane_mode_set(struct drm
src_x = vc4_state->src_x >> 16;
+ /* fetch an extra pixel if we don't actually line up with the left edge. */
+ if ((vc4_state->src_x & 0xffff) && vc4_state->src_x < (state->fb->width << 16))
+ width++;
+
+ /* same for the right side */
+ if (((vc4_state->src_x + vc4_state->src_w[0]) & 0xffff) &&
+ vc4_state->src_x + vc4_state->src_w[0] < (state->fb->width << 16))
+ width++;
+
+ /* now for the top */
+ if ((vc4_state->src_y & 0xffff) && vc4_state->src_y < (state->fb->height << 16))
+ height++;
+
+ /* and the bottom */
+ if (((vc4_state->src_y + vc4_state->src_h[0]) & 0xffff) &&
+ vc4_state->src_y + vc4_state->src_h[0] < (state->fb->height << 16))
+ height++;
+
switch (base_format_mod) {
case DRM_FORMAT_MOD_LINEAR:
tiling = SCALER6_CTL0_ADDR_MODE_LINEAR;
@@ -2013,24 +2031,6 @@ static int vc6_plane_mode_set(struct drm
return -EINVAL;
}
- /* fetch an extra pixel if we don't actually line up with the left edge. */
- if ((vc4_state->src_x & 0xffff) && vc4_state->src_x < (state->fb->width << 16))
- width++;
-
- /* same for the right side */
- if (((vc4_state->src_x + vc4_state->src_w[0]) & 0xffff) &&
- vc4_state->src_x + vc4_state->src_w[0] < (state->fb->width << 16))
- width++;
-
- /* now for the top */
- if ((vc4_state->src_y & 0xffff) && vc4_state->src_y < (state->fb->height << 16))
- height++;
-
- /* and the bottom */
- if (((vc4_state->src_y + vc4_state->src_h[0]) & 0xffff) &&
- vc4_state->src_y + vc4_state->src_h[0] < (state->fb->height << 16))
- height++;
-
/* for YUV444 hardware wants double the width, otherwise it doesn't
* fetch full width of chroma
*/