# Problem with AMD graphics driver and OpenGL under Linux

**URL:** <https://psychtoolbox.discourse.group/t/problem-with-amd-graphics-driver-and-opengl-under-linux/3685>\
**Category:** Hardware\
**Tags:** linux, gpu\
**Created:** [February 19, 2021, 1:37pm UTC](https://psychtoolbox.discourse.group/t/problem-with-amd-graphics-driver-and-opengl-under-linux/3685 "2021-02-19T13:37:32Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![sakusaku](https://avatars.discourse-cdn.com/v4/letter/s/71e660/32.png) [@sakusaku](https://psychtoolbox.discourse.group/u/sakusaku)\
**Post date:** [February 19, 2021, 1:37pm UTC](https://psychtoolbox.discourse.group/t/problem-with-amd-graphics-driver-and-opengl-under-linux/3685/1 "2021-02-19T13:37:33Z")

</div>

Hello,

I try to run MovieDemo at my computer (ubuntu 20.04LTS 64bit, Intell core i7-4790, RAM :16GB) with AMD’s GPU (Radeon RX 550 Series), but I get some error.

I am using MATLAB 2020a version and installed PTB-3 from NeuroDebian’s webpage ([matlab-psychtoolbox-3 – toolbox for vision research – Matlab bindings — Debian Neuroscience Package Repository](http://neuro.debian.net/pkgs/matlab-psychtoolbox-3.html)).

When I run MovieDemo, in order to check if the PTB-3 settings are correct, then get error message as follows:

> _PTB-INFO: This is Psychtoolbox-3 for GNU/Linux X11, under Matlab 64-Bit (Version 3.0.17 - Build date: Oct 31 2020)._
> 
> _PTB-INFO: OS support status: Linux 5.8.0-43-generic 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: Connected to Advanced Micro Devices, Inc. [AMD/ATI] Lexa PRO [Radeon 540/540X/550/550X / RX 540X/550/550X] GPU with DCE-11.0 display engine [6 heads]._
> 
> _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._
> 
> _エラー: Screen_
> 
> _See error message printed above._
> 
> _エラー: MovieDemo (line 124)_
> 
> _[window,windowRect]=Screen(screenNumber,‘OpenWindow’,0,[],[],2);_
> 
> _\>\>_

I try to use PsychLinuxConfiguration(), but get further error below:

> com.jogamp.opengl.GLException: X11GLXDrawableFactory - Could not initialize shared resources for X11GraphicsDevice[type .x11, connection :0, unitID 0, handle 0x0, owner false, ResourceToolkitLock[obj 0x7a3ab776, isOwner false, \<3418ddd8, 5270b55\>[count 0, qsz 0, owner]]]
> 
> 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: com.jogamp.opengl.GLException: AWT-EventQueue-0-SharedResourceRunner: Unable to create temp OpenGL context(1)
> 
> at jogamp.opengl.x11.glx.X11GLXContext.createImpl(X11GLXContext.java:368)
> 
> at jogamp.opengl.GLContextImpl.makeCurrentWithinLock(GLContextImpl.java:759)
> 
> at jogamp.opengl.GLContextImpl.makeCurrent(GLContextImpl.java:642)
> 
> at jogamp.opengl.GLContextImpl.makeCurrent(GLContextImpl.java:580)
> 
> at jogamp.opengl.x11.glx.X11GLXDrawableFactory$SharedResourceImplementation.createSharedResource(X11GLXDrawableFactory.java:297)
> 
> … 2 more
> 
> > > MovieDemo
> 
> MovieDemo.m is short. Read it to see how easy it
> 
> is to show movies.
> 
> PTB-INFO: This is Psychtoolbox-3 for GNU/Linux X11, under Matlab 64-Bit (Version 3.0.17 - Build date: Oct 31 2020).
> 
> PTB-INFO: OS support status: Linux 5.8.0-43-generic 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: Connected to Advanced Micro Devices, Inc. [AMD/ATI] Lexa PRO [Radeon 540/540X/550/550X / RX 540X/550/550X] GPU with DCE-11.0 display engine [6 heads].
> 
> PTB-ERROR:[glXCreateContext() failed] OpenGL context creation failed!
> 
> PTB-ERROR[Low-Level setup of window failed]:The specified gpu + display + gfx-driver combo may not support some requested feature.
> 
> エラー: Screen
> 
> See error message printed above.
> 
> エラー: MovieDemo (line 124)
> 
> [window,windowRect]=Screen(screenNumber,‘OpenWindow’,0,,,2);
> 
> > >

Also, when I typed the ptb3-matlab code from the Linux command prompt, it returned the following error:

> libGL error: MESA-LOADER: failed to open radeonsi (search paths /usr/lib/x86\_64-linux-gnu/dri:$${ORIGIN}/dri:/usr/lib/dri)
> 
> libGL error: failed to load driver: radeonsi
> 
> libGL error: MESA-LOADER: failed to open radeonsi (search paths /usr/lib/x86\_64-linux-gnu/dri:$${ORIGIN}/dri:/usr/lib/dri)
> 
> libGL error: failed to load driver: radeonsi
> 
> libGL error: MESA-LOADER: failed to open swrast (search paths /usr/lib/x86\_64-linux-gnu/dri:$${ORIGIN}/dri:/usr/lib/dri)
> 
> libGL error: failed to load driver: swrast

I’m using the latest Linux kernel (5.8.0-43-generic) and probably using the latest driver of amdgpu (not amdgpu-pro), so I don’t know why I’m getting the error message above. Does anyone have a solution?

Thanks for the support!

---

<div class="post-metadata">

**Author:** ![mariokleiner](https://avatars.discourse-cdn.com/v4/letter/m/13edae/32.png) [@mariokleiner](https://psychtoolbox.discourse.group/u/mariokleiner)\
**Post date:** [February 19, 2021, 7:25pm UTC](https://psychtoolbox.discourse.group/t/problem-with-amd-graphics-driver-and-opengl-under-linux/3685/2 "2021-02-19T19:25:41Z")

</div>

This question has been asked and answered many times before, searching the forum for snippets of the error messages will do wonders:

> [@Up to date hardware recommendations](https://psychtoolbox.discourse.group/t/up-to-date-hardware-recommendations/3351/7):
>
> Ian’s solution is the right one, with the tweak that after a Matlab update, you could do: sudo dpkg-reconfigure matlab-support to only type one command instead of two to reconfigure, but both methods will work. The problem here is a Mathworks/Matlab induced one, and unfortunately Mathworks does a very poor job at this. Matlab ships its own outdated libraries that override the proper modern libraries shipping with Ubuntu. Depending on what Matlab version you install on which Linux distro versi…

-mario

---

<div class="post-metadata">

**Author:** ![Ian-Max-Andolina](https://yyz2.discourse-cdn.com/free1/user_avatar/psychtoolbox.discourse.group/ian-max-andolina/32/4_2.png) [@Ian-Max-Andolina](https://psychtoolbox.discourse.group/u/Ian-Max-Andolina)\
**Post date:** [February 20, 2021, 2:03am UTC](https://psychtoolbox.discourse.group/t/problem-with-amd-graphics-driver-and-opengl-under-linux/3685/3 "2021-02-20T02:03:03Z")

</div>

Mario, I wonder if this common mistake can be flagged in PsychLinuxConfiguration.m somehow? Currently you do check software opengl for old matlab versions: [Psychtoolbox-3/PsychLinuxConfiguration.m at master · kleinerm/Psychtoolbox-3 · GitHub](https://github.com/kleinerm/Psychtoolbox-3/blob/master/Psychtoolbox/PsychLinuxConfiguration.m#L721) — I’m not sure the best way to probe for this, we need to confirm matlab-support is installed and the libraries have been replaced, that may be too flakey to reliably probe for?

---

<div class="post-metadata">

**Author:** ![sakusaku](https://avatars.discourse-cdn.com/v4/letter/s/71e660/32.png) [@sakusaku](https://psychtoolbox.discourse.group/u/sakusaku)\
**Post date:** [February 20, 2021, 12:11pm UTC](https://psychtoolbox.discourse.group/t/problem-with-amd-graphics-driver-and-opengl-under-linux/3685/4 "2021-02-20T12:11:34Z")

</div>

Dear Mario,

Thank you for your comment. I can solve the problem!

---

<div class="post-metadata">

**Author:** ![mariokleiner](https://avatars.discourse-cdn.com/v4/letter/m/13edae/32.png) [@mariokleiner](https://psychtoolbox.discourse.group/u/mariokleiner)\
**Post date:** [February 20, 2021, 8:15pm UTC](https://psychtoolbox.discourse.group/t/problem-with-amd-graphics-driver-and-opengl-under-linux/3685/5 "2021-02-20T20:15:55Z")

</div>

Probably not impossible, but this quickly gets convoluted, especially as/if Mathworks shuffles things around in different versions. We have the same problems with the macOS and Windows versions, just the symptoms caused by them are different on each OS. And with Apples trainwrecks one never quite knows what is whose fault, although most of the time it is Apple. I wish Mathworks software engineering in certain areas like graphics/plotting system, or their installer wouldn’t be so poor, given this is a premium price product.

What i did yesterday is rewrite our download instructions on the website once again, adding more guidance towards this issue.

-mario
