[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20221110103638.o3bomslhvb2sj43d@houat>
Date: Thu, 10 Nov 2022 11:36:38 +0100
From: Maxime Ripard <maxime@...no.tech>
To: Noralf Trønnes <noralf@...nnes.org>
Cc: Jani Nikula <jani.nikula@...ux.intel.com>,
Joonas Lahtinen <joonas.lahtinen@...ux.intel.com>,
Tvrtko Ursulin <tvrtko.ursulin@...ux.intel.com>,
Ben Skeggs <bskeggs@...hat.com>,
Rodrigo Vivi <rodrigo.vivi@...el.com>,
Samuel Holland <samuel@...lland.org>,
Jernej Skrabec <jernej.skrabec@...il.com>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Emma Anholt <emma@...olt.net>,
Karol Herbst <kherbst@...hat.com>,
Daniel Vetter <daniel@...ll.ch>, Chen-Yu Tsai <wens@...e.org>,
Lyude Paul <lyude@...hat.com>,
Thomas Zimmermann <tzimmermann@...e.de>,
David Airlie <airlied@...ux.ie>,
Phil Elwell <phil@...pberrypi.com>,
Hans de Goede <hdegoede@...hat.com>,
linux-sunxi@...ts.linux.dev, linux-kernel@...r.kernel.org,
Geert Uytterhoeven <geert@...ux-m68k.org>,
Dave Stevenson <dave.stevenson@...pberrypi.com>,
linux-arm-kernel@...ts.infradead.org,
Dom Cobley <dom@...pberrypi.com>,
Mateusz Kwiatkowski <kfyatek+publicgit@...il.com>,
dri-devel@...ts.freedesktop.org, intel-gfx@...ts.freedesktop.org,
nouveau@...ts.freedesktop.org
Subject: Re: [PATCH v7 14/23] drm/modes: Properly generate a drm_display_mode
from a named mode
On Tue, Nov 08, 2022 at 10:40:07AM +0100, Noralf Trønnes wrote:
>
>
> Den 07.11.2022 18.49, skrev Noralf Trønnes:
> >
> >
> > Den 07.11.2022 15.16, skrev Maxime Ripard:
> >> The framework will get the drm_display_mode from the drm_cmdline_mode it
> >> got by parsing the video command line argument by calling
> >> drm_connector_pick_cmdline_mode().
> >>
> >> The heavy lifting will then be done by the drm_mode_create_from_cmdline_mode()
> >> function.
> >>
> >> In the case of the named modes though, there's no real code to make that
> >> translation and we rely on the drivers to guess which actual display mode
> >> we meant.
> >>
> >> Let's modify drm_mode_create_from_cmdline_mode() to properly generate the
> >> drm_display_mode we mean when passing a named mode.
> >>
> >> Signed-off-by: Maxime Ripard <maxime@...no.tech>
> >>
> >> ---
> >> Changes in v7:
> >> - Use tv_mode_specified in drm_mode_parse_command_line_for_connector
> >>
> >> Changes in v6:
> >> - Fix get_modes to return 0 instead of an error code
> >> - Rename the tests to follow the DRM test naming convention
> >>
> >> Changes in v5:
> >> - Switched to KUNIT_ASSERT_NOT_NULL
> >> ---
> >> drivers/gpu/drm/drm_modes.c | 34 ++++++++++-
> >> drivers/gpu/drm/tests/drm_client_modeset_test.c | 77 ++++++++++++++++++++++++-
> >> 2 files changed, 109 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
> >> index dc037f7ceb37..49441cabdd9d 100644
> >> --- a/drivers/gpu/drm/drm_modes.c
> >> +++ b/drivers/gpu/drm/drm_modes.c
> >> @@ -2497,6 +2497,36 @@ bool drm_mode_parse_command_line_for_connector(const char *mode_option,
> >> }
> >> EXPORT_SYMBOL(drm_mode_parse_command_line_for_connector);
> >>
> >> +static struct drm_display_mode *drm_named_mode(struct drm_device *dev,
> >> + struct drm_cmdline_mode *cmd)
> >> +{
> >> + struct drm_display_mode *mode;
> >> + unsigned int i;
> >> +
> >> + for (i = 0; i < ARRAY_SIZE(drm_named_modes); i++) {
> >> + const struct drm_named_mode *named_mode = &drm_named_modes[i];
> >> +
> >> + if (strcmp(cmd->name, named_mode->name))
> >> + continue;
> >> +
> >> + if (!cmd->tv_mode_specified)
> >> + continue;
> >
> > Only a named mode will set cmd->name, so is this check necessary?
> >
> >> +
> >> + mode = drm_analog_tv_mode(dev,
> >> + named_mode->tv_mode,
> >> + named_mode->pixel_clock_khz * 1000,
> >> + named_mode->xres,
> >> + named_mode->yres,
> >> + named_mode->flags & DRM_MODE_FLAG_INTERLACE);
> >> + if (!mode)
> >> + return NULL;
> >> +
> >> + return mode;
> >
> > You can just return the result from drm_analog_tv_mode() directly.
> >
> > With those considered:
> >
> > Reviewed-by: Noralf Trønnes <noralf@...nnes.org>
> >
>
> I forgot one thing, shouldn't the named mode test in
> drm_connector_pick_cmdline_mode() be removed now that we have proper modes?
Good catch, I've fixed it
Thanks!
Maxime
Download attachment "signature.asc" of type "application/pgp-signature" (229 bytes)
Powered by blists - more mailing lists