Skip to content

Commit 1705fe0

Browse files
6by9popcornmix
authored andcommitted
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>
1 parent b0abe78 commit 1705fe0

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

drivers/gpu/drm/vc4/vc4_plane.c

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1895,6 +1895,24 @@ static int vc6_plane_mode_set(struct drm_plane *plane,
18951895

18961896
src_x = vc4_state->src_x >> 16;
18971897

1898+
/* fetch an extra pixel if we don't actually line up with the left edge. */
1899+
if ((vc4_state->src_x & 0xffff) && vc4_state->src_x < (state->fb->width << 16))
1900+
width++;
1901+
1902+
/* same for the right side */
1903+
if (((vc4_state->src_x + vc4_state->src_w[0]) & 0xffff) &&
1904+
vc4_state->src_x + vc4_state->src_w[0] < (state->fb->width << 16))
1905+
width++;
1906+
1907+
/* now for the top */
1908+
if ((vc4_state->src_y & 0xffff) && vc4_state->src_y < (state->fb->height << 16))
1909+
height++;
1910+
1911+
/* and the bottom */
1912+
if (((vc4_state->src_y + vc4_state->src_h[0]) & 0xffff) &&
1913+
vc4_state->src_y + vc4_state->src_h[0] < (state->fb->height << 16))
1914+
height++;
1915+
18981916
switch (base_format_mod) {
18991917
case DRM_FORMAT_MOD_LINEAR:
19001918
tiling = SCALER6_CTL0_ADDR_MODE_LINEAR;
@@ -2016,24 +2034,6 @@ static int vc6_plane_mode_set(struct drm_plane *plane,
20162034
return -EINVAL;
20172035
}
20182036

2019-
/* fetch an extra pixel if we don't actually line up with the left edge. */
2020-
if ((vc4_state->src_x & 0xffff) && vc4_state->src_x < (state->fb->width << 16))
2021-
width++;
2022-
2023-
/* same for the right side */
2024-
if (((vc4_state->src_x + vc4_state->src_w[0]) & 0xffff) &&
2025-
vc4_state->src_x + vc4_state->src_w[0] < (state->fb->width << 16))
2026-
width++;
2027-
2028-
/* now for the top */
2029-
if ((vc4_state->src_y & 0xffff) && vc4_state->src_y < (state->fb->height << 16))
2030-
height++;
2031-
2032-
/* and the bottom */
2033-
if (((vc4_state->src_y + vc4_state->src_h[0]) & 0xffff) &&
2034-
vc4_state->src_y + vc4_state->src_h[0] < (state->fb->height << 16))
2035-
height++;
2036-
20372037
/* for YUV444 hardware wants double the width, otherwise it doesn't
20382038
* fetch full width of chroma
20392039
*/

0 commit comments

Comments
 (0)