44fb34b37bfe91594a07a0f23f23da52bd902176
[openwrt/staging/rmilecki.git] /
1 From decd9119a1379d04b875747405b78427b36b8d88 Mon Sep 17 00:00:00 2001
2 From: 6by9 <6by9@users.noreply.github.com>
3 Date: Fri, 1 Apr 2022 11:31:38 +0100
4 Subject: [PATCH] drm/vc4: Force trigger of dlist update on margins
5 change (#4970)
6
7 When the margins are changed, the dlist needs to be regenerated
8 with the changed updated dest regions for each of the planes.
9
10 Setting the zpos_changed flag is sufficient to trigger that
11 without doing a full modeset, therefore set it should the
12 margins be changed.
13
14 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
15 ---
16 drivers/gpu/drm/vc4/vc4_crtc.c | 14 ++++++++++----
17 drivers/gpu/drm/vc4/vc4_drv.h | 7 +------
18 2 files changed, 11 insertions(+), 10 deletions(-)
19
20 --- a/drivers/gpu/drm/vc4/vc4_crtc.c
21 +++ b/drivers/gpu/drm/vc4/vc4_crtc.c
22 @@ -728,10 +728,16 @@ static int vc4_crtc_atomic_check(struct
23 if (conn_state->crtc != crtc)
24 continue;
25
26 - vc4_state->margins.left = conn_state->tv.margins.left;
27 - vc4_state->margins.right = conn_state->tv.margins.right;
28 - vc4_state->margins.top = conn_state->tv.margins.top;
29 - vc4_state->margins.bottom = conn_state->tv.margins.bottom;
30 + if (memcmp(&vc4_state->margins, &conn_state->tv.margins,
31 + sizeof(vc4_state->margins))) {
32 + memcpy(&vc4_state->margins, &conn_state->tv.margins,
33 + sizeof(vc4_state->margins));
34 +
35 + /* Need to force the dlist entries for all planes to be
36 + * updated so that the dest rectangles are changed.
37 + */
38 + crtc_state->zpos_changed = true;
39 + }
40 break;
41 }
42
43 --- a/drivers/gpu/drm/vc4/vc4_drv.h
44 +++ b/drivers/gpu/drm/vc4/vc4_drv.h
45 @@ -589,12 +589,7 @@ struct vc4_crtc_state {
46 bool txp_armed;
47 unsigned int assigned_channel;
48
49 - struct {
50 - unsigned int left;
51 - unsigned int right;
52 - unsigned int top;
53 - unsigned int bottom;
54 - } margins;
55 + struct drm_connector_tv_margins margins;
56
57 unsigned long hvs_load;
58