IMPLEMENTING NONBLOCKING COMMIT(9)
π implementing nonblocking commit β Kernel API Manual β¨
okay so bestie, welcome to the Kernel API Manual entry on implementing nonblocking commit π this is the one where we make atomic commits happen without blocking everything, and honestly it's giving main character energy π
πΈ NAME πΈ
implementing nonblocking commit β the whole vibe of doing atomic commits asynchronously, no cap β¨
π¦ DESCRIPTION π¦
Nonblocking atomic commits should use struct drm_crtc_commit to sequence different operations against each another, fr fr. Locks β especially struct drm_modeset_lock β should not be held in worker threads or any other asynchronous context used to commit the hardware state. literally do not do it π
drm_atomic_helper_commit implements the recommended sequence for nonblocking commits, using drm_atomic_helper_setup_commit internally. slay π
- Run
drm_atomic_helper_prepare_planes. Since this can fail and we need to propagate out of memory/VRAM errors to userspace, it must be called synchronously. no skipping, bestie π - Synchronize with any outstanding nonblocking commit worker threads which might be affected by the new state update. This is handled by
drm_atomic_helper_setup_commit. π«Ά
Asynchronous workers need to have sufficient parallelism to be able to run different atomic commits on different CRTCs in parallel. The simplest way to achieve this is by running them on the system_dfl_wq work queue. Note that drivers are not required to split up atomic commits and run an individual commit in parallel β userspace is supposed to do that if it cares. But it might be beneficial to do that for modesets, since those necessarily must be done as one global operation, and enabling or disabling a CRTC can take a long time. But even that is not required. β
IMPORTANT: Adrm_atomic_commitupdate for multiple CRTCs is sequenced against all CRTCs therein. Therefore for atomic state updates which only flip planes the driver must not get thestruct drm_crtc_stateof unrelated CRTCs in its atomic check code: This would prevent committing of atomic updates to multiple CRTCs in parallel. In general, adding additional state structures should be avoided as much as possible, because this reduces parallelism in (nonblocking) commits, both due to locking and due to commit sequencing requirements. π like, don't do it, iykyk
- The software state is updated synchronously with
drm_atomic_helper_swap_state. Doing this under the protection of all modeset locks means concurrent callers never see inconsistent state. Note that commit workers do not hold any locks; their access is only coordinated through ordering. If workers would access state only through the pointers in the free-standing state objects (currently not the case for any driver) then even multiple pending commits could be in-flight at the same time. π§ - Schedule a work item to do all subsequent steps, using the split-out commit helpers: a) pre-plane commit b) plane commit c) post-plane commit and then cleaning up the framebuffers after the old framebuffer is no longer being displayed. The scheduled work should synchronize against other workers using the
drm_crtc_commitinfrastructure as needed. Seedrm_atomic_helper_setup_commitfor more details. β¨
π₯ SEE ALSO π₯
the whole friend group, assembled π
- Kernel file
./drivers/gpu/drm/drm_atomic_helper.coverview(9) drm_atomic_helper_check_modeset(9)drm_atomic_helper_check_wb_connector_state(9)drm_atomic_helper_check_plane_state(9)drm_atomic_helper_check_crtc_primary_plane(9)drm_atomic_helper_check_planes(9)drm_atomic_helper_check(9)drm_atomic_helper_commit_encoder_bridge_disable(9)drm_atomic_helper_commit_crtc_disable(9)drm_atomic_helper_commit_encoder_bridge_post_disable(9)drm_atomic_helper_update_legacy_modeset_state(9)drm_atomic_helper_calc_timestamping_constants(9)drm_atomic_helper_commit_crtc_set_mode(9)drm_atomic_helper_commit_modeset_disables(9)drm_atomic_helper_commit_writebacks(9)drm_atomic_helper_commit_encoder_bridge_pre_enable(9)drm_atomic_helper_commit_crtc_enable(9)drm_atomic_helper_commit_encoder_bridge_enable(9)drm_atomic_helper_commit_modeset_enables(9)drm_atomic_helper_wait_for_fences(9)drm_atomic_helper_wait_for_vblanks(9)drm_atomic_helper_wait_for_flip_done(9)drm_atomic_helper_commit_tail(9)drm_atomic_helper_commit_tail_rpm(9)drm_atomic_helper_async_check(9)drm_atomic_helper_async_commit(9)drm_atomic_helper_commit(9)drm_atomic_helper_setup_commit(9)drm_atomic_helper_wait_for_dependencies(9)drm_atomic_helper_fake_vblank(9)drm_atomic_helper_commit_hw_done(9)drm_atomic_helper_commit_cleanup_done(9)drm_atomic_helper_prepare_planes(9)drm_atomic_helper_unprepare_planes(9)drm_atomic_helper_commit_planes(9)drm_atomic_helper_commit_planes_on_crtc(9)drm_atomic_helper_disable_planes_on_crtc(9)drm_atomic_helper_cleanup_planes(9)drm_atomic_helper_swap_state(9)drm_atomic_helper_update_plane(9)drm_atomic_helper_disable_plane(9)drm_atomic_helper_set_config(9)drm_atomic_helper_disable_all(9)drm_atomic_helper_reset_crtc(9)drm_atomic_helper_shutdown(9)drm_atomic_helper_duplicate_state(9)drm_atomic_helper_suspend(9)drm_atomic_helper_commit_duplicated_state(9)drm_atomic_helper_resume(9)drm_atomic_helper_page_flip(9)drm_atomic_helper_page_flip_target(9)drm_atomic_helper_bridge_propagate_bus_fmt(9)drm_atomic_helper_bridge_get_hdmi_output_bus_fmts(9)
okay that's the whole page, periodt π this one lives in ./drivers/gpu/drm and it's dated October 2026 β so like, future girlie energy fr fr π go forth and commit nonblockingly, you absolute icon πππ¦
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms