wlroots icon indicating copy to clipboard operation
wlroots copied to clipboard

Improve multi-GPU buffer sharing

Open emersion opened this issue 5 years ago • 6 comments

On multi-GPU setups we render everything on one primary GPU and then we copy buffers around to display them on secondary GPUs. This is done by exporting a DMA-BUF on the primary GPU, importing it on the secondary GPU, and rendering it on the secondary GPU:

https://github.com/swaywm/wlroots/blob/11dc1f65d216acf31e81addb9817091e8d9ba9a6/backend/drm/renderer.c#L216

Instead we should use direct scan-out to skip rendering on the secondary GPU. This could be the groundwork for https://github.com/swaywm/wlroots/issues/1270.


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

https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/1347

emersion avatar Oct 29 '18 21:10 emersion

From issues we had with #1531 this doesn't seem possible on some drivers (radeon) because they can't scan-out from DMA-BUFs (which don't live in VRAM, but in system memory) directly. It would make more sense to copy the bo from system memory to VRAM, instead of using GL, but GBM doesn't have a way to copy buffers.

VincentVanlaer avatar Feb 19 '19 21:02 VincentVanlaer

Weston has a bunch of checks to figure out if a buffer is suitable for scan-out.

Maybe we could try to scan-out and fallback to a copy if it doesn't work, too.

emersion avatar Feb 19 '19 21:02 emersion

Use-cases:

  • Display-only devices like DisplayLink don't have memory
  • Nouveau doesn't support OpenGL for some NVIDIA hw (so falls back to llvmpipe)

We could try these strategies:

  • Directly import and scan-out the DMA-BUF
  • Import the buffer and perform a copy via OpenGL
  • Do a manual copy via system memory

emersion avatar May 29 '20 08:05 emersion

The copy could be improved with:

  • Damage tracking support
  • Detect whether the DRM device is render-capable, don't try to use OpenGL in this case (do a CPU copy instead)

emersion avatar Aug 26 '20 09:08 emersion

Is there any update on this?

d4g avatar Sep 04 '20 08:09 d4g

Ref https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/810

emersion avatar Mar 23 '21 09:03 emersion