Skip to content

Commit d65bae9

Browse files
committed
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 <[email protected]>
1 parent e06f200 commit d65bae9

File tree

1 file changed

+19
-18
lines changed

1 file changed

+19
-18
lines changed

drivers/gpu/drm/vc4/vc4_plane.c

+19-18
Original file line numberDiff line numberDiff line change
@@ -1892,6 +1892,24 @@ static int vc6_plane_mode_set(struct drm_plane *plane,
18921892

18931893
src_x = vc4_state->src_x >> 16;
18941894

1895+
/* fetch an extra pixel if we don't actually line up with the left edge. */
1896+
if ((vc4_state->src_x & 0xffff) && vc4_state->src_x < (state->fb->width << 16))
1897+
width++;
1898+
1899+
/* same for the right side */
1900+
if (((vc4_state->src_x + vc4_state->src_w[0]) & 0xffff) &&
1901+
vc4_state->src_x + vc4_state->src_w[0] < (state->fb->width << 16))
1902+
width++;
1903+
1904+
/* now for the top */
1905+
if ((vc4_state->src_y & 0xffff) && vc4_state->src_y < (state->fb->height << 16))
1906+
height++;
1907+
1908+
/* and the bottom */
1909+
if (((vc4_state->src_y + vc4_state->src_h[0]) & 0xffff) &&
1910+
vc4_state->src_y + vc4_state->src_h[0] < (state->fb->height << 16))
1911+
height++;
1912+
18951913
switch (base_format_mod) {
18961914
case DRM_FORMAT_MOD_LINEAR:
18971915
tiling = SCALER6_CTL0_ADDR_MODE_LINEAR;
@@ -1983,6 +2001,7 @@ static int vc6_plane_mode_set(struct drm_plane *plane,
19832001

19842002
x_off = aligned * 32 + last_bits;
19852003
pix_per_tile = 96;
2004+
19862005
} else {
19872006
pix_per_tile = tile_width / fb->format->cpp[0];
19882007
x_off = (src_x % pix_per_tile) /
@@ -2013,24 +2032,6 @@ static int vc6_plane_mode_set(struct drm_plane *plane,
20132032
return -EINVAL;
20142033
}
20152034

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

0 commit comments

Comments
 (0)