wlroots icon indicating copy to clipboard operation
wlroots copied to clipboard

Make wlr_output_enable idempotent

Open DemiMarie opened this issue 4 years ago • 6 comments

Enabling or disabling an output should be idempotent. Previously, this was not the case, causing bugs.

DemiMarie avatar Oct 27 '21 08:10 DemiMarie

10:05:29 <emersion> output->pending.enabled only has a meaningful value if WLR_OUTPUT_STATE_ENABLED is set
10:05:36 <emersion> same for the rest of the output state
10:07:00 <emersion> that's the status quo -- i'm not against changing it, but there are gotchas
10:07:53 <emersion> e.g. if we keep the previous state in pending, there has to be an exception for the wlr_buffer field and the gamma tables -- we don't want to keep these locked/allocated after we're done with the commit

emersion avatar Oct 27 '21 08:10 emersion

10:05:29 <emersion> output->pending.enabled only has a meaningful value if WLR_OUTPUT_STATE_ENABLED is set
10:05:36 <emersion> same for the rest of the output state
10:07:00 <emersion> that's the status quo -- i'm not against changing it, but there are gotchas
10:07:53 <emersion> e.g. if we keep the previous state in pending, there has to be an exception for the wlr_buffer field and the gamma tables -- we don't want to keep these locked/allocated after we're done with the commit

The only time this change will have any effect is if wlr_output_enable is called twice on the same output, with different values of the parameter, before the output commits. Needless to say, this will basically never happen for typical rootful compositors. For rootless compositors such as the one I am working on, however, this happens a LOT. The result is that the output is left with the wrong value of output->pending.enabled, which causes problems later.

DemiMarie avatar Oct 27 '21 09:10 DemiMarie

I don't understand which kind of issues you're running into. If WLR_OUTPUT_STATE_ENABLED is unset in the flags, you shouldn't even look at pending.enabled.

emersion avatar Oct 27 '21 09:10 emersion

I don't understand which kind of issues you're running into. If WLR_OUTPUT_STATE_ENABLED is unset in the flags, you shouldn't even look at pending.enabled.

I will do some testing locally.

DemiMarie avatar Oct 27 '21 09:10 DemiMarie

Without this commit my compositor trips over this assertion.

DemiMarie avatar Oct 27 '21 09:10 DemiMarie

wlroots has migrated to gitlab.freedesktop.org. This pull request has been moved to:

https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3306

emersion avatar Nov 01 '21 15:11 emersion