Message ID | 20220728-rpi-analog-tv-properties-v6-10-e7792734108f@cerno.tech (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | drm: Analog TV Improvements | expand |
Den 26.10.2022 17.33, skrev maxime@cerno.tech: > 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. > I couldn't find any driver that does that, all I could find that cares about named modes are drm_client. Did I miss something here? Apart from that: Reviewed-by: Noralf Trønnes <noralf@tronnes.org> > 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@cerno.tech> > --- > drivers/gpu/drm/drm_modes.c | 18 ++++++++++++++++-- > 1 file changed, 16 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c > index 7594b657f86a..acee23e1a8b7 100644 > --- a/drivers/gpu/drm/drm_modes.c > +++ b/drivers/gpu/drm/drm_modes.c > @@ -2226,11 +2226,22 @@ static int drm_mode_parse_cmdline_options(const char *str, > > struct drm_named_mode { > 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[] = { > - { "NTSC", }, > - { "PAL", }, > + NAMED_MODE("NTSC", 720, 480, DRM_MODE_FLAG_INTERLACE), > + NAMED_MODE("PAL", 720, 576, DRM_MODE_FLAG_INTERLACE), > }; > > static int drm_mode_parse_cmdline_named_mode(const char *name, > @@ -2271,6 +2282,9 @@ static int drm_mode_parse_cmdline_named_mode(const char *name, > continue; > > 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; > > return 1; >
On Sun, Nov 06, 2022 at 02:04:56PM +0100, Noralf Trønnes wrote: > > > Den 26.10.2022 17.33, skrev maxime@cerno.tech: > > 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. > > > > I couldn't find any driver that does that, all I could find that cares > about named modes are drm_client. Did I miss something here? sun4i at least does it: https://elixir.bootlin.com/linux/latest/source/drivers/gpu/drm/sun4i/sun4i_tv.c#L292 I'm not aware of any other driver relying on named modes though. > Apart from that: > > Reviewed-by: Noralf Trønnes <noralf@tronnes.org> Thanks! Maxime
diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c index 7594b657f86a..acee23e1a8b7 100644 --- a/drivers/gpu/drm/drm_modes.c +++ b/drivers/gpu/drm/drm_modes.c @@ -2226,11 +2226,22 @@ static int drm_mode_parse_cmdline_options(const char *str, struct drm_named_mode { 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[] = { - { "NTSC", }, - { "PAL", }, + NAMED_MODE("NTSC", 720, 480, DRM_MODE_FLAG_INTERLACE), + NAMED_MODE("PAL", 720, 576, DRM_MODE_FLAG_INTERLACE), }; static int drm_mode_parse_cmdline_named_mode(const char *name, @@ -2271,6 +2282,9 @@ static int drm_mode_parse_cmdline_named_mode(const char *name, continue; 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; return 1;
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@cerno.tech> --- drivers/gpu/drm/drm_modes.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)