drm/modes: Fix the command line parser to take force options into account
The command line parser when it has been rewritten introduced a regression
when the only thing on the command line is an option to force the detection
of a connector (such as video=HDMI-A-1:d), which are completely valid.
It's been further broken by the support for the named modes which take
anything that is not a resolution as a named mode.
Let's fix this by running the extra command line option parser on the named
modes if they only take a single character.
Fixes: e08ab74bd4
("drm/modes: Rewrite the command line parser")
Reported-by: Jernej Škrabec <jernej.skrabec@gmail.com>
Reported-by: Thomas Graichen <thomas.graichen@googlemail.com>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Tested-by: Thomas Graichen <thomas.graichen@gmail.com>
Reviewed-by: Jernej Skrabec <jernej.skrabec@siol.net>
Signed-off-by: Maxime Ripard <mripard@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20190827115850.25731-2-mripard@kernel.org
This commit is contained in:
parent
325d0ab3a1
commit
728a257f65
|
@ -1733,16 +1733,30 @@ bool drm_mode_parse_command_line_for_connector(const char *mode_option,
|
||||||
* bunch of things:
|
* bunch of things:
|
||||||
* - We need to make sure that the first character (which
|
* - We need to make sure that the first character (which
|
||||||
* would be our resolution in X) is a digit.
|
* would be our resolution in X) is a digit.
|
||||||
* - However, if the X resolution is missing, then we end up
|
* - If not, then it's either a named mode or a force on/off.
|
||||||
* with something like x<yres>, with our first character
|
* To distinguish between the two, we need to run the
|
||||||
* being an alpha-numerical character, which would be
|
* extra parsing function, and if not, then we consider it
|
||||||
* considered a named mode.
|
* a named mode.
|
||||||
*
|
*
|
||||||
* If this isn't enough, we should add more heuristics here,
|
* If this isn't enough, we should add more heuristics here,
|
||||||
* and matching unit-tests.
|
* and matching unit-tests.
|
||||||
*/
|
*/
|
||||||
if (!isdigit(name[0]) && name[0] != 'x')
|
if (!isdigit(name[0]) && name[0] != 'x') {
|
||||||
|
unsigned int namelen = strlen(name);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Only the force on/off options can be in that case,
|
||||||
|
* and they all take a single character.
|
||||||
|
*/
|
||||||
|
if (namelen == 1) {
|
||||||
|
ret = drm_mode_parse_cmdline_extra(name, namelen, true,
|
||||||
|
connector, mode);
|
||||||
|
if (!ret)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
named_mode = true;
|
named_mode = true;
|
||||||
|
}
|
||||||
|
|
||||||
/* Try to locate the bpp and refresh specifiers, if any */
|
/* Try to locate the bpp and refresh specifiers, if any */
|
||||||
bpp_ptr = strchr(name, '-');
|
bpp_ptr = strchr(name, '-');
|
||||||
|
|
Loading…
Reference in New Issue