[Mesa-dev] [RFC] DRI3 support for EGL (v2)

Boyan Ding boyan.j.ding at gmail.com
Tue Jul 21 08:43:53 PDT 2015

This is the second version of my effort to bring dri3 to EGL on X. This
time I took Emil's advice and moved common logic of GLX and EGL into
loader/loader_dri3_helper.[ch]. With this, the dri3 code in libEGL is
only ~650 lines, with a bunch of trivial code, and glx/dri3 code also
shrinks a lot.

I also did some changes on the EGL side since the first version,
including WL_bind_display correction, support for eglCopyBuffers and
KHR_image_pixmap, and other corrections elsewhere.

DRI3 support is enabled by default in this series, except when
LIBGL_DRI3_DISABLE environment variable is set. However, on older
systems without render-node support in kernel or libdrm, it will
fall back to dri2 by default to avoid regression in WL_bind_display.

The patches in the series are as follows:
[PATCH RFC 1/9] loader: Add dri3 helper
[PATCH RFC 2/9] glx/dri3: Convert to use dri3 helper in loader library

These two patches moves common logic that can be shared with EGL into
a helper library in src/loader directory.

[PATCH 3/9] egl_dri2: Move filling context_attrib array in a separate
[PATCH 4/9] egl_dri2: Use createContextAttribs if swrast version >= 3
[PATCH 5/9] egl_dri2: Add support for EGL_KHR_create_contest when using

These three patches are resend of [1]. Patch 3 is a cleanup needed for
supporting KHR_create_context with different DRI extensions. Patches 4
and 5 add KHR_create_context support for swrast, which is quite
trivial. I think these three can land ahead of others if they get

[PATCH RFC 6/9] egl_dri2: Add a function to let platform code return
dri drawable from _EGLSurface

This is what's missing in the first version. I introduced a new kind of
_EGLSurface implementation in dri2 driver so the common code must be
aware of this. The first version just accidentally worked without this.

[PATCH RFC 7/9] egl/x11: Implement dri3 support with loader's dri3

This introduces dri3 to EGL on X11 for real.

[PATCH RFC 8/9] loader/dri3: Expose function to create __DRIimage from
[PATCH RFC 9/9] egl/x11_dri3: Implement EGL_KHR_image_pixmap

These two adds support for EGL_KHR_image_pixmap. KDE 5 compositing on
EGL backend now works with these patches.

Piglit shows no regression except gl-1.0-swapbuffers-behavior which is
the problem of dri3. Tests, comments and suggestions are appreciated.

Boyan Ding

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

More information about the mesa-dev mailing list