Public bug reported:

I am using nvidia prime with the on-demand profile. When I run matlab I
get the following error inside matlab (see attached pic):

```
com.jogamp.opengl.GLException: X11GLXDrawableFactory - Could not initialize 
shared resources for X11GraphicsDevice[type .x11, connection :0, unitID 0, 
handle 0x0, owner false, ResourceToolkitLock[obj 0x1d2bcaf5, isOwner false, 
<572d89a7, 585c0830>[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
```
If I run opengl info:

```
MATLAB has experienced a low-level graphics error, and may not have drawn 
correctly.
Read about what you can do to prevent this issue at Resolving Low-Level 
Graphics Issues then restart MATLAB.
To share details of this issue with MathWorks technical support,
please include this file with your service request.
                          Version: ''
                           Vendor: ''
                         Renderer: 'None'
            RendererDriverVersion: ''
        RendererDriverReleaseDate: ''
                   MaxTextureSize: 0
                           Visual: ''
                         Software: 0
             HardwareSupportLevel: 'full'
        SupportsGraphicsSmoothing: 0
    SupportsDepthPeelTransparency: 0
       SupportsAlignVertexCenters: 0
                       Extensions: {}
               MaxFrameBufferSize: 0
```
In the Arch wiki I found a solution, that is to set the environmental variable 
to override the mesa driver. That is, everything runs as it should if I run in 
terminal:

```
export MESA_LOADER_DRIVER_OVERRIDE=i965; matlab
```

So I would suggest to add an option to matlab-support to add the
following line in the matlab.desktop file:

```
Exec=env MESA_LOADER_DRIVER_OVERRIDE=i965 matlab -desktop
```

Also, if I use the performance profile of nvidia everything is fine.

ProblemType: Bug
DistroRelease: Ubuntu 20.04
Package: matlab-support 0.0.21.1 [modified: 
usr/share/applications/matlab.desktop]
ProcVersionSignature: Ubuntu 5.4.0-21.25-generic 5.4.27
Uname: Linux 5.4.0-21-generic x86_64
NonfreeKernelModules: nvidia_modeset nvidia
ApportVersion: 2.20.11-0ubuntu26
Architecture: amd64
CasperMD5CheckResult: skip
CurrentDesktop: ubuntu:GNOME
Date: Sun Apr 12 09:45:41 2020
InstallationDate: Installed on 2020-04-05 (6 days ago)
InstallationMedia: Ubuntu 20.04 LTS "Focal Fossa" - Beta amd64 (20200402)
PackageArchitecture: all
ProcEnviron:
 TERM=xterm-256color
 PATH=(custom, no user)
 XDG_RUNTIME_DIR=<set>
 LANG=de_DE.UTF-8
 SHELL=/bin/bash
SourcePackage: matlab-support
UpgradeStatus: No upgrade log present (probably fresh install)

** Affects: matlab-support (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: amd64 apport-bug focal matlab mesa opengl

** Attachment added: "I get this when I simply run matlab"
   https://bugs.launchpad.net/bugs/1872277/+attachment/5352405/+files/bug.png

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1872277

Title:
  opengl problem with nvidia on-demand solvable with
  MESA_LOADER_DRIVER_OVERRIDE=i965

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/matlab-support/+bug/1872277/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to