drm/vc4: plane: TPZ scaling modes cannot reduce lbm size when alpha-less

spec says "Note that there is not an extra mode to save memory
for alpha-less formats" in the TPZ section.

Currently, if first plane is RGB888 and scaled down (TPZ)
a second plane will corrupt the LBM and result in garbage

I've also folded in the modification to components to the
function as it seems misplaced

Signed-off-by: Dom Cobley <popcornmix@gmail.com>
This commit is contained in:
Dom Cobley
2025-12-03 17:59:49 +00:00
committed by Phil Elwell
parent d04e379ac5
commit a8c4c464b7

View File

@@ -802,7 +802,10 @@ static unsigned int vc4_lbm_components(const struct drm_plane_state *state,
if (info->is_yuv)
return channel ? 2 : 1;
if (info->has_alpha)
if (vc4_state->y_scaling[channel] == VC4_SCALING_TPZ)
return 4;
if (info->has_alpha && state->alpha == DRM_BLEND_ALPHA_OPAQUE)
return 4;
return 3;
@@ -833,9 +836,6 @@ static unsigned int vc4_lbm_channel_size(const struct drm_plane_state *state,
if (!components)
return 0;
if (state->alpha != DRM_BLEND_ALPHA_OPAQUE && info->has_alpha)
components -= 1;
words = width * wpc * components;
lines = DIV_ROUND_UP(words, 128 / info->hsub);