Problem running Psychtoolbox on Ubuntu 22.04

Hi

We are trying to run the Psychtoolbox SimpleMovieDemo (PTB version 3.0.19 - Flavor: Debian package) in Ubuntu. To open psychtoolbox in Matlab, we use the ptb3-matlab command in the ubuntu Terminal.

Originally, when trying to run the SimpleMovieDemo, the demo would not start at all and we got this error in Matlab:

PTB-WARNING: Your graphics driver doesn’t allow me to control syncing wrt. vertical retrace!
PTB-WARNING: Please update your display graphics driver as soon as possible to fix this.
PTB-WARNING: Until then, you can manually enable syncing to VBL somehow in a manner that is
PTB-WARNING: dependent on the type of gfx-card and driver. Google is your friend…
PTB-WARNING: Seems that a Mesa OpenGL software renderer is active! This will likely cause miserable
PTB-WARNING: performance, lack of functionality and severe timing and synchronization problems.
PTB-WARNING: Most likely you are running Psychtoolbox on a Matlab version 8.4 (R2014b) or later and
PTB-WARNING: Matlab is causing this problem by overriding your operating systems OpenGL library with
PTB-WARNING: its own outdated software library. Please run the setup script PsychLinuxConfiguration()
PTB-WARNING: now from your Matlab command window and then quit and restart Matlab to fix this problem.
PTB-WARNING: Actually, it is pointless to continue with the software renderer, as that will cause more trouble than good.
PTB-WARNING: I will abort now. Read the troubleshooting tips above to fix the problem. You can override this if you add the following
PTB-WARNING: command: Screen(‘Preference’, ‘ConserveVRAM’, 64); to get a functional, but close to useless window up and running. Error using SimpleMovieDemo (line 40) Error using Screen See error message printed above.

From what we can tell, we are using the most current display graphics driver.
We then tried to force the terminal to stop using the Mesa OpenGL software renderer (due to the warning of it being active and causing lack of functionality). This caused some change but unfortunately not success: Now, immediately when we open Matlab (using ptb3-matlab), the terminal shows this error:

Gtk-Message: 12:24:12.901: Failed to load module “canberra-gtk-module”
libGL error: did not find extension DRI_Mesa version 1
libGL error: failed to load driver: i965
libGL error: did not find extension DRI_Mesa version 1
libGL error: failed to load driver: i965
libGL error: did not find extension DRI_Mesa version 1
libGL error: failed to load driver: i965
libGL error: did not find extension DRI_Mesa version 1
libGL error: failed to load driver: i965

And when running the command “SimpleMovieDemo” in the matlab command window, a black screen now starts up as though the demo begins to run, but then it gets stuck on this black screen and shows it indefinitely. We then have to abort via Esc, leading to the closing of Matlab, which leaves us with no error code to troubleshoot.

We tried to load the canberra module mentioned in the Terminal error when opening Matlab, but the Terminal then gives back the info that it is already installed.

