Skip to content

Commit e8eacb8

Browse files
committed
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 <[email protected]>
1 parent 476f31e commit e8eacb8

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

drivers/gpu/drm/vc4/vc4_plane.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -802,7 +802,12 @@ static unsigned int vc4_lbm_components(const struct drm_plane_state *state,
802802
if (info->is_yuv)
803803
return channel ? 2 : 1;
804804

805-
if (info->has_alpha)
805+
// spec says "Note that there is not an extra mode to save memory
806+
// for alpha-less formats" in the TPZ section
807+
if (vc4_state->y_scaling[channel] == VC4_SCALING_TPZ)
808+
return 4;
809+
810+
if (info->has_alpha && state->alpha == DRM_BLEND_ALPHA_OPAQUE)
806811
return 4;
807812

808813
return 3;
@@ -833,9 +838,6 @@ static unsigned int vc4_lbm_channel_size(const struct drm_plane_state *state,
833838
if (!components)
834839
return 0;
835840

836-
if (state->alpha != DRM_BLEND_ALPHA_OPAQUE && info->has_alpha)
837-
components -= 1;
838-
839841
words = width * wpc * components;
840842

841843
lines = DIV_ROUND_UP(words, 128 / info->hsub);

0 commit comments

Comments
 (0)