2022-08-29 13:19:35

by Maxime Ripard

[permalink] [raw]
Subject: [PATCH v2 12/41] drm/modes: parse_cmdline: Add support for named modes containing dashes

From: Geert Uytterhoeven <[email protected]>



It is fairly common for named video modes to contain dashes (e.g.

"tt-mid" on Atari, "dblntsc-ff" on Amiga). Currently such mode names

are not recognized, as the dash is considered to be a separator between

mode name and bpp.



Fix this by skipping any dashes that are not followed immediately by a

digit when looking for the separator.



Signed-off-by: Geert Uytterhoeven <[email protected]>

Reviewed-by: Hans de Goede <[email protected]>

Signed-off-by: Maxime Ripard <[email protected]>



diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c

index b4e1ff56b4d8..99a21e5cd00d 100644

--- a/drivers/gpu/drm/drm_modes.c

+++ b/drivers/gpu/drm/drm_modes.c

@@ -2263,6 +2263,8 @@ bool drm_mode_parse_command_line_for_connector(const char *mode_option,



/* Try to locate the bpp and refresh specifiers, if any */

bpp_ptr = strnchr(name, options_off, '-');

+ while (bpp_ptr && !isdigit(bpp_ptr[1]))

+ bpp_ptr = strnchr(bpp_ptr + 1, options_off, '-');

if (bpp_ptr)

bpp_off = bpp_ptr - name;





--

b4 0.10.0-dev-65ba7