[Mesa-dev] [RFC] DRI3 support for EGL

Boyan Ding boyan.j.ding at gmail.com
Wed Jul 1 08:31:21 PDT 2015

The patch that follows implements DRI3 support for EGL API. Most of the
code is directly ported from dri3_glx.c, with changes to match the EGL
API and to fit the style of egl_dri2 driver. And most of the code
specific to DRI3 lives in platform_x11_dri3.c (and .h). It depends on
another patch [1] for code-reuse needed for enabling

Reasons for DRI3 in EGL:

There are quite a few reasons for DRI3 implementation on x11 platform
(e.g. easier GPU offloading, less tearing, etc.) The one that motivates
me to do the work is that EGL apps for x11 can't get hardware
acceleration on Xwayland (because Xwayland doesn't support DRI2). One
can also implement DRI2 support in Xwayland, but I think implementing
DRI3 support in EGL is more reasonable.

What can the current code do?

The current code works nearly all right. To enable DRI3 support for EGL
on x11 platform, set the environment variable LIBGL_DRI3_ENABLE to 1
(otherwise the default dri2 code will be used). Hardware acceleration
for x11 EGL apps works and GPU offloading seems to work.

piglit shows only one regression, gl-1.0-swapbuffers-behavior went from
pass to fail (quite strange, I don't know why). But it also fixes a few
piglit tests compared with DRI2 egl code.

There are a few issues to be addressed:

* The SystemTimeExtension (also adapted from glx code) uses xf86vidmode
  which seems unable to use from xcb. I made a dirty hack to use Xlib
  here. I wonder if xrandr can be used to replace it.
* A few EGL extensions are missing.
* WL_bind_wayland_display seems not working properly. If I start weston
  in X using my egl with dri3 and start an x11 egl app within weston,
  the app can't run properly.

Really sorry for the huge patch (I don't know a good way to split
it). Comments and suggestions are appreciated.

Boyan Ding

[1] http://lists.freedesktop.org/archives/mesa-dev/2015-June/086982.html


More information about the mesa-dev mailing list