Building ParaView with EGL MESA

Note: This tutorial is inspired by Building ParaView with GPU accelerated MESA and relatively recent mesa improvements.

Before getting into details of Mesa graphics hardware drivers, a disclaimer. If you have graphics hardware Mesa is not your best option. To get the best performance from your graphics card you’ll need to install the vendor provided driver. Vendor provided OpenGL drivers are typically much faster of a much higher quality than Mesa’s which can be quite buggy. Many distros now provide third-party non-opensource source drivers through specialized package repositories. The details of installing vendor provided drivers in beyond the scope of this document. Please consult distro and/or vendor-specific documentation.

If you want to build ParaView with EGL on Linux but you do not have access to a vendored EGL to use, you may want to use Mesa EGL for that !
You probably already have access to Mesa EGL through your package manager and you can probably use that to build ParaView with EGL.
Unfortunately, some OpenGL features may be disabled by your distro’s package maintainers to avoid patent or other licensing restrictions. If you find that this is the case and if for some reason you do not want to use your graphics hardware vendor software then you’ll likely want to build Mesa from source.

1. Clone, Build and Install Mesa

mkdir mesa
cd mesa
git clone src
mkdir build install
cd src
meson setup ../build \
  -D egl=enabled     \ 
  -D gles1=enabled   \
  -D gles2=enabled   \
  -D platforms=x11   \
cd ../build
ninja install

2. Download and Build ParaView with mesa

mkdir paraview
cd paraview
git clone src
mkdir build
cd src
git submodule update --init --recursive
cd ../build
cmake -GNinja 
-DOPENGL_gl_LIBRARY=/home/glow/dev/vtk/deps/mesa/install/lib/          \
-DOPENGL_INCLUDE_DIR=/home/glow/dev/vtk/deps/mesa/install/include/GL           \
-DOPENGL_EGL_INCLUDE_DIR=/home/glow/dev/vtk/deps/mesa/install/include/EGL/     \
-DOPENGL_GLES2_INCLUDE_DIR=/home/glow/dev/vtk/deps/mesa/install/include/GLES2/ \
-DOPENGL_GLES3_INCLUDE_DIR=/home/glow/dev/vtk/deps/mesa/install/include/GLES3/ \
-DOPENGL_GLX_INCLUDE_DIR=                                                      \
-DOPENGL_egl_LIBRARY=/home/glow/dev/vtk/deps/mesa/install/lib/        \
-DOPENGL_opengl_LIBRARY=/home/glow/dev/vtk/deps/mesa/install/lib/      \
-DOPENGL_gles2_LIBRARY=/home/glow/dev/vtk/deps/mesa/install/lib/   \ 
-DOPENGL_gles3_LIBRARY=                                                        \
-DOPENGL_glu_LIBRARY=                                                          \
-DOPENGL_glx_LIBRARY=                                                          \
-DOPENGL_opengl_LIBRARY=                                                       \
-DVTK_OPENGL_HAS_EGL=ON                                                        \
-DVTK_USE_X=OFF                                                                \
-DVTK_DEFAULT_RENDER_WINDOW_HEADLESS=ON                                        \
-DPARAVIEW_USE_QT=OFF                                                          \

Note : depending of your version of ParaView, some cmake options may be ignored. This is ok.

3. Run pvpython to check rendering


openGLInfo = GetOpenGLInformation()
 LD_LIBRARY_PATH=/path/to/mesa/install/lib  LD_PRELOAD=/path/to/mesa/mesa/install/lib/ ./bin/pvpython

You may have a warning about issues finding the right EGL device, you can select it by using the VTK_EGL_DEVICE_INDEX env var.

4. Run pvserver

LD_LIBRARY_PATH=/path/to/mesa/install/lib  LD_PRELOAD=/path/to/mesa/mesa/install/lib/  ./bin/pvserver

Then just connect to it with another build of ParaView.


Thanks Mathieu, this is great. I will pass it around here at Sandia.

The common-superbuild now has a standalone-mesa project for building “just” Mesa. We use it to build Mesa SDKs for use in VTK wheel builds mainly, but if we can distill this down to a few flags there, that’d be great too.

I may give it a go

Here is a draft MR to add it, I will not spend more time on it I’m afraid.