I'm trying to set up unit tests for another project that Use OpenGL ES and do not rely on having an X11 display (because they run headless) or hardware acceleration (because they run on VMs usually).
Mesa surfaceless EGL looked like a perfect solution, but it seems the EGL surfaceless platform lacks support for selecting the swrast driver. I see explicit support in the drm, wayland, and x11 platforms files for it, but nothing in android or surfaceless.
Running on 17.0.7 (corp OS has too old of a libdrm for 17.1.2) but confirmed that this doesn't appear to have changed in 17.1.2.
./configure --enable-gallium --prefix=$HOME/mesa/install --with-llvm-prefix=/usr/lib/llvm-3.4/ --enable-debug --with-gallium-drivers=swrast --with-dri-drivers=swrast --with-egl-platforms=surfaceless
(have to specify llvm path as auto-search finds a local version that's bogus)
Ran as (with DISPLAY unset):
LD_LIBRARY_PATH=$HOME/mesa/install/lib LIBGL_DRIVERS_PATH=$HOME/mesa/install/lib/dri LIBGL_DEBUG=verbose MESA_DEBUG=verbose EGL_LOG_LEVEL=debug ~/a.out
libEGL debug: Native platform type: surfaceless (build-time configuration)
libEGL debug: added egl_dri2 to module array
libEGL debug: EGL user error 0x3001 (EGL_NOT_INITIALIZED) in DRI2: failed to load driver
libEGL debug: EGL user error 0x3001 (EGL_NOT_INITIALIZED) in eglInitialize
Initial support has landed yesterday, but might need further work and testing:
Author: Gurchetan Singh <email@example.com>
Date: Mon Oct 2 13:48:24 2017 -0700
egl/surfaceless: Use KMS swrast fallback
Please run your unit tests, and CC me on any bug you raise :)