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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx>
---
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@xxxxxxxxxxxxxx
---
 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




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux