Skip to contentSkip to conversation

Calling drm_atomic_helper_check_modeset() after drm_atomic_helper_check_planes()

DISCUSSION Jyri Sarha 2 participants 2 messages Jun 19, 2016

lore
Share & tools
lore

Jyri Sarha

author
#0 lore raw

Hi,
The documentation of drm_atomic_helper_check_modeset() says:

"Drivers which update ->mode_changed (e.g. in their ->atomic_check hooks if a plane update can't be done without a full modeset) _must_ call this function afterwards after that change. It is permitted to call this function multiple times for the same update, e.g. when the ->atomic_check functions depend upon the adjusted dotclock for fifo space allocation and watermark computation."

Then drm_crtc_helper_funcs mode_fixup() callback documentations says:

"Atomic drivers which need to inspect and adjust more state should instead use the @atomic_check callback."

Now an atomic driver that needs to do the both in the check phase:
update ->mode_changed and inspect and adjust the mode, is in trouble. This is because any adjusted_mode modifications are reset by the afterwards call of drm_atomic_helper_check_modeset().

I can get the atomic tilcdc driver working either: by using the crtc_helper mode_fixup() calback, tuning the mode once more in mode_set_nofb(), or calling drm_atomic_helper_check_modeset() last in drm_mode_config_funcs atomic_check() callback.

What is the right thing to do? Any of these three approaches (and possibly updating the documentation), or some other option that I did not think of?

Best regards,
Jyri
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#1 lore raw
Quoted 20 lines · Jyri Sarha

Hi,
The documentation of drm_atomic_helper_check_modeset() says:

"Drivers which update ->mode_changed (e.g. in their ->atomic_check hooks if a plane update can't be done without a full modeset) _must_ call this function afterwards after that change. It is permitted to call this function multiple times for the same update, e.g. when the ->atomic_check functions depend upon the adjusted dotclock for fifo space allocation and watermark computation."

Then drm_crtc_helper_funcs mode_fixup() callback documentations says:

"Atomic drivers which need to inspect and adjust more state should instead use the @atomic_check callback."

Now an atomic driver that needs to do the both in the check phase:
update ->mode_changed and inspect and adjust the mode, is in trouble. This is because any adjusted_mode modifications are reset by the afterwards call of drm_atomic_helper_check_modeset().

Quoted 8 lines

I can get the atomic tilcdc driver working either: by using the crtc_helper mode_fixup() calback, tuning the mode once more in mode_set_nofb(), or calling drm_atomic_helper_check_modeset() last in drm_mode_config_funcs atomic_check() callback.

What is the right thing to do? Any of these three approaches (and possibly updating the documentation), or some other option that I did not think of?

Tuning the mode once more in mode_set_nofb is no-go - that's in the commit phase, you're not allowed to change state objects then any more. Also note that the hint for mode_fixup is just a "should", and meant that way. You can split things up between mode_fixup and atomic_check callbacks. Pick whatever works best for you from the other 2 options.

-Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel