Verifying whether Nvidia Optimus setup was done correctly (470xx legacy driver)

Bit by bit I’m configuring my main machine after switching to EOS and in the process some additional questions are popping up. Mainly ones related to nvidia and optimus.

Machine I’m talking about is a 10y.o Lenovo laptop with dedicated GeForce GTX 660M card (Kepler). According to Arch wiki it’s handled by legacy 470 driver and should support Prime offload out of the box.
I’ve installed 470 (+ its components) from AUR and seems like it was successfully applied:

lspci -k | grep -A 2 -E "(VGA|3D)"
00:02.0 VGA compatible controller: Intel Corporation 3rd Gen Core processor Graphics Controller (rev 09)
        Subsystem: Lenovo Device 3977
        Kernel driver in use: i915
--
01:00.0 VGA compatible controller: NVIDIA Corporation GK107M [GeForce GTX 660M] (rev a1)
        Subsystem: Lenovo Device 3977
        Kernel driver in use: nvidia

And here are packages I’ve got:

pacman -Qm
lib32-nvidia-470xx-utils 470.161.03-1
libxnvctrl-470xx 470.161.03-1
nvidia-470xx-dkms 470.161.03-2
nvidia-470xx-settings 470.161.03-1
nvidia-470xx-utils 470.161.03-2

What bothers me though is that my NVIDIA X Server Settings clearly doesn’t look like the ones I’ve encountered while reading various materials regarding Nvidia Optimus and Linux. No X server information, no prime profiles allowing me to switch graphics…

My NVIDIA X Server Settings

So either I missed something or didn’t understand correctly instructions provided by Wiki.

The interesting part is that I’ve installed Skyrim through Steam and its launcher actually detects dedicated GTX 660M graphics although performance is somewhat worse than what I had while using Win 8.1

Currently my goal is to correctly configure optimus without any third party utilities (if possible at all) so any input is greatly appreciated.

Where did you see this mentioned?
Send the output of inxi -Faz, if it shows Intel for “OpenGL renderer”, PRIME is configured. You can run applications with the Nvidia GPU via

prime-run /usr/bin/application

Here is one of the examples I was referring to

inxi -Faz
System:
  Kernel: 5.15.88-1-lts arch: x86_64 bits: 64 compiler: gcc v: 12.2.0
    parameters: initrd=\5fc0f8f4b17443e1863b494bc5c40cab\5.15.88-1-lts\initrd
    nvme_load=YES rw root=UUID=f61831a8-a60d-4891-b1f3-bc95e3c04bae
    resume=UUID=fe6d8d44-8993-4ce7-aba9-7a9e2f9ca20f rw
    root=UUID=f61831a8-a60d-4891-b1f3-bc95e3c04bae
    resume=UUID=fe6d8d44-8993-4ce7-aba9-7a9e2f9ca20f
    systemd.machine_id=5fc0f8f4b17443e1863b494bc5c40cab
  Desktop: KDE Plasma v: 5.26.5 tk: Qt v: 5.15.8 wm: kwin_x11 vt: 1 dm: SDDM
    Distro: EndeavourOS base: Arch Linux
Machine:
  Type: Laptop System: LENOVO product: 20132 v: Lenovo IdeaPad Y580
    serial: <superuser required> Chassis: type: 10 v: Lenovo IdeaPad Y580
    serial: <superuser required>
  Mobo: LENOVO model: INVALID v: 31900003WIN8 STD MLT
    serial: <superuser required> UEFI: LENOVO v: 5DCN90WW(V8.01)
    date: 10/11/2012
Battery:
  ID-1: BAT1 charge: 21.2 Wh (55.9%) condition: 37.9/62.7 Wh (60.4%)
    volts: 10.8 min: 10.8 model: LENOVO PABAS0241231 type: Li-ion
    serial: <filter> status: N/A
