]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.9.130/drm-vc4-fix-the-no-scaling-case-on-multi-planar-yuv-formats.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.9.130 / drm-vc4-fix-the-no-scaling-case-on-multi-planar-yuv-formats.patch
1 From 658d8cbd07dae22ccecf49399e18c609c4e85c53 Mon Sep 17 00:00:00 2001
2 From: Boris Brezillon <boris.brezillon@bootlin.com>
3 Date: Wed, 25 Jul 2018 14:29:07 +0200
4 Subject: drm/vc4: Fix the "no scaling" case on multi-planar YUV formats
5
6 From: Boris Brezillon <boris.brezillon@bootlin.com>
7
8 commit 658d8cbd07dae22ccecf49399e18c609c4e85c53 upstream.
9
10 When there's no scaling requested ->is_unity should be true no matter
11 the format.
12
13 Also, when no scaling is requested and we have a multi-planar YUV
14 format, we should leave ->y_scaling[0] to VC4_SCALING_NONE and only
15 set ->x_scaling[0] to VC4_SCALING_PPF.
16
17 Doing this fixes an hardly visible artifact (seen when using modetest
18 and a rather big overlay plane in YUV420).
19
20 Fixes: fc04023fafec ("drm/vc4: Add support for YUV planes.")
21 Cc: <stable@vger.kernel.org>
22 Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
23 Reviewed-by: Eric Anholt <eric@anholt.net>
24 Link: https://patchwork.freedesktop.org/patch/msgid/20180725122907.13702-1-boris.brezillon@bootlin.com
25 Signed-off-by: Sean Paul <seanpaul@chromium.org>
26 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
27
28 ---
29 drivers/gpu/drm/vc4/vc4_plane.c | 25 ++++++++++++-------------
30 1 file changed, 12 insertions(+), 13 deletions(-)
31
32 --- a/drivers/gpu/drm/vc4/vc4_plane.c
33 +++ b/drivers/gpu/drm/vc4/vc4_plane.c
34 @@ -327,6 +327,9 @@ static int vc4_plane_setup_clipping_and_
35 vc4_state->y_scaling[0] = vc4_get_scaling_mode(vc4_state->src_h[0],
36 vc4_state->crtc_h);
37
38 + vc4_state->is_unity = (vc4_state->x_scaling[0] == VC4_SCALING_NONE &&
39 + vc4_state->y_scaling[0] == VC4_SCALING_NONE);
40 +
41 if (num_planes > 1) {
42 vc4_state->is_yuv = true;
43
44 @@ -342,24 +345,17 @@ static int vc4_plane_setup_clipping_and_
45 vc4_get_scaling_mode(vc4_state->src_h[1],
46 vc4_state->crtc_h);
47
48 - /* YUV conversion requires that scaling be enabled,
49 - * even on a plane that's otherwise 1:1. Choose TPZ
50 - * for simplicity.
51 + /* YUV conversion requires that horizontal scaling be enabled,
52 + * even on a plane that's otherwise 1:1. Looks like only PPF
53 + * works in that case, so let's pick that one.
54 */
55 - if (vc4_state->x_scaling[0] == VC4_SCALING_NONE)
56 - vc4_state->x_scaling[0] = VC4_SCALING_TPZ;
57 - if (vc4_state->y_scaling[0] == VC4_SCALING_NONE)
58 - vc4_state->y_scaling[0] = VC4_SCALING_TPZ;
59 + if (vc4_state->is_unity)
60 + vc4_state->x_scaling[0] = VC4_SCALING_PPF;
61 } else {
62 vc4_state->x_scaling[1] = VC4_SCALING_NONE;
63 vc4_state->y_scaling[1] = VC4_SCALING_NONE;
64 }
65
66 - vc4_state->is_unity = (vc4_state->x_scaling[0] == VC4_SCALING_NONE &&
67 - vc4_state->y_scaling[0] == VC4_SCALING_NONE &&
68 - vc4_state->x_scaling[1] == VC4_SCALING_NONE &&
69 - vc4_state->y_scaling[1] == VC4_SCALING_NONE);
70 -
71 /* No configuring scaling on the cursor plane, since it gets
72 non-vblank-synced updates, and scaling requires requires
73 LBM changes which have to be vblank-synced.
74 @@ -614,7 +610,10 @@ static int vc4_plane_mode_set(struct drm
75 vc4_dlist_write(vc4_state, SCALER_CSC2_ITR_R_601_5);
76 }
77
78 - if (!vc4_state->is_unity) {
79 + if (vc4_state->x_scaling[0] != VC4_SCALING_NONE ||
80 + vc4_state->x_scaling[1] != VC4_SCALING_NONE ||
81 + vc4_state->y_scaling[0] != VC4_SCALING_NONE ||
82 + vc4_state->y_scaling[1] != VC4_SCALING_NONE) {
83 /* LBM Base Address. */
84 if (vc4_state->y_scaling[0] != VC4_SCALING_NONE ||
85 vc4_state->y_scaling[1] != VC4_SCALING_NONE) {