Hi
Am 30.10.26 um 14:48 schrieb Ville Syrjälä:
[...]
And how would drivers know that the values are garbage before processing
them?
That's why I added the device wide mode_valid hook. Drivers can
use that to reject garbage before it reaches anything more
sensitive. I have somewhat hard time believing a mode that is
acceptable/reasonable to some real world hardware would fail
in the vblank calculations.
I can think of some drivers with fixed display mode, such as a panel or
the sysfb drivers. If they use vblank timers they might run into that
situation. But it's really a corner case.
Hmm, and I just realized that I haven't actually added any low limit
for the dotclock in i915. I'll go do that now. I think ~10 MHz is
probably a reasonable enough number I can use there.
Even if a driver could program them to hardware, the vblank
helpers could still not process them correctly. Thus leaving the
userspace dis-functional.
I see that we might want a common test function
drm_vblank_check_display_mode() and put it in some central place in the
atomic_check pipeline. At least we'd separate the testing from the
calculation.
Yeah, something like that could work. Though I still
think it'd be better to do it from the driver's mode_valid
hook to reject the bogus stuff even earlier.
That would also filter them out from the connectors' mode
lists. But I suppose you could do the vblank check in
the connector mode filtering unconditionally without
having the driver do it. Or does the buggy userspace also
need the kernel to return bogus modes from getconnector?
How about we add a dedicated mode_fixup helper for vblank validation? It
would run after new CRTC's mode_fixup callback. [1] There we could try
to adapt the CRTC's adjusted_mode. Since we know the bug exactly, we
can try to detect it, fix it, and document it.
[1]
https://elixir.bootlin.com/linux/v7.3/source/drivers/gpu/drm/drm_atomic_helper.c#L508
Best regards
Thomas
--
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
GF: Stefan Gaiser, Jochen Jaser, Abhinav Puri, (HRB 36809, AG Nürnberg)