I finally figured it out! Now I can run Matlab R2019b on Ubuntu 18.04 LTS with 
decent graphics performance over x2go, even with transparency using the Mesa 
llvmpipe software OpenGL driver.

Benchmark for a simple scene:

No transparency: ~40 ms per frame
With transparency: ~58 ms per frmae

So still some performance penalty for transparency, but much better.


HOWTO:

First install LLVM: sudo apt install llvm-dev

I downloaded mesa-20.1.0 (latest version right now) and configured it like this 
(in the unzipped source directory):

mkdir build
cd build
meson -D glx=gallium-xlib -D gallium-drivers=swrast -D platforms=x11 -D 
dri3=false -D dri-drivers="" -D vulkan-drivers="" -D buildtype=release -D 
optimization=3 -Dprefix=/usr/local/mesa-20.1.0/

Then I built and installed it as follows:
ninja
sudo ninja install

Then to make Matlab load the new driver, I needed to modify Matlab's lib search 
path:
cp $MATLAB_DIRECTORY/bin/.matlab7rc.sh ~

Edit the file ~/.matlab7rc.sh, find the glnxa* section and add 
/usr/local/mesa-20.1.0/lib/x86_64-linux-gnu to LDPATH_PREFIX 

Add to your .profile: export MESA_GL_VERSION_OVERRIDE=3.0

Seems like anything will work for the version override except for 3.1, but I 
didn't debug this further.


— 
Johannes Töger

Associate Senior Lecturer
Cardiac MR Group
Department of Clinical Sciences Lund, Clinical Physiology
Lund University, Sweden

-----Original Message-----
From: Ulrich Sibiller <ul...@gmx.de> 
Sent: Wednesday, May 27, 2020 14:29
To: Johannes Töger <johannes.to...@med.lu.se>
Subject: Re: [X2Go-User] Matlab graphics performance when running in x2go

Thanks!

On Wed, May 27, 2020 at 1:59 PM Johannes Töger <johannes.to...@med.lu.se> wrote:
>
> OK I see - we only have CUDA cards in those machines to do computations, so 
> VirtualGL won't work then.
>
> Maybe I'll try to compile an optimized software Mesa/Gallium -- I'll let you 
> know what happens if I find something interesting, so it's documented on the 
> mailing list at least.
>
>
> —
> Johannes Töger
>
> Associate Senior Lecturer
> Cardiac MR Group
> Department of Clinical Sciences Lund, Clinical Physiology Lund 
> University, Sweden
>
> -----Original Message-----
> From: Ulrich Sibiller <ul...@gmx.de>
> Sent: Wednesday, May 27, 2020 13:20
> To: Johannes Töger <johannes.to...@med.lu.se>
> Cc: x2go users <x2go-user@lists.x2go.org>
> Subject: Re: [X2Go-User] Matlab graphics performance when running in 
> x2go
>
> On Wed, May 27, 2020 at 1:07 PM Johannes Töger <johannes.to...@med.lu.se> 
> wrote:
> >
> > Thanks for your quick reply.
> >
> > It turns out that Matlab by default uses an older Mesa software rendering 
> > module (17.3) when there is no hardware OpenGL. I tried to compile my own 
> > version with additional optimizations and LLVMPipe etc, but Matlab wouldn't 
> > accept it. No more time to debug it today, but maybe later.
> >
> > Is there any documentation on using VirtualGL with x2go? I tried to google 
> > it, but no luck.
>
> Not that I am aware. I have never checked it out practically.
> Generally you will have to dedicate the graphics hardware to that
> (only) session which might make it a no-go, depending on your setup.
>
> Uli
_______________________________________________
x2go-user mailing list
x2go-user@lists.x2go.org
https://lists.x2go.org/listinfo/x2go-user

Reply via email to