3

I am unable to get hardware based OpenGL rendering to work in MATLAB R2015a or R2014b. Prior to R2014b, and the rewrite of the MATLAB graphics stack, everything worked fine. From MATLAB

>> opengl info
                          Version: '3.0 Mesa 10.6.5'
                           Vendor: 'Intel Open Source Technology Center'
                         Renderer: 'Mesa DRI Intel(R) Sandybridge Mobile '
                   MaxTextureSize: 8192
                           Visual: 'Visual 0xac, (RGBA 32 bits (8 8 8 8), Z depth 16 bits, Hardware acceleration, Double buffer, Antialias 4 samples)'
                         Software: 'true'
        SupportsGraphicsSmoothing: 1
    SupportsDepthPeelTransparency: 1
       SupportsAlignVertexCenters: 1
                       Extensions: {199x1 cell}
               MaxFrameBufferSize: 8192

I was expecting/wanting "Software" to be false.

$ ldd /opt/tmw/matlab/bin/glnxa64/glren.so | grep libGL
    libGL.so.1 => /usr/lib/libGL.so.1 (0x00007f0a3b871000)
    libGLU.so.1 => /usr/lib/libGLU.so.1 (0x00007f0a3b5ef000)

suggests that MATLAB is finding the system libraries (which is what TMW says I want) and TMW confirms that the library versions libGL.so.1.2.0 and libGLU.so.1.3.1 are compatible.

$ LIBGL_DEBUG=verbose matlab
libGL: OpenDriver: trying /usr/lib/xorg/modules/dri/tls/i965_dri.so
libGL: OpenDriver: trying /usr/lib/xorg/modules/dri/i965_dri.so
libGL: Using DRI2 for screen 0

Does not provide any useful info. I have been in contact with TMW technical support and they have decided it is not a MATLAB issue despite

$ glxinfo | grep render
direct rendering: Yes
OpenGL renderer string: Mesa DRI Intel(R) Sandybridge Mobile

suggesting hardware based OpenGL is working outside MATLAB. I have done most of my testing on Arch Linux with an Intel graphics card, but have also tried ATI and Nvidia cards without any luck. I recently created a Debian 7 chroot, since that is an officially supported OS, but still had no luck with the Intel card.

Everything has been done with the stock Arch kernel. Could that be the cause of the problem? How do I debug/trace the issue?

1

For me the followed works (under ArchLinux with R2017a (prerelease) with a laptop having only intel graphics):

export LD_PRELOAD=/usr/lib/libstdc++.so
export LD_LIBRARY_PATH=/usr/lib/xorg/modules/dri/
/net/sw/MATLAB/R2017a/bin/glnxa64/MATLAB

Note that in the last step I'm calling the MATLAB executable directly (not the helper script that performs some LD_* manipulation)

>> opengl info
                          Version: '3.0 Mesa 17.0.0'
                           Vendor: 'Intel Open Source Technology Center'
                         Renderer: 'Mesa DRI Intel(R) Haswell Mobile '
                   MaxTextureSize: 16384
                           Visual: 'Visual 0xcb, (RGBA 32 bits (8 8 8 8), Z depth 16 bits, Hardware acceleration, Double buffer, Antialias 8 samples)'
                         Software: 'false'
             HardwareSupportLevel: 'full'
        SupportsGraphicsSmoothing: 1
    SupportsDepthPeelTransparency: 1
       SupportsAlignVertexCenters: 1
                       Extensions: {230×1 cell}
               MaxFrameBufferSize: 16384
-1

Does MATLAB have any libstdc++.so.6* libraries in its install path? MATLAB ships with an outdated version of c++ standard library. If you distribution compiled Mesa with a newer version of GCC, it will fail to load the actual hardware acceleration backend, which will force software rendering. You can try removing that file only from your MATLAB install (DON'T remove it from your distribution install, that will break it entirely), that may help. I do it from my installs, but you wan't to be careful not to remove more then necessary.

I'm not sure if that will help, as I'd expect a slightly different message from you opengl info command, but its something to try.

  • I can remove the file, but as mentioned in my question both ldd and LIBGL_DEBUG tell me I am using the system libraries. – StrongBad Jan 27 '16 at 19:17
  • MATLAB starts with a custom LD_LIBRARY_PATH which overrides the version of libstdc++.so that is used. It doesn't override the i965_dri.so used though, nor the libGL.so. I know this library creates issues for various things with MATLAB for me, so I figured this may be your problem too. – MJD Jan 28 '16 at 18:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.