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

backend/drm: implement output layers #3095

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

Conversation

emersion
Copy link
Member

@emersion emersion commented Aug 9, 2021

Depends on #1985
Depends on #3100

  • Make it work on multi-output setups
  • Make it handle VRR and gamma

@emersion emersion marked this pull request as draft August 9, 2021 14:46
@emersion emersion mentioned this pull request Aug 9, 2021
@emersion emersion force-pushed the output-layers-drm branch from fa6ec84 to ba7ea4a Compare August 9, 2021 15:38
@emersion
Copy link
Member Author

The ad-hoc copies of wlr_output_state are making things difficult, because they corrupt wl_list pointers.

I'll refactor the DRM backend a bit to avoid doing such copies.

@emersion emersion force-pushed the output-layers-drm branch 4 times, most recently from 2dedde2 to e408b83 Compare August 13, 2021 07:08
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: swaywm#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), this should display two surfaces with remote wl_subsurfaces.
"state" is easily confused with wlr_output_state.
Previously, we were copying wlr_output_state on the stack and
patching it up to be guaranteed to have a proper drmModeModeInfo
stored in it (and not a custom mode). Also, we had a bunch of
helpers deriving DRM-specific information from the generic
wlr_output_state.

Copying the wlr_output_state worked fine so far, but with output
layers we'll be getting a wl_list in there. An empty wl_list stores
two pointers to itself, copying it on the stack blindly results in
infinite loops in wl_list_for_each.

To fix this, rework our DRM backend to stop copying wlr_output_state,
instead add a new struct wlr_drm_connector_state which holds both
the wlr_output_state and additional DRM-specific information.
TODO:

- Make it work on multi-output setups
- Make it handle VRR and gamma
This will be useful for implementing the output layers API.
Delegate all of the work to libliftoff.
@emersion
Copy link
Member Author

emersion commented Nov 1, 2021

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

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

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

Successfully merging this pull request may close these issues.

1 participant