Why X server is using Mesa implementation of GLX and not nvidia drivers

glxinfo -B

name of display: :1
display: :1  screen: 0
direct rendering: Yes
Extended renderer info (GLX_MESA_query_renderer):
    Vendor: AMD (0x1002)
    Device: AMD Radeon Graphics (radeonsi, gfx1103_r1, LLVM 19.1.1, DRM 3.61, 6.14.0-24-generic) (0x1900)
    Version: 24.2.8
    Accelerated: yes
    Video memory: 2048MB
    Unified memory: no
    Preferred profile: core (0x1)
    Max core profile version: 4.6
    Max compat profile version: 4.6
    Max GLES1 profile version: 1.1
    Max GLES[23] profile version: 3.2
Memory info (GL_ATI_meminfo):
    VBO free memory - total: 835 MB, largest block: 835 MB
    VBO free aux. memory - total: 6770 MB, largest block: 6770 MB
    Texture free memory - total: 835 MB, largest block: 835 MB
    Texture free aux. memory - total: 6770 MB, largest block: 6770 MB
    Renderbuffer free memory - total: 835 MB, largest block: 835 MB
    Renderbuffer free aux. memory - total: 6770 MB, largest block: 6770 MB
Memory info (GL_NVX_gpu_memory_info):
    Dedicated video memory: 2048 MB
    Total available memory: 8936 MB
    Currently available dedicated video memory: 835 MB
OpenGL vendor string: AMD
OpenGL renderer string: AMD Radeon Graphics (radeonsi, gfx1103_r1, LLVM 19.1.1, DRM 3.61, 6.14.0-24-generic)
OpenGL core profile version string: 4.6 (Core Profile) Mesa 24.2.8-1ubuntu1~24.04.1
OpenGL core profile shading language version string: 4.60
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile

OpenGL version string: 4.6 (Compatibility Profile) Mesa 24.2.8-1ubuntu1~24.04.1
OpenGL shading language version string: 4.60
OpenGL context flags: (none)
OpenGL profile mask: compatibility profile

OpenGL ES profile version string: OpenGL ES 3.2 Mesa 24.2.8-1ubuntu1~24.04.1
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20

nvidia-settings shows information about the X server.

I have nvidia GEFORCE RTX installed on my system running Ubuntu 24.04.2 LTS.

Is mesa required for the X server to use nvidia drivers for openGL rendering on the GPU? This thread:

how-do-you-install-opengl-x11-glx-development-environment-on-ubuntu-18-04-2-lts

suggests that the mesa implementation is required to use openGL for rendering on nvidia graphics cards. Is this true? If not, how can I change the glx implementation and openGL core profile to avoid software rendering with mesa?

Thanks

The output shows your using AMD GPU, try

__NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia glxinfo -B

1 Like

Yes it seems I was using my AMD Raedon, and these changes as well as switching my PRIME profile to Performance allow me to run my applications with my nvidia card. Thanks!

X is most probably using AMD as the default rendering device. As pointed in the other thread, if you provide the basic info about your config, then we can verify this and change it to use Nvidia by default, so no PRIME voodoo incantations will be necessary.

Running __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia glxinfo -B

name of display: :1
display: :1  screen: 0
direct rendering: Yes
Memory info (GL_NVX_gpu_memory_info):
    Dedicated video memory: 6144 MB
    Total available memory: 6144 MB
    Currently available dedicated video memory: 5793 MB
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: NVIDIA GeForce RTX 3050 6GB Laptop GPU/PCIe/SSE2
OpenGL core profile version string: 4.6.0 NVIDIA 570.169
OpenGL core profile shading language version string: 4.60 NVIDIA
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile

OpenGL version string: 4.6.0 NVIDIA 570.169
OpenGL shading language version string: 4.60 NVIDIA
OpenGL context flags: (none)
OpenGL profile mask: (none)

OpenGL ES profile version string: OpenGL ES 3.2 NVIDIA 570.169
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20

So that seems to work for one.

Also /etc/X11/xorg.conf.d is empty currently, I thought I saw it is not automatically configured these days. And AMD Phoenix3 is VGA compatible on my laptop.

So X most probably autoconfigures itself to use AMD as the default rendering device as stated before. Try putting in /etc/X11/xorg.conf.d a file with contents similar to the following after replacing the PCIe bus IDs:

Section "Device"
        Identifier "Amd"
        Driver "amdgpu"
        BusID "PCI:0:2:0"  ## replace with the actual value
EndSection

Section "Device"
        Identifier "Nvidia"
        Driver "nvidia"
        Option "AllowEmptyInitialConfiguration" "true"
        BusID "PCI:1:0:0"  ## replace with the actual value
EndSection

Section "Screen"
        Identifier "dualGPU"
        Device "Nvidia"  ## primary GPU performing the rendering
        GPUDevice "Amd"  ## secondary GPU providing additional monitors
EndSection

This will make your Nvidia the default rendering device, so all these __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia and prime-run should not be necessary anymore.
You can obtain bus IDs from lspci (that’s why I asked for its output), but bare in mind that it outputs hex, while the X config file uses decimal, so convert appropriately.