Skip to content

Commit c70d8a4

Browse files
Boris Brezillongregkh
authored andcommitted
drm/vc4: Fix the "no scaling" case on multi-planar YUV formats
commit 658d8cb upstream. When there's no scaling requested ->is_unity should be true no matter the format. Also, when no scaling is requested and we have a multi-planar YUV format, we should leave ->y_scaling[0] to VC4_SCALING_NONE and only set ->x_scaling[0] to VC4_SCALING_PPF. Doing this fixes an hardly visible artifact (seen when using modetest and a rather big overlay plane in YUV420). Fixes: fc04023 ("drm/vc4: Add support for YUV planes.") Cc: <stable@vger.kernel.org> Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com> Reviewed-by: Eric Anholt <eric@anholt.net> Link: https://patchwork.freedesktop.org/patch/msgid/20180725122907.13702-1-boris.brezillon@bootlin.com Signed-off-by: Sean Paul <seanpaul@chromium.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 35e48a0 commit c70d8a4

1 file changed

Lines changed: 12 additions & 13 deletions

File tree

drivers/gpu/drm/vc4/vc4_plane.c

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,9 @@ static int vc4_plane_setup_clipping_and_scaling(struct drm_plane_state *state)
329329
vc4_state->y_scaling[0] = vc4_get_scaling_mode(vc4_state->src_h[0],
330330
vc4_state->crtc_h);
331331

332+
vc4_state->is_unity = (vc4_state->x_scaling[0] == VC4_SCALING_NONE &&
333+
vc4_state->y_scaling[0] == VC4_SCALING_NONE);
334+
332335
if (num_planes > 1) {
333336
vc4_state->is_yuv = true;
334337

@@ -344,24 +347,17 @@ static int vc4_plane_setup_clipping_and_scaling(struct drm_plane_state *state)
344347
vc4_get_scaling_mode(vc4_state->src_h[1],
345348
vc4_state->crtc_h);
346349

347-
/* YUV conversion requires that scaling be enabled,
348-
* even on a plane that's otherwise 1:1. Choose TPZ
349-
* for simplicity.
350+
/* YUV conversion requires that horizontal scaling be enabled,
351+
* even on a plane that's otherwise 1:1. Looks like only PPF
352+
* works in that case, so let's pick that one.
350353
*/
351-
if (vc4_state->x_scaling[0] == VC4_SCALING_NONE)
352-
vc4_state->x_scaling[0] = VC4_SCALING_TPZ;
353-
if (vc4_state->y_scaling[0] == VC4_SCALING_NONE)
354-
vc4_state->y_scaling[0] = VC4_SCALING_TPZ;
354+
if (vc4_state->is_unity)
355+
vc4_state->x_scaling[0] = VC4_SCALING_PPF;
355356
} else {
356357
vc4_state->x_scaling[1] = VC4_SCALING_NONE;
357358
vc4_state->y_scaling[1] = VC4_SCALING_NONE;
358359
}
359360

360-
vc4_state->is_unity = (vc4_state->x_scaling[0] == VC4_SCALING_NONE &&
361-
vc4_state->y_scaling[0] == VC4_SCALING_NONE &&
362-
vc4_state->x_scaling[1] == VC4_SCALING_NONE &&
363-
vc4_state->y_scaling[1] == VC4_SCALING_NONE);
364-
365361
/* No configuring scaling on the cursor plane, since it gets
366362
non-vblank-synced updates, and scaling requires requires
367363
LBM changes which have to be vblank-synced.
@@ -639,7 +635,10 @@ static int vc4_plane_mode_set(struct drm_plane *plane,
639635
vc4_dlist_write(vc4_state, SCALER_CSC2_ITR_R_601_5);
640636
}
641637

642-
if (!vc4_state->is_unity) {
638+
if (vc4_state->x_scaling[0] != VC4_SCALING_NONE ||
639+
vc4_state->x_scaling[1] != VC4_SCALING_NONE ||
640+
vc4_state->y_scaling[0] != VC4_SCALING_NONE ||
641+
vc4_state->y_scaling[1] != VC4_SCALING_NONE) {
643642
/* LBM Base Address. */
644643
if (vc4_state->y_scaling[0] != VC4_SCALING_NONE ||
645644
vc4_state->y_scaling[1] != VC4_SCALING_NONE) {

0 commit comments

Comments
 (0)