05da5d38c51ca2fb8129dc76672fb55fd9554557
[openwrt/staging/ansuel.git] /
1 From bc76ab2e772242d0d92d38b2a5648485ee1a1b44 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Michael=20B=C3=BCchler?= <michael.buechler@posteo.net>
3 Date: Sun, 19 Nov 2023 01:22:20 +0100
4 Subject: [PATCH] drm/vc4: Set TV margins on the composite connector state
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 The Raspberry Pi bootloader can pass a set of margin values to the
10 kernel cmdline as part of the video= option. These should result in
11 black borders on the output to compensate for TVs where the visible area
12 on the screen is smaller than the full extents of the video image.
13
14 With the VC4 driver this currently works on an HDMI connector, but not
15 on a composite video connector.
16
17 The TV margins from the kernel cmdline are available in the
18 drm_cmdline_mode structure of the composite video connector. Apply them
19 to the connector state in the connector reset function. This is how it
20 is implemented for the VC4 HDMI connector.
21
22 Signed-off-by: Michael Büchler <michael.buechler@posteo.net>
23 ---
24 drivers/gpu/drm/vc4/vc4_vec.c | 5 +++++
25 1 file changed, 5 insertions(+)
26
27 --- a/drivers/gpu/drm/vc4/vc4_vec.c
28 +++ b/drivers/gpu/drm/vc4/vc4_vec.c
29 @@ -436,6 +436,9 @@ static void vc4_vec_connector_reset(stru
30 /* preserve TV standard */
31 if (connector->state)
32 connector->state->tv.mode = vc4_vec_get_default_mode(connector);
33 +
34 + /* apply TV margins from the cmdline_mode */
35 + drm_atomic_helper_connector_tv_reset(connector);
36 }
37
38 static int vc4_vec_connector_atomic_check(struct drm_connector *conn,
39 @@ -483,6 +486,8 @@ static int vc4_vec_connector_init(struct
40
41 drm_connector_helper_add(connector, &vc4_vec_connector_helper_funcs);
42
43 + drm_connector_attach_tv_margin_properties(connector);
44 +
45 drm_object_attach_property(&connector->base,
46 dev->mode_config.tv_mode_property,
47 vc4_vec_get_default_mode(connector));