These are the configurations of the system
:00.0 Host bridge: Intel Corporation Device a706
00:02.0 VGA compatible controller: Intel Corporation Device a7a0 (rev 04)
00:04.0 Signal processing controller: Intel Corporation Device a71d
00:06.0 PCI bridge: Intel Corporation Device a74d
00:07.0 PCI bridge: Intel Corporation Device a76e
00:08.0 System peripheral: Intel Corporation Device a74f
00:0d.0 USB controller: Intel Corporation Device a71e
00:0d.2 USB controller: Intel Corporation Device a73e
00:14.0 USB controller: Intel Corporation Alder Lake PCH USB 3.2 xHCI Host Controller (rev 01)
00:14.2 RAM memory: Intel Corporation Alder Lake PCH Shared SRAM (rev 01)
00:14.3 Network controller: Intel Corporation Device 51f1 (rev 01)
00:15.0 Serial bus controller: Intel Corporation Alder Lake PCH Serial IO I2C Controller #0 (rev 01)
00:15.3 Serial bus controller: Intel Corporation Alder Lake PCH Serial IO I2C Controller #3 (rev 01)
00:16.0 Communication controller: Intel Corporation Alder Lake PCH HECI Controller (rev 01)
00:1c.0 PCI bridge: Intel Corporation Device 51b8 (rev 01)
00:1c.4 PCI bridge: Intel Corporation Device 51bc (rev 01)
00:1f.0 ISA bridge: Intel Corporation Device 519d (rev 01)
00:1f.3 Multimedia audio controller: Intel Corporation Device 51ca (rev 01)
00:1f.4 SMBus: Intel Corporation Alder Lake PCH-P SMBus Host Controller (rev 01)
00:1f.5 Serial bus controller: Intel Corporation Alder Lake-P PCH SPI Controller (rev 01)
00:1f.6 Ethernet controller: Intel Corporation Device 0dc6 (rev 01)
01:00.0 Non-Volatile memory controller: Sandisk Corp Device 5016 (rev 01)
44:00.0 SD Host controller: O2 Micro, Inc. SD/MMC Card Reader Controller (rev 01-9

The system running it is
Ubuntu 22.04.4 LTS
13th Gen Intel® Core™ i7-13700H × 20+
llvmpipe (LLVM 15.0.7, 256 bits)

We assume there is an issue with the graphics driver / renderer going on that isn’t allowing PTB to run properly, but we are not sure how to troubleshoot this.
We would very much appreciate any ideas on what steps to take to get our configuration set up so PTB can run smoothly.

Thanks in advance
Lorena

Recent Matlab? The hardware OpenGL driver for your Intel graphics chip isn’t/can’t be used for some reason, the llvmpipe software renderer is pointless for most tasks.

Did you run PsychLinuxConfiguration once, as the warning messages you posted told you to do? Did you follow Psychtoolbox-3 - Download, Installation, and Update to the point, wrt. fixing compatibility issues caused by Matlab? Omitting one of these steps is usually causing this, following them pretty much always fixed it reliably.

Typically the Octave version of PTB runs out of the box, and these problems are caused by Matlab bugs, and above workarounds fixes them.

Typically, to recover without losing your Matlab environment in this situation, type ‘sca’ and hit return. You should be returned to the console, etc. I second Mario’s comments; we’ve had to reinstall Ubuntu a couple of times; the PsychLinuxConfiguration (plus XOrgConfCreator, I think) restore everything we need in the Ubuntu OS. (We are running double screens and do a configuration to allow us to present on one and keep the main screen as a Matlab console).

Thank you both! We solved the problem by reinstalling everything again (including Ubuntu). Now, when we run the SimpleMovieDemo from Matlab (using the ptb3-matlab command in the Ubuntu terminal), it seems to run for a few seconds and then we get the following error:

PTB-ERROR: In Screen(‘GetMovieImage’) for movie 0: Timed out while waiting for new frame after 5 seconds!

No other additional warnings.

Anyway, we tried to run the task we are intending to run and we got the following (in case it helps or both error messages are related):

Error in function SetMouseHelper: Usage error
Invalid ‘mouseIndex’ provided. No such master cursor pointer.
PTB-INFO: Using PortAudio V19.7.0-devel, revision 147dd722548358763a8b649b3e4b41dfffbcfbb6
Run crashed. Results were saved as: Error_RRS_0002_P1_05-Aug-2024_17-35
** Error!! ***
Error using SetMouse (line 92)
Error using Screen
Usage:

Screen(‘SetMouseHelper’, windowPntrOrScreenNumber, x, y [, mouseIndex][, detachFromMouse]);

Error in slideScale (line 213)
SetMouse(round(x), round(rect(4)*scalaPosition), screenPointer, 1);

Error in getConfidence (line 96)
[position, ConfTimeStamp, RT, answer] = slideScale(scr.win, …

Error in main (line 442)
[vars] = getConfidence(keys, scr, vars);

Any input will be welcome! Thanks in advance!

I assume that slideScale() function was inherited from somewhere, not written by you, but by someone who didn’t quite understand proper use of the mouseId parameter of SetMouse. It hard-codes the optional mouseid parameter to 1 in its call to SetMouse(), and no such master pointer exists → Fail. Unless the user or script created additional master pointers, i.e., additional mouse cursors, there will be only one master pointer and that parameter is not needed. One can use
pointers = GetMouseIndices ('masterPointer') to enumerate all available master pointers, but on a normally setup system there will only be one,iow.

SetMouse(round(x), round(rect(4)*scalaPosition), screenPointer); in line 213 of slideScale.m would do the trick.

Wrt. SimpleMovieDemo.m, that should work if the codecs for proprietary formats like H264 have been installed ( sudo apt install gstreamer1.0-libav) which normally happens automatically if you install PTB from NeuroDebian. So the video plays for a few seconds, then hangs?

Anyhow, this was already more free advice given than reasonable. For further support by me if needed, please buy a paid support membership and provide authentication tokens.

-mario