Skip to content

render: introduce wlr_multi_renderer

Simon Ser requested to merge github/fork/emersion/multi-renderer into master

I started #906, and then realized there are a lot of issues trying to import/export lazily because switching EGL contexts is required when exporting and importing. So hopefully this PR will make #906 easier to implement.

This introduces wlr_multi_renderer, which is similar to wlr_multi_backend. The wlr_multi_backend now creates a wlr_multi_renderer which creates textures on all renderers. When rendering a texture, the compositor must use wlr_multi_texture_get_child to get the texture for a specific renderer from a wlr_multi_texture.

In the future, it will be possible to optimize this multi renderer with DMA-BUF and the master/slave mechnism explained in #778 (closed).

wlr_multi_renderer was needed anyway for backend hotplugging (because you don't want to create surfaces with a renderer that could go away).

You can try to run rootston on this branch, you'll get two outputs: one Wayland output and one X11 output. Cursor input is a bit messed up, but rendering works!

  • Create textures from pixel buffers
  • Create textures from wl-drm
  • Create textures from DMA-BUF
  • Properly destroy textures
  • Properly destroy renderer
  • Investigate why using wlr_egl_bind_display multiple times fails on shutdown

Follow-up issues:

  • Hotplugging doesn't work if it changes the set of available formats
  • Input events on the Wayland and X11 backends are messed up (#925 (closed), fixed by #930)
  • Allow the headless backend to re-use an existing renderer (see #778 (closed))
  • Use DMA-BUF to share textures between backends (see #778 (closed))

Fixes #778 (closed)

Merge request reports