Repository navigation
nvidia-drm: Skip empty atomic commit in nv_drm_revoke_modeset_permission - #1397
Open
Himesh-Kundal wants to merge 1 commit into
Open
Himesh-Kundal wants to merge 1 commit into
Himesh-Kundal wants to merge 1 commit into
Conversation
When a non-modesetting client (such as a browser or monitoring utility) closes its DRM file descriptor, nv_drm_revoke_modeset_permission() is invoked. If no connector was owned by the closing file descriptor, submitting an empty atomic state commit to the hardware is unnecessary and risks contending with active atomic page flips. Only submit drm_atomic_commit() if at least one connector was actually revoked and disabled. Signed-off-by: Himesh-Kundal <infernoemperor@proton.me>
Himesh-Kundal
force-pushed
the
fix-drm-revoke-empty-commit
branch
from
September 24, 2026 23:11
4eec259 to
82ec20d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
When any process holding an open DRM file descriptor closes it (such as client utilities, browsers, or Wayland sub-processes),
nv_drm_revoke_modeset_permission()is called to revoke modeset permissions and disable associated connectors.In the current implementation, if the closing file descriptor did not hold modesetting permissions on any connector,
drm_atomic_commit(state)is still unconditionally called with an empty atomic state transaction.Submitting an empty atomic commit:
Proposed Change
Introduce a flag (
need_commit) during the connector iteration. Only invokedrm_atomic_commit(state)if at least one connector was actually modified/revoked. If no connector state was altered, the allocated state is simply freed vianv_drm_atomic_state_base_put(state).This mirrors the existing conditional commit pattern used in
nv_drm_plane_reset_input_colorspace()in the same file and follows NVIDIA's convention of using braces around single-statement control blocks in this driver.Testing & Validation
Tested on a hybrid Intel UHD + NVIDIA GeForce RTX 4050 Mobile system driving an external 1440p display over direct HDMI under Wayland (Hyprland / Aquamarine):
Non-modeset client teardown (
need_commit == false):nv_drm_revoke_modeset_permission()exits without submitting an empty atomic commit, freeingstatecleanly with zero lock contention on active compositor page flips.Legitimate modeset revocation (
need_commit == true):chvt 1/chvt 2) and compositor exits where DRM master permissions are actively relinquished.nv_drm_atomic_disable_connector()setsneed_commit = true, anddrm_atomic_commit(state)executes normally without regressions or connector state leaks.Selective revocation (
dpyId != 0):need_commit = truewhen the specific display ID matches the closing file descriptor.