Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

output: use backend commits #316

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

emersion
Copy link
Contributor

@emersion emersion commented Feb 16, 2024

Pass the whole new desired state to the backend, so that the
backend can leverage KMS atomic commits.

Depends on #313
See https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4548

@emersion emersion force-pushed the backend-commit branch 4 times, most recently from 60c3350 to 0c377a1 Compare February 16, 2024 17:49
output.c Outdated
}

struct wlr_swapchain *swapchain = NULL;
if (!wlr_output_configure_primary_swapchain(state->output, state, &swapchain)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: I think we need to do some work on the swapchain allocation to better reap the benefits of device-wide commits.

This currently picks a buffer type on each output in series, each blissfully unaware of the others' consequences to available memory bandwidth and shadow plane requirements as the resulting buffers are not committed. This seems like it would be quite a lot less likely to succeed than our existing setup, where each output commit at least observed the restrictions caused by the prior commits - and that's before considering the all-or-nothing commit we're now doing.

If we want to be able to bring up outputs in spite of modifier restrictions without needing users to set WLR_DRM_NO_MODIFIERS=1, we'd want a flow that looks like:

  1. Set up swapchain with modifiers for all outputs
  2. Try a backend-wide test and commit if successful
  3. If failed, retry with modifierless swapchains for all outputs
  4. Try a backend-wide test and commit if successful

This does seem like something one might want a helper for...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that's a good point…

Backend-wide commits are still good to have even without the modifier fallback stuff: they provide atomic output configurations without some half-applied state in case of failures.

I'd prefer to keep the modifier fallback stuff as a follow up of the backend commits, but we will indeed either need to handle this in a helper or in wlr_backend_commit()

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed.

I for fun tried to hack up a solution in clay (https://git.sr.ht/~kennylevinsen/clay/tree/dc82a8c/item/src/clay/output.c#L236), exposing a specialized version of wlr_output_configure_primary_swapchain (wlr_output_try_for_swapchain) that just grabs a buffer with the configuration you want, successful or not.

Seems to work quite well so far, so there's hope.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR now uses the new helper from wlroots!4567.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants