[PATCH libdrm] modetest: Add support for named modes containing dashes

Geert Uytterhoeven geert at linux-m68k.org
Fri Jul 8 18:22:26 UTC 2022


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 vertical refrsh.

Fix this by skipping any dashes that are not followed immediately by a
digit when looking for the separator.

Signed-off-by: Geert Uytterhoeven <geert at linux-m68k.org>
---
Please refer to [1] for related Linux DRM patches and background
information.

v2:
  - New.

[1] "[PATCH v3 00/10] drm: Add support for low-color frame buffer formats"
    https://lore.kernel.org/r/cover.1657294931.git.geert@linux-m68k.org
---
 tests/modetest/modetest.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tests/modetest/modetest.c b/tests/modetest/modetest.c
index 7c6c21ef5174c41a..09f026764a07aad9 100644
--- a/tests/modetest/modetest.c
+++ b/tests/modetest/modetest.c
@@ -1903,8 +1903,11 @@ static int parse_connector(struct pipe_arg *pipe, const char *arg)
 
 	arg = endp + 1;
 
-	/* Search for the vertical refresh or the format. */
+	/* Search for the vertical refresh or the format, */
+	/* The former must be followed by a number */
 	p = strpbrk(arg, "-@");
+	while (p && *p == '-' && !isdigit(p[1]))
+		p = strpbrk(p + 1, "-@");
 	if (p == NULL)
 		p = arg + strlen(arg);
 	len = min(sizeof pipe->mode_str - 1, (unsigned int)(p - arg));
-- 
2.25.1



More information about the dri-devel mailing list