Closed Bug 1580166 Opened 11 months ago Closed 2 months ago

Implement DMAbuf backend for EGL/X11


(Core :: Widget: Gtk, enhancement)

Not set





(Reporter: stransky, Assigned: stransky)


(Blocks 1 open bug)


Implement GPU located graphics surfaces for Mozilla Firefox X11 backend.
The GPU surfaces can be used as store of decoded video frames
and can be shared across processes. It allows to perform one or zero copy architecture as it's used in Chomium browser:

This can be used with EGL or GLX backend.

Depends on: 788319
OS: Unspecified → Linux
Hardware: Unspecified → Desktop

I'm curious, is anyone currently working on this?

This bug depends on bug 788319 which depends on bug 1474281 which awaits review.

Bug 788319 (switch X11 to EGL) can be fixed without Bug 1474281 so Bug 1474281 does not block it. Bug 1474281 just changes used EGL variant here.

This pull request adds DMABUF/EGL/X11 screen capture to OBS:

(Robert Mader [:rmader] from bug 1619523 comment 11)

I also gave this a look today and if I understand things correctly, all possibilities to go forward here require some serious effort. That is assuming the goal is shipping things enabled by default - because everything else I'd consider wasted time.

  • use EGL with DMABUF: EGL facilitates things quite a bit, but what's missing is GBM support on X11. So we'd need to reimplement things that are much easier on Wayland + potential bugs in drivers IIUC. No NVidia support, i.e. we'd only target platforms that could as well use Wayland.

I'm not a developer, but I searched a bit for GBM on X11:

DRM supports a single client at a time. If X is running then it is the one true client, and anything else will be told permission denied. This is expected.
If you wish to run within X then you need to look at composing via EGL, not via GBM/DRM.

Legacy DRI2:

To create a GBM buffer you first need to create a drm device and then use its device descriptor to create a gbm device. To do this under X you need a way to tell xserver which device you use to avoid permission issues.

I made a GitHub-wide search for above "gbm_create_device xcb_dri2_authenticate" and found an old Mozilla repository:

This is a demonstration of how to use cross-process texture sharing using DRI/DRM directly on Linux. The client process (drm-client), which is intended to have lower privileges, does not need an X connection; you can see the resources that it is using with strace.

Be warned that, because we are using DRI2, the drm-client can access all publicly accessible GPU buffers in the system. This should be fixed with DRI3, which uses file descriptors instead of global names (see [1]).

KDE, X11, Debian Testing:

$ xdpyinfo | grep DRI

XWayland is DRI3-only.


Use the dri3 and present extension directly. The dri3 extension can give us the DRM render node.

From 2013: +

See Also: → 1588904
Assignee: nobody → stransky
Depends on: 1645704

This may help to make VAAPI work even with DRI3-only XWayland:

the user can just call xcb_dri3_open() themselves and pass the fd to vaGetDisplayDRM()

Edit: It seems vaGetDisplayDRM could work on Wayland as well.

Depends on: 1645734
No longer depends on: 788319

Yes, I used the DRM display at Bug 1619523 WIP and seems to be working okay.

Duplicate of this bug: 1210726
Closed: 2 months ago
Resolution: --- → FIXED
Summary: Implement DMAbuf backend for X11 → Implement DMAbuf backend for EGL/X11
You need to log in before you can comment on or make changes to this bug.