Skip to content

Commit 00dcc4a

Browse files
committed
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: Noralf Trønnes <[email protected]> Tested-by: Mateusz Kwiatkowski <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Maxime Ripard <[email protected]>
1 parent a7ab155 commit 00dcc4a

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

drivers/gpu/drm/drm_modes.c

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1752,11 +1752,22 @@ static int drm_mode_parse_cmdline_options(const char *str,
17521752

17531753
struct drm_named_mode {
17541754
const char *name;
1755+
unsigned int xres;
1756+
unsigned int yres;
1757+
unsigned int flags;
17551758
};
17561759

1760+
#define NAMED_MODE(_name, _x, _y, _flags) \
1761+
{ \
1762+
.name = _name, \
1763+
.xres = _x, \
1764+
.yres = _y, \
1765+
.flags = _flags, \
1766+
}
1767+
17571768
static const struct drm_named_mode drm_named_modes[] = {
1758-
{ "NTSC", },
1759-
{ "PAL", },
1769+
NAMED_MODE("NTSC", 720, 480, DRM_MODE_FLAG_INTERLACE),
1770+
NAMED_MODE("PAL", 720, 576, DRM_MODE_FLAG_INTERLACE),
17601771
};
17611772

17621773
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,
17971808
continue;
17981809

17991810
strcpy(cmdline_mode->name, mode->name);
1811+
cmdline_mode->xres = mode->xres;
1812+
cmdline_mode->yres = mode->yres;
1813+
cmdline_mode->interlace = !!(mode->flags & DRM_MODE_FLAG_INTERLACE);
18001814
cmdline_mode->specified = true;
18011815

18021816
return 1;

0 commit comments

Comments
 (0)