14

On a fresh Arch Linux installation, I had difficulties with the graphics drivers. In the process, I have installed a lot of different drivers to somehow get the display working.

Now I need to determine which driver X is using. How to do that?

The installed packages include xf86-video-intel, xf86-video-nouveau, nvidia, xorg-drivers. To solve a strange issue to launch any graphical desktop manager i had to replace nividia-libgl with mesa-libgl.

Graphics: Intel HD Graphics 4000 / Nvidia GT 750M

The content of Xorg.0.log is: http://pastebin.com/YwiMZmG6

1
  • xrandr --listproviders
    – nyanpasu64
    Commented Aug 30, 2023 at 18:51

5 Answers 5

9

You can check the Xorg startup log file, usually /var/log/Xorg.0.log and look at which modules it is loading. By default Xorg can try to autodetect but you can manually force a driver by putting a Device stanza in an Xorg conf file. Here is what the Xorg startup log will look like for an nvidia card and the nvidia proprietary driver.

[  3702.470] (II) xfree86: Adding drm device (/dev/dri/card0)
[  3702.472] (--) PCI:*(0:3:0:0) 10de:1184:3842:3774 rev 161, Mem @ 0xfa000000/16777216, 0xd8000000/134217728, 0xd6000000/33554432, I/O @ 0x0000cc00/128, BIOS @ 0x????????/524288
[  3702.472] (II) LoadModule: "glx"
[  3702.473] (II) Loading /usr/lib64/opengl/nvidia/extensions/libglx.so
[  3702.476] (II) Module glx: vendor="NVIDIA Corporation"
[  3702.476]    compiled for 4.0.2, module version = 1.0.0
[  3702.476]    Module class: X.Org Server Extension
[  3702.476] (II) NVIDIA GLX Module  355.11  Wed Aug 26 16:02:11 PDT 2015
[  3702.476] (II) LoadModule: "nvidia"
[  3702.476] (II) Loading /usr/lib64/xorg/modules/drivers/nvidia_drv.so
[  3702.476] (II) Module nvidia: vendor="NVIDIA Corporation"
[  3702.476]    compiled for 4.0.2, module version = 1.0.0
[  3702.476]    Module class: X.Org Video Driver
[  3702.476] (II) NVIDIA dlloader X Driver  355.11  Wed Aug 26 15:38:55 PDT 2015
[  3702.476] (II) NVIDIA Unified Driver for all Supported NVIDIA GPUs
[  3702.476] (++) using VT number 7
3
  • Thank you. In my original post i uploaded the file. It does not contain any "Nvidia" and it does not contain "nouveau" either. Could you take a look and tell me which driver i am loading?
    – Alex
    Commented Dec 7, 2015 at 20:21
  • @Alex look for similar lines in your log. Your logfile is very clearly identifying that it is loading the intel drivers.
    – casey
    Commented Dec 7, 2015 at 20:29
  • 1
    Looking at the log is not that helpful, as Xorg can load (and unload) multiple drivers while probing the hardware.
    – fwyzard
    Commented Jun 29, 2018 at 7:22
9

One solution that I have found is to check what drivers are actually loaded while X is running. On my system, the drivers are installed under

  • /usr/lib/xorg/modules/drivers/
  • /usr/lib/x86_64-linux-gnu/nvidia/xorg/

so I can check what is currently loaded with

sudo lsof +D /usr/lib/xorg/modules/drivers/ +D /usr/lib/x86_64-linux-gnu/nvidia/xorg/

Right now I get

COMMAND  PID USER  FD   TYPE DEVICE SIZE/OFF   NODE NAME
Xorg    4473 root mem    REG  253,0    90360 536108 /usr/lib/xorg/modules/drivers/modesetting_drv.so

so I guess I'm using the modesetting driver.

2
  • 1
    Or easier, not requiring to know where the drivers are installed, sudo lsof | grep '_drv\.so$'. I also get evdev from this (in addition to nvidia), but I think it's OK to get this extra info.
    – Ruslan
    Commented May 25, 2021 at 20:07
  • While this generally works as expected, in some Linux distros the output may list several drivers at once (with just a single instance of Xorg and a single GPU), like ati_drv.so, amdgpu_drv.so, radeon_drv.so. Commented Mar 29, 2023 at 15:10
6

Here's an attempt to automatize the analysis of the log:

#!/bin/bash

if [ -z "$1" ]; then
    logfile=/var/log/Xorg.0.log
else
    logfile="$1"
fi

sed -n 's@.* Loading .*/\(.*\)_drv.so@\1@p' "$logfile" |
    while read driver; do
        if ! grep -q "Unloading $driver" "$logfile"; then
            echo $driver
            break
        fi
    done

Any ideas how to make it simpler are welcome. Ideally I'd like to have a direct solution — by a query to Xorg instead of parsing its logs.

4

I prefer to use glxinfo -B from mesa-utils package, and here is some sample pieces:

  • using Nvidia driver 470.63.01 and RTX3070 card:
    OpenGL renderer string: NVIDIA GeForce RTX 3070/PCIe/SSE2
    OpenGL core profile version string: 4.6.0 NVIDIA 470.63.01
    
  • using intel integrated card and mesa driver:
    OpenGL vendor string: Intel Open Source Technology Center
    OpenGL renderer string: Mesa DRI Intel(R) HD Graphics 520 (SKL GT2)
    OpenGL core profile version string: 4.6 (Core Profile) Mesa 20.0.8
    
  • using pure CPU implemented opengl driver in a headless remote session:
    OpenGL vendor string: Mesa/X.org
    OpenGL renderer string: llvmpipe (LLVM 12.0.0, 128 bits)
    OpenGL core profile version string: 4.5 (Core Profile) Mesa 21.2.6
    OpenGL core profile shading language version string: 4.50
    
1
  • 1
    Welcome to the site, and thank you for your contribution. However, if - as you write - you are not sure, please reconsider testing and verifying your proposed solution before posting it as a (definitive) answer.
    – AdminBee
    Commented Apr 25, 2022 at 8:46
0

How about this one:

xrandr --listproviders

Both the Intel and NVIDIA drivers are loaded in my machine.

Providers: number : 2
Provider 0: id: 0x45 cap: 0xb, Source Output, Sink Output, Sink Offload crtcs: 4 outputs: 3 associated providers: 1 name:Intel
Provider 1: id: 0x21f cap: 0x2, Sink Output crtcs: 4 outputs: 1 associated providers: 1 name:NVIDIA-G0

When I switch to the modesetting driver, the provider name changes.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .