Probing modes and validating them

Jose Abreu Jose.Abreu at
Fri Apr 21 12:59:13 UTC 2017

Hi All,

Is there any callback available, at the crtc level, that can
validate the probed modes before making them available for
userspace? I mean: I know that there is connector->mode_valid(),
but I couldn't find any equivalent crtc->mode_valid(). I found
mode_fixup() but this is called after giving the mode to
userspace, which is not what I need.

For reference here is the situation I'm facing:

ARCPGU is a DRM driver that uses ADV7511 as connector/bridge. The
PGU encodes raw video into a stream that ADV can understands and
in order to do this it needs a pixel clock. Currently this pixel
clock value is fixed, so technically arcpgu driver supports only
one video mode. There is a patch currently on discussion that
adds more supported frequencies for arcpgu, but there are still
some frequencies that will not be supported. This is NOT a
limitation in ADV7511, so it doesn't make sense to limit the
available modes in adv, we could instead limit the modes in the
crtc level (i.e. the pgu).

In order to know if a mode can be displayed or not it is as
simple as call clk_round_rate() and check if the returned
frequency is the same. But in order to do this I need some sort
of callback that is called at the crtc level and before
delivering modes to userspace.

I believe this would be a good addition to arcpgu because this
way we wouldn't "fool" userspace by delivering modes that will
fail in atomic check. The user may still specify manually a mode,
this will still fail in atomic check, but the difference is that
this mode will not be in the probed list.

Best regards,

Jose Miguel Abreu

More information about the dri-devel mailing list