CPU:
  Info: model: Intel Core i5-3230M bits: 64 type: MT MCP arch: Ivy Bridge
    gen: core 3 level: v2 built: 2012-15 process: Intel 22nm family: 6
    model-id: 0x3A (58) stepping: 9 microcode: 0x21
  Topology: cpus: 1x cores: 2 tpc: 2 threads: 4 smt: enabled cache:
    L1: 128 KiB desc: d-2x32 KiB; i-2x32 KiB L2: 512 KiB desc: 2x256 KiB
    L3: 3 MiB desc: 1x3 MiB
  Speed (MHz): avg: 2965 high: 3031 min/max: 1200/3200 scaling:
    driver: intel_cpufreq governor: schedutil cores: 1: 2920 2: 3031 3: 2952
    4: 2958 bogomips: 20752
  Flags: avx ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx
  Vulnerabilities:
  Type: itlb_multihit status: KVM: VMX disabled
  Type: l1tf mitigation: PTE Inversion; VMX: conditional cache flushes, SMT
    vulnerable
  Type: mds mitigation: Clear CPU buffers; SMT vulnerable
  Type: meltdown mitigation: PTI
  Type: mmio_stale_data status: Unknown: No mitigations
  Type: retbleed status: Not affected
  Type: spec_store_bypass mitigation: Speculative Store Bypass disabled via
    prctl and seccomp
  Type: spectre_v1 mitigation: usercopy/swapgs barriers and __user pointer
    sanitization
  Type: spectre_v2 mitigation: Retpolines, IBPB: conditional, IBRS_FW,
    STIBP: conditional, RSB filling, PBRSB-eIBRS: Not affected
  Type: srbds status: Vulnerable: No microcode
  Type: tsx_async_abort status: Not affected
