Could not create the egl surface: error = 0x300b

1.9k views Asked by At

I find a lot of questions about this error but they are related to embedded systems like RPi or iMX6. Instead, I run across this issue on a standard Ubuntu Server 20.04 x64 installation.

I installed the mesa drivers:

$ dpkg -l | grep egl
ii  libegl-dev:amd64                     1.3.2-1~ubuntu0.20.04.1               amd64        Vendor neutral GL dispatch library -- EGL development files
ii  libegl-mesa0:amd64                   21.0.3-0ubuntu0.3~20.04.2             amd64        free implementation of the EGL API -- Mesa vendor library
ii  libegl1:amd64                        1.3.2-1~ubuntu0.20.04.1               amd64        Vendor neutral GL dispatch library -- EGL support
ii  libegl1-mesa:amd64                   21.0.3-0ubuntu0.3~20.04.2             amd64        transitional dummy package
ii  libegl1-mesa-dev:amd64               21.0.3-0ubuntu0.3~20.04.2             amd64        free implementation of the EGL API -- development files
ii  libwayland-egl1:amd64                1.18.0-1                              amd64        wayland compositor infrastructure - EGL library

$ dpkg -l | grep gles
ii  libgles-dev:amd64                    1.3.2-1~ubuntu0.20.04.1               amd64        Vendor neutral GL dispatch library -- GLES development files
ii  libgles1:amd64                       1.3.2-1~ubuntu0.20.04.1               amd64        Vendor neutral GL dispatch library -- GLESv1 support
ii  libgles2:amd64                       1.3.2-1~ubuntu0.20.04.1               amd64        Vendor neutral GL dispatch library -- GLESv2 support
ii  libgles2-mesa-dev:amd64              21.0.3-0ubuntu0.3~20.04.2             amd64        transitional dummy package

I added all the relevant group to my user:

$ groups
user adm tty dialout cdrom sudo dip video plugdev input lxd

All the libraries of the hello word example (Qt6-widget application) are found:

$ LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/user/Qt6_libs ldd myproject
    linux-vdso.so.1 (0x00007ffdd8ba7000)
    libQt6Widgets.so.6 => /home/user/Qt6_libs/libQt6Widgets.so.6 (0x00007fbd22e12000)
    libQt6Core.so.6 => /home/user/Qt6_libs/libQt6Core.so.6 (0x00007fbd227e4000)
    libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fbd225f5000)
    libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fbd225da000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fbd223e8000)
    libQt6Gui.so.6 => /home/user/Qt6_libs/libQt6Gui.so.6 (0x00007fbd21a8c000)
    libGL.so.1 => /lib/x86_64-linux-gnu/libGL.so.1 (0x00007fbd21a02000)
    libxkbcommon.so.0 => /home/user/Qt6_libs/libxkbcommon.so.0 (0x00007fbd219c0000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fbd2199d000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fbd2184e000)
    libicui18n.so.56 => /home/user/Qt6_libs/libicui18n.so.56 (0x00007fbd213b5000)
    libicuuc.so.56 => /home/user/Qt6_libs/libicuuc.so.56 (0x00007fbd20ffd000)
    libicudata.so.56 => /home/user/Qt6_libs/libicudata.so.56 (0x00007fbd1f618000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fbd1f612000)
    libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007fbd1f4e9000)
    libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007fbd1f4cd000)
    libgthread-2.0.so.0 => /lib/x86_64-linux-gnu/libgthread-2.0.so.0 (0x00007fbd1f4c8000)
    librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007fbd1f4bd000)
    /lib64/ld-linux-x86-64.so.2 (0x00007fbd23524000)
    libEGL.so.1 => /lib/x86_64-linux-gnu/libEGL.so.1 (0x00007fbd1f4a6000)
    libfontconfig.so.1 => /lib/x86_64-linux-gnu/libfontconfig.so.1 (0x00007fbd1f45f000)
    libX11.so.6 => /lib/x86_64-linux-gnu/libX11.so.6 (0x00007fbd1f322000)
    libQt6DBus.so.6 => /home/user/Qt6_libs/libQt6DBus.so.6 (0x00007fbd1f25b000)
    libfreetype.so.6 => /lib/x86_64-linux-gnu/libfreetype.so.6 (0x00007fbd1f19c000)
    libGLdispatch.so.0 => /lib/x86_64-linux-gnu/libGLdispatch.so.0 (0x00007fbd1f0e2000)
    libGLX.so.0 => /lib/x86_64-linux-gnu/libGLX.so.0 (0x00007fbd1f0ae000)
    libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007fbd1f03b000)
    libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007fbd1f00d000)
    libuuid.so.1 => /lib/x86_64-linux-gnu/libuuid.so.1 (0x00007fbd1f004000)
    libxcb.so.1 => /lib/x86_64-linux-gnu/libxcb.so.1 (0x00007fbd1efda000)
    libdbus-1.so.3 => /lib/x86_64-linux-gnu/libdbus-1.so.3 (0x00007fbd1ef87000)
    libpng16.so.16 => /lib/x86_64-linux-gnu/libpng16.so.16 (0x00007fbd1ef4f000)
    libXau.so.6 => /lib/x86_64-linux-gnu/libXau.so.6 (0x00007fbd1ef49000)
    libXdmcp.so.6 => /lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007fbd1ef41000)
    libsystemd.so.0 => /lib/x86_64-linux-gnu/libsystemd.so.0 (0x00007fbd1ee92000)
    libbsd.so.0 => /lib/x86_64-linux-gnu/libbsd.so.0 (0x00007fbd1ee76000)
    liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007fbd1ee4d000)
    liblz4.so.1 => /lib/x86_64-linux-gnu/liblz4.so.1 (0x00007fbd1ee2c000)
    libgcrypt.so.20 => /lib/x86_64-linux-gnu/libgcrypt.so.20 (0x00007fbd1ed0e000)
    libgpg-error.so.0 => /lib/x86_64-linux-gnu/libgpg-error.so.0 (0x00007fbd1eceb000)

When I run the application I get:

$ LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/user/Qt6_libs ./myproject -platform eglfs
libEGL warning: DRI2: failed to authenticate
EGL Error : Could not create the egl surface: error = 0x300b

Aborted (core dumped)

I didn't find a precise explanation of what error 0x300b means and how to fix it.

2

There are 2 answers

1
matzrm On

To show more information about error 0x300b you have to add QT_DEBUG_PLUGINS=1 to the launch command.

0
genpfault On

Assuming "EGL Error : Could not create the egl surface" was generated in response to eglGetError() returning something other than EGL_SUCCESS then 0x300B/12299 corresponds to EGL_BAD_NATIVE_WINDOW:

<enum value="0x3000" name="EGL_SUCCESS"/>
<enum value="0x3001" name="EGL_NOT_INITIALIZED"/>
<enum value="0x3002" name="EGL_BAD_ACCESS"/>
<enum value="0x3003" name="EGL_BAD_ALLOC"/>
<enum value="0x3004" name="EGL_BAD_ATTRIBUTE"/>
<enum value="0x3005" name="EGL_BAD_CONFIG"/>
<enum value="0x3006" name="EGL_BAD_CONTEXT"/>
<enum value="0x3007" name="EGL_BAD_CURRENT_SURFACE"/>
<enum value="0x3008" name="EGL_BAD_DISPLAY"/>
<enum value="0x3009" name="EGL_BAD_MATCH"/>
<enum value="0x300A" name="EGL_BAD_NATIVE_PIXMAP"/>
<enum value="0x300B" name="EGL_BAD_NATIVE_WINDOW"/>
<enum value="0x300C" name="EGL_BAD_PARAMETER"/>
<enum value="0x300D" name="EGL_BAD_SURFACE"/>
<enum value="0x300E" name="EGL_CONTEXT_LOST"/>

From eglGetError():

EGL_BAD_NATIVE_WINDOW: A NativeWindowType argument does not refer to a valid native window.