From bc76ab2e772242d0d92d38b2a5648485ee1a1b44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20B=C3=BCchler?= 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 --- 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));