bcm27xx: add support for linux v5.15
[openwrt/staging/chunkeey.git] / target / linux / bcm27xx / patches-5.15 / 950-0912-drm-atomic-If-margins-are-updated-update-all-planes.patch
1 From 75b6b04cdb54b2e91c0fd344ffc967ce64ddccd7 Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 Date: Fri, 1 Apr 2022 17:10:37 +0100
4 Subject: [PATCH] drm/atomic: If margins are updated, update all
5 planes.
6
7 Margins may be implemented by scaling the planes, but as there
8 is no way of intercepting the set_property for a standard property,
9 and all planes are checked in drm_atomic_check_only before the
10 connectors, there's now way to add the planes into the state
11 from the driver.
12
13 If the margin properties change, add all corresponding planes to
14 the state.
15
16 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
17 ---
18 drivers/gpu/drm/drm_atomic_uapi.c | 11 +++++++++++
19 1 file changed, 11 insertions(+)
20
21 --- a/drivers/gpu/drm/drm_atomic_uapi.c
22 +++ b/drivers/gpu/drm/drm_atomic_uapi.c
23 @@ -715,6 +715,7 @@ static int drm_atomic_connector_set_prop
24 {
25 struct drm_device *dev = connector->dev;
26 struct drm_mode_config *config = &dev->mode_config;
27 + bool margins_updated = false;
28 bool replaced = false;
29 int ret;
30
31 @@ -734,12 +735,16 @@ static int drm_atomic_connector_set_prop
32 state->tv.subconnector = val;
33 } else if (property == config->tv_left_margin_property) {
34 state->tv.margins.left = val;
35 + margins_updated = true;
36 } else if (property == config->tv_right_margin_property) {
37 state->tv.margins.right = val;
38 + margins_updated = true;
39 } else if (property == config->tv_top_margin_property) {
40 state->tv.margins.top = val;
41 + margins_updated = true;
42 } else if (property == config->tv_bottom_margin_property) {
43 state->tv.margins.bottom = val;
44 + margins_updated = true;
45 } else if (property == config->tv_mode_property) {
46 state->tv.mode = val;
47 } else if (property == config->tv_brightness_property) {
48 @@ -818,6 +823,12 @@ static int drm_atomic_connector_set_prop
49 return -EINVAL;
50 }
51
52 + if (margins_updated && state->crtc) {
53 + ret = drm_atomic_add_affected_planes(state->state, state->crtc);
54 +
55 + return ret;
56 + }
57 +
58 return 0;
59 }
60