summaryrefslogtreecommitdiffstats
path: root/target/linux/bcm27xx/patches-6.1/950-1169-drm-vc4-Set-TV-margins-on-the-composite-connector-st.patch
blob: 05da5d38c51ca2fb8129dc76672fb55fd9554557 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
From bc76ab2e772242d0d92d38b2a5648485ee1a1b44 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20B=C3=BCchler?= <michael.buechler@posteo.net>
Date: Sun, 19 Nov 2023 01:22:20 +0100
Subject: [PATCH] drm/vc4: Set TV margins on the composite connector state
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The Raspberry Pi bootloader can pass a set of margin values to the
kernel cmdline as part of the video= option. These should result in
black borders on the output to compensate for TVs where the visible area
on the screen is smaller than the full extents of the video image.

With the VC4 driver this currently works on an HDMI connector, but not
on a composite video connector.

The TV margins from the kernel cmdline are available in the
drm_cmdline_mode structure of the composite video connector. Apply them
to the connector state in the connector reset function. This is how it
is implemented for the VC4 HDMI connector.

Signed-off-by: Michael Büchler <michael.buechler@posteo.net>
---
 drivers/gpu/drm/vc4/vc4_vec.c | 5 +++++
 1 file changed, 5 insertions(+)

--- a/drivers/gpu/drm/vc4/vc4_vec.c
+++ b/drivers/gpu/drm/vc4/vc4_vec.c
@@ -436,6 +436,9 @@ static void vc4_vec_connector_reset(stru
 	/* preserve TV standard */
 	if (connector->state)
 		connector->state->tv.mode = vc4_vec_get_default_mode(connector);
+
+	/* apply TV margins from the cmdline_mode */
+	drm_atomic_helper_connector_tv_reset(connector);
 }
 
 static int vc4_vec_connector_atomic_check(struct drm_connector *conn,
@@ -483,6 +486,8 @@ static int vc4_vec_connector_init(struct
 
 	drm_connector_helper_add(connector, &vc4_vec_connector_helper_funcs);
 
+	drm_connector_attach_tv_margin_properties(connector);
+
 	drm_object_attach_property(&connector->base,
 				   dev->mode_config.tv_mode_property,
 				   vc4_vec_get_default_mode(connector));