1 From 6847ea09ea00a9c56d33b4cbaf971c20a08e92f7 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
7 The calculations clipped the right/bottom edge of the clipped
8 range based on the left/top margins.
10 Fixes: 666e73587f90 ("drm/vc4: Take margin setup into account when updating planes")
11 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
13 drivers/gpu/drm/vc4/vc4_plane.c | 8 ++++----
14 1 file changed, 4 insertions(+), 4 deletions(-)
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
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;
27 adjvdisplay = crtc_state->mode.vdisplay - (top + bottom);
28 vc4_pstate->crtc_y = DIV_ROUND_CLOSEST(vc4_pstate->crtc_y *
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;
37 vc4_pstate->crtc_w = DIV_ROUND_CLOSEST(vc4_pstate->crtc_w *