Commit 00dcc4a2 authored by Maxime Ripard's avatar Maxime Ripard

drm/modes: Fill drm_cmdline mode from named modes

The current code to deal with named modes will only set the mode name, and
then it's up to drivers to try to match that name to whatever mode or
configuration they see fit.

The plan is to remove that need and move the named mode handling out of
drivers and into the core, and only rely on modes and properties. Let's
start by properly filling drm_cmdline_mode from a named mode.
Reviewed-by: default avatarNoralf Trønnes <noralf@tronnes.org>
Tested-by: default avatarMateusz Kwiatkowski <kfyatek+publicgit@gmail.com>
Link: https://lore.kernel.org/r/20220728-rpi-analog-tv-properties-v9-11-24b168e5bcd5@cerno.techSigned-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
parent a7ab1553
...@@ -1752,11 +1752,22 @@ static int drm_mode_parse_cmdline_options(const char *str, ...@@ -1752,11 +1752,22 @@ static int drm_mode_parse_cmdline_options(const char *str,
struct drm_named_mode { struct drm_named_mode {
const char *name; const char *name;
unsigned int xres;
unsigned int yres;
unsigned int flags;
}; };
#define NAMED_MODE(_name, _x, _y, _flags) \
{ \
.name = _name, \
.xres = _x, \
.yres = _y, \
.flags = _flags, \
}
static const struct drm_named_mode drm_named_modes[] = { static const struct drm_named_mode drm_named_modes[] = {
{ "NTSC", }, NAMED_MODE("NTSC", 720, 480, DRM_MODE_FLAG_INTERLACE),
{ "PAL", }, NAMED_MODE("PAL", 720, 576, DRM_MODE_FLAG_INTERLACE),
}; };
static int drm_mode_parse_cmdline_named_mode(const char *name, static int drm_mode_parse_cmdline_named_mode(const char *name,
...@@ -1797,6 +1808,9 @@ static int drm_mode_parse_cmdline_named_mode(const char *name, ...@@ -1797,6 +1808,9 @@ static int drm_mode_parse_cmdline_named_mode(const char *name,
continue; continue;
strcpy(cmdline_mode->name, mode->name); strcpy(cmdline_mode->name, mode->name);
cmdline_mode->xres = mode->xres;
cmdline_mode->yres = mode->yres;
cmdline_mode->interlace = !!(mode->flags & DRM_MODE_FLAG_INTERLACE);
cmdline_mode->specified = true; cmdline_mode->specified = true;
return 1; return 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment