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

Introduce wlr_output_layer #1985

Open
wants to merge 3 commits into
base: master
from
Open

Introduce wlr_output_layer #1985

wants to merge 3 commits into from

Conversation

@emersion
Copy link
Member

emersion commented Jan 9, 2020

This series add a new wlr_output_layer API, an implementation of this API in the Wayland backend and an example compositor.

My plan is to make glider switch to this API to demonstrate how it can be implemented under DRM.

Introduce wlr_output_layer

This new API allows compositors to display buffers without needing to
perform rendering operations. This API can be implemented on Wayland
using subsurfaces and on DRM using KMS planes.

The goal is to make use of this API in a future scene-graph API.

backend/wayland: implement the output layer API

The output layer API is implemented using subsurfaces. I chose to
implement this API in the Wayland backend before doing so in the DRM
backend, because it's way easier on Wayland. On DRM, one needs to figure
out how buffers can be mapped to KMS planes (libliftoff can help) and
perform atomic test-only commits (our current DRM backend isn't ready
for this).

examples: add output-layers example

This new example demonstrates how to use the wlr_output_layer API. It's
a compositor that displays all client surfaces using wlr_output_layer.
To test, one can for instance run:

build/examples/output-layers -s 'weston-simple-dmabuf-egl & weston-simple-egl'

Under the Wayland backend (where layers work as long as clients use
DMA-BUFs), thsi should display two surfaces.

@emersion emersion force-pushed the emersion:output-layers branch from ecf4d3f to 133de32 Jan 10, 2020
@ddevault

This comment has been minimized.

Copy link
Member

ddevault commented Jan 12, 2020

It seems like this is designed so that wlr_output_layer is entirely siloed and responsible for its own state. This is going to lead to copying down the line. Why not make it an interface that each backend can implement? DRM with libliftoff, for example, which looks very similar. DRY up the sources of truth. Thoughts?

@emersion

This comment has been minimized.

Copy link
Member Author

emersion commented Jan 13, 2020

It seems like this is designed so that wlr_output_layer is entirely siloed and responsible for its own state. This is going to lead to copying down the line. Why not make it an interface that each backend can implement? DRM with libliftoff, for example, which looks very similar. DRY up the sources of truth. Thoughts?

I agree state duplication is not great, but there are several issues with this approach:

  • A need a guarantee that nothing happens before wlr_output_commit. In particular, it should always be possible to cancel all pending changes with wlr_output_rollback (in case the commit fails, for instance). Rolling back is important because wlr_output_commit doesn't explain why a commit has failed, so the compositor wouldn't know what to do after a failed commit to perform a new non-failing commit. Neither Wayland nor libliftoff allow to rollback.
  • Ordering between layers needs to be tracked. On the DRM backend, the zpos property will be used. The backends code will be much simpler if the common code takes care of the wl_list stuff (backends can just iterate over the list of layers to update their state when the ordering changes). Once the ordering is tracked, it's very little work to keep track of other things like position or buffer.
  • The Wayland backend would need to track everything the common code currently tracks. One thing I think is important is making sure compositors can repeatedly change the pending state without any cost. It's pretty handy to be able to set the position of a layer at each frame, or to set the buffer to NULL then non-NULL in case importing it fails.

Let me know if any of the above is unclear or needs more explanation.

@ascent12

This comment has been minimized.

Copy link
Member

ascent12 commented Jan 22, 2020

Hmm, the example doesn't seem to be showing anything for me other than the grey background. I can see the log messages from weston-simple-egl.

@emersion

This comment has been minimized.

Copy link
Member Author

emersion commented Jan 22, 2020

I've investigated a little, and there are two things that could get in your way when testing this patch:

Does it help?

emersion added 3 commits Jan 9, 2020
This new API allows compositors to display buffers without needing to
perform rendering operations. This API can be implemented on Wayland
using subsurfaces and on DRM using KMS planes.

The goal is to make use of this API in a future scene-graph API.

References: #1826
The output layer API is implemented using subsurfaces. I chose to
implement this API in the Wayland backend before doing so in the DRM
backend, because it's way easier on Wayland. On DRM, one needs to figure
out how buffers can be mapped to KMS planes (libliftoff can help) and
perform atomic test-only commits (our current DRM backend isn't ready
for this).
This new example demonstrates how to use the wlr_output_layer API. It's
a compositor that displays all client surfaces using wlr_output_layer.
To test, one can for instance run:

    build/examples/output-layers -s 'weston-simple-dmabuf-egl & weston-simple-egl'

Under the Wayland backend (where layers work as long as clients use
DMA-BUFs), thsi should display two surfaces.
@emersion emersion force-pushed the emersion:output-layers branch from 133de32 to 7f74051 Jan 24, 2020
@emersion

This comment has been minimized.

Copy link
Member Author

emersion commented Jan 24, 2020

Rebased against master to fix the Alpine build failure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.