9454b54b49a16ec4bbd9313782044b90bb5420cd
[openwrt/staging/xback.git] /
1 From e0aaa1acd1f33cc60e2b5c43cf6aac63bf3bbbc9 Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 Date: Mon, 12 Jul 2021 13:06:07 +0100
4 Subject: [PATCH] ydrm/vc4: fkms: Fix margin calculations for the
5 right/bottom edges
6
7 The calculations clipped the right/bottom edge of the clipped
8 range based on the left/top margins.
9
10 https://github.com/raspberrypi/linux/issues/4447
11
12 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
13 ---
14 drivers/gpu/drm/vc4/vc4_firmware_kms.c | 8 ++++----
15 1 file changed, 4 insertions(+), 4 deletions(-)
16
17 --- a/drivers/gpu/drm/vc4/vc4_firmware_kms.c
18 +++ b/drivers/gpu/drm/vc4/vc4_firmware_kms.c
19 @@ -458,15 +458,15 @@ static int vc4_fkms_margins_adj(struct d
20 plane->dst_x = DIV_ROUND_CLOSEST(plane->dst_x * adjhdisplay,
21 (int)crtc_state->mode.hdisplay);
22 plane->dst_x += left;
23 - if (plane->dst_x > (int)(crtc_state->mode.hdisplay - left))
24 - plane->dst_x = crtc_state->mode.hdisplay - left;
25 + if (plane->dst_x > (int)(crtc_state->mode.hdisplay - right))
26 + plane->dst_x = crtc_state->mode.hdisplay - right;
27
28 adjvdisplay = crtc_state->mode.vdisplay - (top + bottom);
29 plane->dst_y = DIV_ROUND_CLOSEST(plane->dst_y * adjvdisplay,
30 (int)crtc_state->mode.vdisplay);
31 plane->dst_y += top;
32 - if (plane->dst_y > (int)(crtc_state->mode.vdisplay - top))
33 - plane->dst_y = crtc_state->mode.vdisplay - top;
34 + if (plane->dst_y > (int)(crtc_state->mode.vdisplay - bottom))
35 + plane->dst_y = crtc_state->mode.vdisplay - bottom;
36
37 plane->dst_w = DIV_ROUND_CLOSEST(plane->dst_w * adjhdisplay,
38 crtc_state->mode.hdisplay);