drm_atomic_h...r_swap_state(9)
π drm_atomic_helper_swap_state(9) β Kernel API Manual, but make it make sense
okay so bestie, welcome to the drm_atomic_helper_swap_state page from the Kernel API Manual. this is the glow-up moment for your atomic state, no cap. let's get into it π
β¨ NAME β¨
drm_atomic_helper_swap_state β store atomic state into current sw state
like literally, it takes your staged atomic state and shoves it into the current state. that's the whole vibe. π¦
πΈ SYNOPSIS πΈ
int drm_atomic_helper_swap_state (struct drm_atomic_commit *state , bool
stall );
π«Ά ARGUMENTS π«Ά
stateβ atomic state. the state bestie. the one being swapped. πstallβ stall for preceding commits. you set this and the function will literally wait around for the earlier commits to finish. π
π₯ DESCRIPTION π₯
This function stores the atomic state into the current state pointers in all driver objects. Read that again. all driver objects. it's giving main character energy, and honestly? it earned it. β¨
When do you call it? Timing is everything, bestie: it should be called after all the failing steps have been done and succeeded, but before the actual hardware state is committed. so like β past the danger zone, not yet at the finish line. π―
And for cleanup / error recovery? the current state for all changed objects will be swapped into state. so the old stuff lives on in state, which is genuinely so useful. π
With that sequence it fits perfectly into the plane prepare/cleanup sequence, and here's the choreography:
- Call
drm_atomic_helper_prepare_planeswith the staged atomic state. - Do any other steps that might fail.
- Put the staged state into the current state pointers with this function.
- Actually commit the hardware state.
- Call
drm_atomic_helper_cleanup_planeswithstate, which since step 3 contains the old state. Also do any other cleanup required with that state.
see how clean that is? steps 1β5, no notes. ate. π
β οΈ okay important:stallmust be set when nonblocking commits for this driver directly access thedrm_plane.state,drm_crtc.stateordrm_connector.statepointer. With the current atomic helpers this is almost always the case, since the helpers don't pass the right state structures to the callbacks. so yeah, set it. like, basically always. π
β RETURN β
Returns 0 on success, icon behaviour honestly. π
Can return -ERESTARTSYS when stall is true and the waiting for the previous commits has been interrupted. rude of the interrupt, but okay. π
π SEE ALSO π
the whole friend group, fr fr β go read these next:
overview(9)β Kernel file./drivers/gpu/drm/drm_atomic_helper.cdrm_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)implementing nonblocking 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_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)
and that's the page!! π§ this little cutie lives in ./drivers/gpu/drm and the docs are dated October 2026 β screenshot it, cite it, live by it. mwah π
π¦ 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