setting GLX provider in two concurrent X servers

/dev/fra devfra at inventati.org
Mon Oct 22 22:48:37 BST 2018


Hi everyone,

I hope this is the correct ML to discuss this topic, if not please redirect me
to the appropriate one.

I have an Optimus laptop and I am trying to set up two different X servers, so
that the 'main' one is running on the Intel integrated graphics card and a
secondary one is running on the NVIDIA discrete graphics card (basically what
nvidia-xrun [1] does).

I succeeded so far but I would like to know if there is a way to set a
specific GLX provider per each X server, and not system wide, via
update-alternatives or other means.

About my setup:

- Debian Buster with nvidia driver (396.54-1) from the Debian Experimental
  repository;

- the NVIDIA graphics card is turned on via bbswitch with:
      $ sudo tee /proc/acpi/bbswitch <<<ON

- and the nvidia kernel modules are loaded with:
      $ sudo modprobe nvidia-current-drm

- for the second X server instance a custom xorg.conf is provided, as per
  NVIDIA documentation [2]

- before starting the second X server, the GLX provider is set with
      $ update-alternatives --set glx /usr/lib/nvidia

- and then the second X server is run from a free tty with:
      $ xinit my-custom-xinitrc -- :1 vt$XDG_VTNR -nolisten tcp \
         -br -config my-custom-xorg.conf


Now, by using update-alternatives I set globally the GLX provider, but this
means that I can use the graphical acceleration capabilities only in one of
the two X servers, e.g.:

- glx set to /usr/lib/nvidia
  --> glxgears fails on the first X server with the Intel igpu
  --> glxgears works on the second X server whit the Nvidia dgpu


As an alternative way, I am trying to not set the GLX provider via
update-alternatives and instead using an additional xorg configuration snippet
for the second X server, this one:

    $ cat /etc/nvidia/nvidia-drm-outputclass.conf
    ..
    Section "Files"
        ModulePath     "/usr/lib/nvidia/current/modules"
        ModulePath     "/usr/lib/xorg/modules"
    EndSection

    Section "OutputClass"
        Identifier     "nvidia"
        MatchDriver    "nvidia-drm"
        Driver         "nvidia"
    EndSection

As is, this snippet does not work and the second X server fails to start with
it. But if I change the first ModulePath entry with "/usr/lib/nvidia" or
"/usr/lib/nvidia/current" it works, almost.

In fact, in this way I can run glxgears in the two X server instances and with
the correct drivers ("glxgears -info" say so, Mesa for the first one, NVIDIA
for second one), but in the second X server Vulkan applications do not work
and EGL is provided by MESA instead of NVIDIA.

What am I missing here?

Cheers


[1] https://github.com/Witko/nvidia-xrun
[2] http://us.download.nvidia.com/XFree86/Linux-x86/390.87/README/randr14.html






More information about the pkg-nvidia-devel mailing list