[PATCH v1 11/35] drm/modes: Fill drm_cmdline mode from named modes
From: Maxime Ripard
Date: Fri Jul 29 2022 - 12:46:50 EST
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.
Signed-off-by: Maxime Ripard <maxime@xxxxxxxxxx>
diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
index 1421e5da49e0..78ea520f2822 100644
--- a/drivers/gpu/drm/drm_modes.c
+++ b/drivers/gpu/drm/drm_modes.c
@@ -1770,11 +1770,12 @@ static int drm_mode_parse_cmdline_options(const char *str,
struct drm_named_mode {
const char *name;
+ const struct drm_display_mode *mode;
};
static const struct drm_named_mode drm_named_modes[] = {
- { "NTSC", },
- { "PAL", },
+ { "NTSC", &drm_mode_480i, },
+ { "PAL", &drm_mode_576i, },
};
static bool drm_mode_parse_cmdline_named_mode(const char *name,
@@ -1792,6 +1793,9 @@ static bool drm_mode_parse_cmdline_named_mode(const char *name,
continue;
strcpy(cmdline_mode->name, mode->name);
+ cmdline_mode->xres = mode->mode->hdisplay;
+ cmdline_mode->yres = mode->mode->vdisplay;
+ cmdline_mode->interlace = !!(mode->mode->flags & DRM_MODE_FLAG_INTERLACE);
cmdline_mode->specified = true;
return true;
--
b4 0.10.0-dev-49460