Graphics:
  Device-1: Intel 3rd Gen Core processor Graphics vendor: Lenovo driver: i915
    v: kernel arch: Gen-7 process: Intel 22nm built: 2012-13 ports:
    active: HDMI-A-1 off: LVDS-1 empty: DP-1,VGA-1 bus-ID: 00:02.0
    chip-ID: 8086:0166 class-ID: 0300
  Device-2: NVIDIA GK107M [GeForce GTX 660M] vendor: Lenovo driver: nvidia
    v: 470.161.03 alternate: nouveau,nvidia_drm non-free: series: 470.xx+
    status: legacy-active (EOL~2023/24) arch: Kepler code: GKxxx
    process: TSMC 28nm built: 2012-18 pcie: gen: 1 speed: 2.5 GT/s lanes: 16
    link-max: gen: 3 speed: 8 GT/s bus-ID: 01:00.0 chip-ID: 10de:0fd4
    class-ID: 0300
  Device-3: Chicony Lenovo EasyCamera type: USB driver: uvcvideo
    bus-ID: 2-1.6:3 chip-ID: 04f2:b2f1 class-ID: 0e02
  Display: x11 server: X.Org v: 21.1.6 compositor: kwin_x11 driver: X:
    loaded: modesetting,nvidia alternate: fbdev,intel,nouveau,nv,vesa
    dri: crocus gpu: i915 display-ID: :0 screens: 1
  Screen-1: 0 s-res: 1920x1080 s-dpi: 96 s-size: 506x285mm (19.92x11.22")
    s-diag: 581mm (22.86")
  Monitor-1: HDMI-A-1 mapped: HDMI-1 pos: primary model: VA24DCP
    serial: <filter> built: 2021 res: 1920x1080 dpi: 93 gamma: 1.2
    size: 527x296mm (20.75x11.65") diag: 614mm (24.2") ratio: 15:9, 16:9
    modes: max: 1920x1080 min: 720x400
  Monitor-2: LVDS-1 note: disabled model: LG Display 0x033a built: 2011
    res: 1920x1080 dpi: 101 gamma: 1.2 size: 344x194mm (13.54x7.64")
    diag: 395mm (15.5") ratio: 16:9 modes: 1366x768
  API: OpenGL v: 4.2 Mesa 22.3.3 renderer: Mesa Intel HD Graphics 4000 (IVB
    GT2) direct render: Yes
Audio:
  Device-1: Intel 7 Series/C216 Family High Definition Audio vendor: Lenovo
    driver: snd_hda_intel v: kernel bus-ID: 00:1b.0 chip-ID: 8086:1e20
    class-ID: 0403
  Sound API: ALSA v: k5.15.88-1-lts running: yes
  Sound Server-1: PulseAudio v: 16.1 running: no
  Sound Server-2: PipeWire v: 0.3.64 running: yes
Network:
  Device-1: Qualcomm Atheros AR8161 Gigabit Ethernet vendor: Lenovo
    driver: alx v: kernel pcie: gen: 1 speed: 2.5 GT/s lanes: 1 port: 2000
    bus-ID: 02:00.0 chip-ID: 1969:1091 class-ID: 0200
  IF: enp2s0 state: up speed: 1000 Mbps duplex: full mac: <filter>
  Device-2: Intel Centrino Wireless-N 2200 driver: iwlwifi v: kernel pcie:
    gen: 1 speed: 2.5 GT/s lanes: 1 bus-ID: 03:00.0 chip-ID: 8086:0891
    class-ID: 0280
  IF: wlan0 state: down mac: <filter>
Bluetooth:
  Device-1: Lite-On BCM20702A0 type: USB driver: btusb v: 0.8 bus-ID: 1-1.6:4
    chip-ID: 04ca:2003 class-ID: fe01 serial: <filter>
  Report: rfkill ID: hci0 rfk-id: 4 state: down bt-service: disabled
    rfk-block: hardware: no software: no address: see --recommends
Drives:
  Local Storage: total: 447.13 GiB used: 41.1 GiB (9.2%)
  SMART Message: Unable to run smartctl. Root privileges required.
  ID-1: /dev/sda maj-min: 8:0 vendor: SanDisk model: Ultra II 480GB
    size: 447.13 GiB block-size: physical: 512 B logical: 512 B speed: 6.0 Gb/s
    type: SSD serial: <filter> rev: 20RL scheme: GPT
Partition:
  ID-1: / raw-size: 437.35 GiB size: 429.42 GiB (98.19%)
    used: 40.76 GiB (9.5%) fs: ext4 dev: /dev/sda2 maj-min: 8:2
Swap:
  Kernel: swappiness: 60 (default) cache-pressure: 100 (default)
  ID-1: swap-1 type: partition size: 8.8 GiB used: 4.4 MiB (0.0%)
    priority: -2 dev: /dev/sda3 maj-min: 8:3
Sensors:
  System Temperatures: cpu: 59.0 C mobo: N/A
  Fan Speeds (RPM): N/A
Info:
  Processes: 197 Uptime: 23h 47m wakeups: 11 Memory: 7.63 GiB
  used: 4.33 GiB (56.7%) Init: systemd v: 252 default: graphical
  tool: systemctl Compilers: gcc: 12.2.0 Packages: pm: pacman pkgs: 1005
  libs: 281 tools: yay Shell: Bash v: 5.1.16 running-in: konsole inxi: 3.3.24

Actually since you mentioned prime-run, I realized that I didn’t install nvidia-prime package. It has ‘current’ nvidia-utils as dependency so I had a suspicion it might mess with already installed nvidia-470xx-utils

I think nvidia-prime (and the prime technology) is not compatible with your card. Especially the dependency nvidia-utils points to that direction.

Edit: seems that I may be wrong. Package nvidia-470xx-utils provides nvidia-utils.

I think @joekamprad has nvidia 470xx driver installed on a machine. But not sure if he’s using optimus manager though.

I don’t see where it shows support for 470.xx drivers for the GTX 660M? I see 390.xx version? :thinking:

$ nvidia-driver-supported-branches 0fd4
NVIDIA card id: 0fd4
Fetching driver data from nvidia.com ...

Series 470: supported (nvidia.com: 470.161.03)

When you look it up on Nvidia’s it’s difficult to find that.

Edit: Hmm the language changed when i posted the link?

Check this page: https://us.download.nvidia.com/XFree86/Linux-x86_64/525.78.01/README/supportedchips.html

Edit: looks like 390 driver supports the card too. Somehow the card lists on the Nvidia page are not fully compatible with each other. That may mean sometimes you have to try another driver if the first one does not work as expected.
I have been using the latest card list of Nvidia to see which one is the latest version that supports a card.

You have friends in Germany? :wink:

That’s weird as the link say’s us english and I’ve never seen it switch like that before?

Could be a problem with the browser’s cache or settings? Or was the article available only in German?

No it’s was a US site as far as i can tell.

Edit: As soon as i post the link it changes. Ive not see this before? The link is a US site. This must be @joekamprad switching all the Nvidia info to a direct feed. :laughing:

2023-01-17_17-18
strange…

looks like discourse is doing this…

Ya … i know the link was US but as soon as i posted it then it changed.

So now since we established that my card is indeed supported by 470 driver what should be my next steps? :slight_smile:
I mean in order to confirm that optimus configured correctly. Should I also install nvidia-prime or it’s obsolete and driver will automatically switch to dedicated gpu when game is launched? As I mentioned here, I expected that it’ll be possible to switch graphics through Nvidia X server settings GUI (whenever I need it) but looks like it’s not the case.

AFAIK your drivers support PRIME and your system is configured to use Intel for rendering desktop which is one part of a PRIME setup. prime-run is just a script, you can download (not install) nvidia-prime and put the script in it to /usr/bin.
OpenGL games will need prime-run, Vulkan games and DXVK games running via VKD3D or DXVK should pick up the Nvidia GPU automatically. The graphics switching in Nvidia control panel is for switching the entire session, this isn’t obligatory for running games via PRIME.

1 Like

As @mrvictory said, all prime-run does is run a script to set environment variables. You can install nvidia-prime just fine. Here’s what it does:

➜ bat /usr/bin/prime-run
───────┬────────────────────────────────────────────────────────────────────────────
       │ File: /usr/bin/prime-run
───────┼────────────────────────────────────────────────────────────────────────────
   1   │ #!/bin/bash
   2   │ __NV_PRIME_RENDER_OFFLOAD=1 __VK_LAYER_NV_optimus=NVIDIA_only __GLX_VENDOR_
       │ LIBRARY_NAME=nvidia "$@"

Basically if you’re running X off your integrated card prime-run will render frames using your nvidia gpu then copy the frames to a framebuffer to display on your integrated card. So modesetting is required or you’ll get tearing. Depending on your hardware there may be a smaller or larger performance hit.

I’ve found you sometimes need to specify your vulkan icd loader as well and if that’s the case you may want to modify it to include it as well VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/nvidia_icd.json

Optimus-manager basically lets you choose which gpu your DM and X server run on. You may also need the optimus-manager-qt package. I think it provides a tray icon but I’m not sure it’s been a while since I’ve used optimus. It shouldn’t need much configuration and it will automatically swap your xconfig files around so that the correct gpu is used. That is also why people have problems with it. They try to modify the wrong files or when removing it they don’t do it correctly.

Here are some links to read up on it and to help you check your install and config if you haven’t checked them already:

2 Likes

@mrvictory, thank you! Really appreciate your clarification.
Yeah, I know that prime-run is a script but since it’s in the repository and I can get it thorough pacman, I call such process an installation :slight_smile:

That’s good to know but If I’ll have no idea which technology particular game might use, is it safe/ok to add

prime-run %command%

as launch option in Steam for every game?


@KDen, thank you! I’ve read about Oprimus manager and few other solutions but if I’m not mistaken every such third-party tool requires either to restart machine during each switch or at least log out an log in again. That’s why I was looking at PRIME in the first place since in my understanding it offers the most seamless switching on hybrid systems.

Yes it is, it won’t do anything for Vulkan games in your setup.

1 Like