Skip to content

Commit 5fabbfd

Browse files
6by9popcornmix
authored andcommitted
drm: vc4: plane: Avoid using pitch in calculating UBM for SAND
The SAND modifier with height 0 is now using the provided pitch as the column stride, but the UBM allocation needs to be done based on the plane width. Recompute the width in these conditions. Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
1 parent ee7a86b commit 5fabbfd

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

drivers/gpu/drm/vc4/vc4_plane.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -843,7 +843,14 @@ static size_t vc6_upm_size(const struct drm_plane_state *state,
843843
{
844844
const struct vc4_plane_state *vc4_state = to_vc4_plane_state(state);
845845
unsigned int stride = state->fb->pitches[plane];
846+
u64 base_format_mod = fourcc_mod_broadcom_mod(state->fb->modifier);
846847

848+
if (base_format_mod == DRM_FORMAT_MOD_BROADCOM_SAND128) {
849+
if (state->fb->format->format == DRM_FORMAT_P030)
850+
stride = (ALIGN(state->fb->width, 96) * 4) / 3;
851+
else
852+
stride = ALIGN(state->fb->width, 128);
853+
}
847854
/*
848855
* TODO: This only works for raster formats, and is sub-optimal
849856
* for buffers with a stride aligned on 32 bytes.

0 commit comments

Comments
 (0)