ced98fd502fc37364d15fe2e66e4d3a7a873a40d
[openwrt/staging/rmilecki.git] /
1 From 0427e8464446a03d287e7ec8b7bb74dd983b6988 Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 Date: Mon, 12 Jul 2021 12:27:59 +0100
4 Subject: [PATCH] drm/vc4: Fix margin calculations for the right/bottom
5 edges
6
7 The calculations clipped the right/bottom edge of the clipped
8 range based on the left/top margins.
9
10 Fixes: 666e73587f90 ("drm/vc4: Take margin setup into account when updating planes")
11 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
12 ---
13 drivers/gpu/drm/vc4/vc4_plane.c | 8 ++++----
14 1 file changed, 4 insertions(+), 4 deletions(-)
15
16 --- a/drivers/gpu/drm/vc4/vc4_plane.c
17 +++ b/drivers/gpu/drm/vc4/vc4_plane.c
18 @@ -310,16 +310,16 @@ static int vc4_plane_margins_adj(struct
19 adjhdisplay,
20 crtc_state->mode.hdisplay);
21 vc4_pstate->crtc_x += left;
22 - if (vc4_pstate->crtc_x > crtc_state->mode.hdisplay - left)
23 - vc4_pstate->crtc_x = crtc_state->mode.hdisplay - left;
24 + if (vc4_pstate->crtc_x > crtc_state->mode.hdisplay - right)
25 + vc4_pstate->crtc_x = crtc_state->mode.hdisplay - right;
26
27 adjvdisplay = crtc_state->mode.vdisplay - (top + bottom);
28 vc4_pstate->crtc_y = DIV_ROUND_CLOSEST(vc4_pstate->crtc_y *
29 adjvdisplay,
30 crtc_state->mode.vdisplay);
31 vc4_pstate->crtc_y += top;
32 - if (vc4_pstate->crtc_y > crtc_state->mode.vdisplay - top)
33 - vc4_pstate->crtc_y = crtc_state->mode.vdisplay - top;
34 + if (vc4_pstate->crtc_y > crtc_state->mode.vdisplay - bottom)
35 + vc4_pstate->crtc_y = crtc_state->mode.vdisplay - bottom;
36
37 vc4_pstate->crtc_w = DIV_ROUND_CLOSEST(vc4_pstate->crtc_w *
38 adjhdisplay,