Skip to content
This repository has been archived by the owner on Nov 1, 2021. It is now read-only.

output: introduce wlr_output_test #2097

Merged
merged 2 commits into from
Apr 8, 2020
Merged

Conversation

emersion
Copy link
Member

@emersion emersion commented Apr 2, 2020

This PR adds wlr_output_test, which can be used to check whether pending output changes would be accepted by the backend. This allows compositors to try different changes before attempting a commit.

Right now this function just performs the check previously done in attach_buffer and commit. This change allows test-only commits to be run in wlr_output_test, which is necessary for using libliftoff (thus necessary for DRM support of output layers introduced in #1985).

Compositors implementing wlr-output-management can now call this function instead of returning true unconditionally.

Should wlr_output_test be implicitly called in wlr_output_commit? This would add a guarantee for backends that the output changes are valid when their commit function is called.

Sway PR: swaywm/sway#5188


Breaking changes:

  • For compositors: wlr_output_attach_buffer doesn't return a bool anymore. The checks previously performed in this function are now performed in wlr_output_commit and the new wlr_output_test function.
  • For backends: wlr_output_impl.attach_buffer is gone, buffer checks now need to be performed in commit. A new test function has been added.

emersion added 2 commits April 2, 2020 15:03
Check that buffer can be scanned out in wlr_output_test instead of
wlr_output_attach_buffer. This allows the backend to have access to the
whole pending state when performing the check.

This brings the wlr_output API more in line with the KMS API.

This removes the need for wlr_output_attach_buffer to return a value,
and for wlr_output_impl.attach_buffer.
@ammen99
Copy link
Member

ammen99 commented Apr 2, 2020

This should also be used when implementing output-management, right?

@emersion
Copy link
Member Author

emersion commented Apr 2, 2020

Indeed!

emersion added a commit to emersion/wlroots that referenced this pull request Apr 6, 2020
Most of the pending output state is not forwarded to the backend prior
to an output commit. For instance, wlr_output_set_mode just stashes the
mode without calling any wlr_output_impl function.
wlr_output_impl.commit is responsible for applying the pending mode.

However, there are exceptions to this rule. The first one is
wlr_output_attach_render. It won't go away before renderer v6 is
complete, because it needs to set the current EGL surface.

The second one is wlr_output_attach_buffer.
wlr_output_impl.attach_buffer is removed in [1].

When wlr_output_rollback is called, all pending state is supposed to be
cleared. This works for all the state except the two exceptions
mentionned above. To fix this, introduce wlr_output_impl.rollback.

Right now, the backend resets the current EGL surface. This prevents GL
commands from affecting the output after wlr_output_rollback.

This patch is required for FBO-based outputs to work properly. The
compositor might be using FBOs for its own purposes [2], having leftover
FBO state can have bad consequences.

[1]: swaywm#2097
[2]: swaywm#2063 (comment)
@emersion emersion added the breaking Breaking change in public API label Apr 8, 2020
emersion added a commit to emersion/sway that referenced this pull request Apr 8, 2020
Update for [1]. Everything is now checked at commit-time.

[1]: swaywm/wlroots#2097
@emersion
Copy link
Member Author

emersion commented Apr 8, 2020

Sway pull request: swaywm/sway#5188

@emersion emersion requested a review from ddevault April 8, 2020 13:44
@ddevault
Copy link
Contributor

ddevault commented Apr 8, 2020

Still miffed that we have to brute force testing configurations to find the subset which works... but thanks!

@ddevault ddevault merged commit 6977f3a into swaywm:master Apr 8, 2020
@emersion emersion deleted the output-test branch April 8, 2020 14:32
ddevault pushed a commit to swaywm/sway that referenced this pull request Apr 8, 2020
Update for [1]. Everything is now checked at commit-time.

[1]: swaywm/wlroots#2097
emersion added a commit to emersion/wlroots that referenced this pull request Apr 8, 2020
Most of the pending output state is not forwarded to the backend prior
to an output commit. For instance, wlr_output_set_mode just stashes the
mode without calling any wlr_output_impl function.
wlr_output_impl.commit is responsible for applying the pending mode.

However, there are exceptions to this rule. The first one is
wlr_output_attach_render. It won't go away before renderer v6 is
complete, because it needs to set the current EGL surface.

The second one is wlr_output_attach_buffer.
wlr_output_impl.attach_buffer is removed in [1].

When wlr_output_rollback is called, all pending state is supposed to be
cleared. This works for all the state except the two exceptions
mentionned above. To fix this, introduce wlr_output_impl.rollback.

Right now, the backend resets the current EGL surface. This prevents GL
commands from affecting the output after wlr_output_rollback.

This patch is required for FBO-based outputs to work properly. The
compositor might be using FBOs for its own purposes [2], having leftover
FBO state can have bad consequences.

[1]: swaywm#2097
[2]: swaywm#2063 (comment)
ddevault pushed a commit that referenced this pull request Apr 8, 2020
Most of the pending output state is not forwarded to the backend prior
to an output commit. For instance, wlr_output_set_mode just stashes the
mode without calling any wlr_output_impl function.
wlr_output_impl.commit is responsible for applying the pending mode.

However, there are exceptions to this rule. The first one is
wlr_output_attach_render. It won't go away before renderer v6 is
complete, because it needs to set the current EGL surface.

The second one is wlr_output_attach_buffer.
wlr_output_impl.attach_buffer is removed in [1].

When wlr_output_rollback is called, all pending state is supposed to be
cleared. This works for all the state except the two exceptions
mentionned above. To fix this, introduce wlr_output_impl.rollback.

Right now, the backend resets the current EGL surface. This prevents GL
commands from affecting the output after wlr_output_rollback.

This patch is required for FBO-based outputs to work properly. The
compositor might be using FBOs for its own purposes [2], having leftover
FBO state can have bad consequences.

[1]: #2097
[2]: #2063 (comment)
@emersion emersion added this to the 0.11.0 milestone Jul 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
breaking Breaking change in public API
Development

Successfully merging this pull request may close these issues.

3 participants