drm/output: Allow DrmOutput destruction during manager-lock#1820
Open
drm/output: Allow DrmOutput destruction during manager-lock#1820
DrmOutput destruction during manager-lock#1820Conversation
Since #1778 we provide an api to explicitly lock the `DrmOutputManager` to apply multiple changes atomically without `DrmOutput`s being able to observe any inconsistent state. However as a side-effect of this, it has become impossible to re-assign a crtc to a different connector in one atomic opertion, as the lock on the `DrmOutputManager` prevents the `Drop`-implementation of `DrmOutput` to free any crtcs for re-use. This commit introduces a channel, if locking fails to deferr freeing the crtc to the locked manager.
DrmOutput descruction during manager-lockDrmOutput destruction during manager-lock
Contributor
|
Hey, I’m wondering whether |
johnrichardrinehart
added a commit
to johnrichardrinehart/niri
that referenced
this pull request
Dec 29, 2025
johnrichardrinehart
added a commit
to johnrichardrinehart/niri
that referenced
this pull request
Dec 29, 2025
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.
Since #1778 we provide an api to explicitly lock the
DrmOutputManagerto apply multiple changes atomically withoutDrmOutputs being able to observe any inconsistent state.However as a side-effect of this, it has become impossible to re-assign a crtc to a different connector in one atomic opertion, as the lock on the
DrmOutputManagerprevents theDrop-implementation ofDrmOutputto free any crtcs for re-use. This is a problem in cosmic-comp currently, when trying to apply a new configuration in one go on more resource constraint systems leading to a rejection of the entire configuration.This commit introduces a channel to defer freeing the crtc to the locked manager, if locking fails. Since this can be racy, we rely on the event-loop to free up any crtcs stuck in said channel. Synchronization with different threads for dropping the
DrmOutputstill needs to be handled by downstream (e.g. by joining said thread).I'd like to get some feedback on this approach. I also tried to fix this issue without involving the event-loop by using additional
CondVars and other synchronization primitives, but that grew very complex to the point where we might as well build our ownRwLockfor this specific purpose.