Workaround for R2020b plotting brokeness on Linux with modern Intel graphics chips

I just tested Matlab R2020b on Ubuntu 20.04-LTS with a modern Intel graphics chip that uses the “new” (well at least a year old by now) iris OpenGL graphics driver. While Psychtoolbox works perfectly as expected, Matlab itself spews some error messages, and plot()ing is broken. Apparently the Mathworks graphics team is just as bad at most basic graphics compatibility testing now as it was 3 years ago when plotting with AMD was broken for a very similar reason - History repeating, sad…

Anyway, here is a simple one-liner workaround you can execute in a terminal window if you happen to encounter this bug on Linux with Intel graphics and Matlab:

echo "-Djogl.disable.openglarbcontext=1" | sudo tee /usr/local/MATLAB/R2020b/bin/glnxa64/java.opts

This will make plotting work again.

I faced another (or the same?) problem a few weeks ago on some Dell desktop machines with intel GPUs, I fixed it using this route when starting MATLAB 2020b from terminal:

> export MESA_LOADER_DRIVER_OVERRIDE=i965; matlab

Additionally one can change the EXEC in /usr/share/applications/matlab.desktop to:

Exec=env MESA_LOADER_DRIVER_OVERRIDE=i965 matlab -desktop

That’s another workaround for the same Matlab bug. It forces use of the older “i965” classic DRI OpenGL driver for modern Intel graphics chips, instead of the modern “iris” Gallium driver, which was written around 2018’ish from scratch and targets (iirc) Gen8 graphics “Broadwell” and later, specifically it is optimized for Gen9 Skylake and later, which is what probably any modern PC or laptop (or Apple Intel Mac) sold in the last 5 years has. While this also works, it means you downgrade your OpenGL driver to something much older, with less features and lower performance, and likely no support for the latest Intel Gen 12 graphics chips.

1 Like