Error using Screen

Bug report is showed below:
PTB-INFO: This is Psychtoolbox-3 for GNU/Linux X11, under Matlab 64-Bit (Version 3.0.17 - Build date: May 14 2021).
PTB-INFO: OS support status: Linux 5.4.0-73-lowlatency Supported.
PTB-INFO: Type ‘PsychtoolboxVersion’ for more detailed version information.
PTB-INFO: Most parts of the Psychtoolbox distribution are licensed to you under terms of the MIT License, with
PTB-INFO: some restrictions. See file ‘License.txt’ in the Psychtoolbox root folder for the exact licensing conditions.

PTB-INFO: For information about paid priority support, community membership and commercial services, please type
PTB-INFO: ‘PsychPaidSupportAndServices’.

PTB-INFO: Many graphics cards do not support proper timing and timestamping of visual stimulus onset
PTB-INFO: when running in windowed mode (non-fullscreen). If PTB aborts with ‘Synchronization failure’
PTB-INFO: you can disable the sync test via call to Screen(‘Preference’, ‘SkipSyncTests’, 2); .
PTB-INFO: You won’t get proper stimulus onset timestamps though, so windowed mode may be of limited use.
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.

>>What I did for trying to solve this problem:
Step 1: I repeated the suggestion showed in the bug report, by running PsychLinuxConfiguration. It appeared that I successfully installed those files recommended by Author step by step. However, I reboot and reopen matlab and run Screen(‘OpenWindow’,0,[128,128,128],[0,0,300,300]) command, and this bug report happened again.

Step 2: I surfed internet and searched the same question asked by JacopoTurini on Github. And I applied the method provided by Professor Kleinerm (See page: Problem with graphics driver and Mesa OpenGL · Issue #536 · Psychtoolbox-3/Psychtoolbox-3 · GitHub). After I ran command “sudo apt-get install matlab-support” and finished this installation, I reboot and restarted maltab, however, this bug was still there when ran Screen(‘OpenWindow’,0,[128,128,128],[0,0,300,300]). I already installed Nvidia drivers (460 proprietary)

I really want to know how to solve this problem, please help me! Very THX!!

The software and OS are: MATLAB(R2021a), Ubuntu 20.04 LTS.

The hardware: Mi-Gaming-Laptop, CPU: core i7-9750H, GPU: GeForce RTX 2060 mobile / Gaphic HD 630.

Did you agree to replace the libraries when asked by the installer? You can try to install this again by un/reinstalling:

sudo apt purge matlab-support
sudo apt install matlab-support

make sure you are installing to the correct MATLAB install and say YES to replace the C++ libraries.

Possible additional problems

  • Your laptop is a hybrid (i.e. it has 2 different GPUs), and this can cause problems; Mario has mentioned some workarounds before, though I don’t remember what OS they were aimed at but search these forums.
  • You are using the proprietary NVidia driver but are you sure that Nouveau (the open-source MESA driver) is properly inactivated? Did you try with the Nouveau driver rather than proprietary one to see if it works better (although performance is much worse apparently).

Thank you so much for your suggestions!

I accept your advises by testing step by step today:

Firstly, I inactivated Nouveau driver and checked it by command “lsmod | grep nouveau”, and no value displayed.
Then I purged matlab-support and reinstalled it. It seemed that PTB worked correctly when I ran command “Screen(‘OpenWindow’,0,[128 128 128],[840,440,1020,640]);”. However, when I quit Matlab and restarted Matlab, there was a warning message (showed below):


I searched some forums for correcting this warning message by running “opengl(‘save’,‘software’);” on Matlab. However, I can’t successfully run command “Screen(‘OpenWindow’,0,[128 128 128],[840,440,1020,640]);” on Matlab again. The bug report showed before was again displayed.

Sincerely I want your help again for fixing this problem. Very Thx.

You need to get hardware OpenGL running, you can’t use this command. Try uninstalling and reinstalling MATLAB, then installing matlab-support again. This is a MATLAB error, so you could get support from Mathworks, they perpetually have OpenGL hardware problems with every release.

1 Like