[PATCH v6 16/23] drm/probe-helper: Provide a TV get_modes helper
Maxime Ripard
maxime at cerno.tech
Mon Nov 7 04:45:56 PST 2022
On Mon, Nov 07, 2022 at 12:29:28PM +0100, Noralf Trønnes wrote:
>
>
> Den 07.11.2022 11.21, skrev Maxime Ripard:
> > Hi Noralf,
> >
> > I'll leave aside your comments on the code, since we'll use your implementation.
> >
> > On Sun, Nov 06, 2022 at 05:33:48PM +0100, Noralf Trønnes wrote:
> >> Den 26.10.2022 17.33, skrev maxime at cerno.tech:
> >>> +
> >>> + if (cmdline->tv_mode_specified)
> >>> + default_mode = cmdline->tv_mode;
> >>
> >> I realised that we don't verify tv_mode coming from the command line,
> >> not here and not in the reset helper. Should we do that? A driver should
> >> be programmed defensively to handle an illegal/unsupported value, but it
> >> doesn't feel right to allow an illegal enum value coming through the
> >> core/helpers.
> >
> > I don't think we can end up with an invalid value here if it's been
> > specified.
> >
> > We parse the command line through drm_mode_parse_tv_mode() (introduced
> > in patch 13 "drm/modes: Introduce the tv_mode property as a command-line
> > option") that will pick the tv mode part of the command line, and call
> > drm_get_tv_mode_from_name() using it.
> >
> > drm_get_tv_mode_from_name() will return a EINVAL if it's not a value we
> > expect, and mode->tv_mode is only set on success. And AFAIK, there's no
> > other path that will set tv_mode.
> >
>
> I see now that illegal was the wrong word, but if the driver only
> supports ntsc, the user can still set tv_mode=PAL right? And that's an
> unsupported value that the driver can't fulfill, so it errors out. But
> then again maybe that's just how it is, we can also set a display mode
> that the driver can't handle, so this is no different in that respect.
> Yeah, my argument lost some of its strength here :)
I don't think we can handle this better, really. Falling back to NTSC in
that case would really be a stretch: it's a different mode, with a
different TV mode, etc.
It's an even bigger stretch than picking another mode I guess, and like
you said we're not doing that if the mode isn't supported
Maxime
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20221107/45ab8192/attachment.sig>
More information about the linux-arm-kernel
mailing list