Matlab + Intel graphics plotting bug again (Was: X screen configuration doesn't work)

Hello, PTB community!

I have some issues with my setup. I have a Linux PC and I needed to reinstall everything due to a graphic cards issue (I don’t know what happened but the PC started refusing to turn on.). I have 2 monitors connected to the PC and I tried to configure X screens with XOrgConfiguraionCreator and then selected my config with XOrgConfigurationSelector. I had no error but when I restarted the PC, both monitors were active, and this error showed when I launched MATLAB:

com.jogamp.opengl.GLException: X11GLXDrawableFactory - Could not initialize shared resources for X11GraphicsDevice[type .x11, connection :0, unitID 0, handle 0x0, owner false, ResourceToolkitLock[obj 0x1e237daf, isOwner false, <18e1ad01, 7d19a277>[count 0, qsz 0, owner <NULL>]]]
	at jogamp.opengl.x11.glx.X11GLXDrawableFactory$SharedResourceImplementation.createSharedResource(X11GLXDrawableFactory.java:326)
	at jogamp.opengl.SharedResourceRunner.run(SharedResourceRunner.java:297)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.NullPointerException
	at jogamp.opengl.GLContextImpl.makeCurrent(GLContextImpl.java:688)
	at jogamp.opengl.GLContextImpl.makeCurrent(GLContextImpl.java:580)
	at jogamp.opengl.x11.glx.X11GLXDrawableFactory$SharedResourceImplementation.createSharedResource(X11GLXDrawableFactory.java:297)
	... 2 more

I couldn’t find a solution to this. This seems a bit advanced for me but I can do my best with some guidance.

I am using MATLAB R2022b on Ubuntu 22.04. I installed PTB as recommended on the website. I reconfigured MATLAB (sudo dpkg-reconfigure matlab-support) and I installed low-latency kernel as well.

Looking forward to your reply!

Cemre Yilmaz (identified as she/her)
#X11 #XOrgConfiguration #XScreen

This is a Matlab bug on Linux + Intel graphics chips, often reported to Mathworks, never fixed by them. It doesn’t affect Psychtoolbox at all, just plotting in Matlab.

Diagnosis and ok solution see:

Update with a possibly better solution on recent Matlab:

What also worked for me on Ubuntu 20.04.6-LTS, Intel graphics, Mesa 21.2.6, with Matlab R2023b is the following older approach at fixing it:

-mario