Message ID | 2eb205da88c3cb19ddf04d167ece4e16a330948b.1657788997.git.geert@linux-m68k.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | drm/modes: Command line mode selection fixes and improvements | expand |
On Thu, Jul 14, 2022 at 11:04:10AM +0200, Geert Uytterhoeven wrote: > 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 <geert@linux-m68k.org> > Reviewed-by: Hans de Goede <hdegoede@redhat.com> Ditto, we should have a test for that Maxime
diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c index bfc3a08614522689..c5f490de70314176 100644 --- a/drivers/gpu/drm/drm_modes.c +++ b/drivers/gpu/drm/drm_modes.c @@ -1827,6 +1827,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 = strchr(name, '-'); + while (bpp_ptr && !isdigit(bpp_ptr[1])) + bpp_ptr = strchr(bpp_ptr + 1, '-'); if (bpp_ptr) bpp_off = bpp_ptr - name;