This repository has been archived by the owner on Nov 1, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 342
output: fix dangling renderer context after wlr_output_preferred_read_format #2292
Merged
Conversation
This file contains 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
The output backend API is now mostly state-less thanks to the atomic hooks (commit and test). There is one exception though: attach_render. This function makes the rendering context current. However sometimes the compositor might decide not to render after attach_render (e.g. when there's nothing new to render to the back buffer). Thus wlr_output_rollback has been introduced to revert the pending state. Because the output backend API is mostly state-less, the only thing wlr_output_impl.rollback needs to do is revert the current rendering context. Rename the function to rollback_render to make this clear. Add a check in the common wlr_output code to only call rollback_render when attach_buffer has been previously called. On the long term, we'll be able to remove attach_render and rollback_render together.
If the output backend provides attach_render, assert it also provides a way to revert it via rollback_render.
…_format attach_render was called without un-setting the current rendering context afterwards. Closes: swaywm#2164
ddevault
approved these changes
Jun 19, 2020
ddevault
reviewed
Jun 19, 2020
any1
reviewed
Jun 19, 2020
@@ -448,15 +448,16 @@ bool wlr_output_attach_render(struct wlr_output *output, int *buffer_age) { | |||
|
|||
bool wlr_output_preferred_read_format(struct wlr_output *output, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this guaranteed to be called while no other output is attached? Could this cause problems when another output is attached?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that's a problem, but already was before. I'll open a follow-up issue about this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
output: rename impl->rollback to rollback_render
The output backend API is now mostly state-less thanks to the atomic
hooks (commit and test). There is one exception though: attach_render.
This function makes the rendering context current. However sometimes the
compositor might decide not to render after attach_render (e.g. when
there's nothing new to render to the back buffer). Thus
wlr_output_rollback has been introduced to revert the pending state.
Because the output backend API is mostly state-less, the only thing
wlr_output_impl.rollback needs to do is revert the current rendering
context. Rename the function to rollback_render to make this clear. Add
a check in the common wlr_output code to only call rollback_render when
attach_buffer has been previously called.
On the long term, we'll be able to remove attach_render and
rollback_render together.
output: make rollback_render mandatory
If the output backend provides attach_render, assert it also provides a
way to revert it via rollback_render.
output: fix dangling renderer context after wlr_output_preferred_read_format
attach_render was called without un-setting the current rendering
context afterwards.
Closes: #2164
Breaking change for backends:
wlr_output_impl.rollback
has been renamed torollback_render
and now needs to unconditionally unset the renderer context. It'll only be called ifattach_render
has previously been called.cc @any1