Wine uses integrated Intel GPU instead of dedicated NVidia

Questions about Wine on Linux
Locked
demurgos
Newbie
Newbie
Posts: 4
Joined: Fri Apr 13, 2018 6:35 am

Wine uses integrated Intel GPU instead of dedicated NVidia

Post by demurgos »

Hi,
I want to try Skyrim Special Edition but trouble to configure the graphics card.
I have a laptop with an integrated Intel GPU and a dedicated NVidia GeForce GTX 1050 Mobile card.
Wine applications use the integrated GPU and I cannot find where to set them to use the dedicated GPU.

Here are my system details:

Code: Select all

Distribution: Arch Linux
OS Type: 64-bit
Kernel version: 4.15.15-1-ARCH
Graphics Card: Nvidia Geforce GTX 1050 (Mobile)
Graphics Driver: nvidia 390.48
Processors: 8 × Intel® Core™ i7-7700HQ CPU @ 2.80GHz
Memory: 15.5 GiB of RAM
Wine version: 3.5
WINEARCH: win64
Here is the output of `lspci`:

Code: Select all

$ lspci
00:00.0 Host bridge: Intel Corporation Xeon E3-1200 v6/7th Gen Core Processor Host Bridge/DRAM Registers (rev 05)
00:01.0 PCI bridge: Intel Corporation Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor PCIe Controller (x16) (rev 05)
00:02.0 VGA compatible controller: Intel Corporation Device 591b (rev 04)
00:04.0 Signal processing controller: Intel Corporation Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor Thermal Subsystem (rev 05)
00:14.0 USB controller: Intel Corporation Sunrise Point-H USB 3.0 xHCI Controller (rev 31)
00:14.2 Signal processing controller: Intel Corporation Sunrise Point-H Thermal subsystem (rev 31)
00:15.0 Signal processing controller: Intel Corporation Sunrise Point-H Serial IO I2C Controller #0 (rev 31)
00:15.1 Signal processing controller: Intel Corporation Sunrise Point-H Serial IO I2C Controller #1 (rev 31)
00:16.0 Communication controller: Intel Corporation Sunrise Point-H CSME HECI #1 (rev 31)
00:17.0 SATA controller: Intel Corporation Sunrise Point-H SATA Controller [AHCI mode] (rev 31)
00:1c.0 PCI bridge: Intel Corporation Sunrise Point-H PCI Express Root Port #1 (rev f1)
00:1c.1 PCI bridge: Intel Corporation Sunrise Point-H PCI Express Root Port #2 (rev f1)
00:1d.0 PCI bridge: Intel Corporation Sunrise Point-H PCI Express Root Port #9 (rev f1)
00:1d.4 PCI bridge: Intel Corporation Sunrise Point-H PCI Express Root Port #13 (rev f1)
00:1d.6 PCI bridge: Intel Corporation Sunrise Point-H PCI Express Root Port #15 (rev f1)
00:1f.0 ISA bridge: Intel Corporation Sunrise Point-H LPC Controller (rev 31)
00:1f.2 Memory controller: Intel Corporation Sunrise Point-H PMC (rev 31)
00:1f.3 Audio device: Intel Corporation CM238 HD Audio Controller (rev 31)
00:1f.4 SMBus: Intel Corporation Sunrise Point-H SMBus (rev 31)
01:00.0 3D controller: NVIDIA Corporation GP107M [GeForce GTX 1050 Mobile] (rev a1)
02:00.0 Network controller: Qualcomm Atheros QCA6174 802.11ac Wireless Network Adapter (rev 32)
03:00.0 Unassigned class [ff00]: Realtek Semiconductor Co., Ltd. RTS525A PCI Express Card Reader (rev 01)
04:00.0 Non-Volatile memory controller: Toshiba America Info Systems XG4 NVMe SSD Controller (rev 01)
I think that the two relevant lines are:

Code: Select all

00:02.0 VGA compatible controller: Intel Corporation Device 591b (rev 04)
01:00.0 3D controller: NVIDIA Corporation GP107M [GeForce GTX 1050 Mobile] (rev a1)
I installed Steam using winetricks steam in my WINEPREFIX. When I open Steam and use Help | System Information, I get:

Code: Select all

Computer Information:
    Manufacturer:  The Wine Project
    Model:  Wine
    No Touch Input Detected

Processor Information:
    CPU Vendor:  GenuineIntel
    CPU Brand:  Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
    CPU Family:  0x6
    CPU Model:  0x9e
    CPU Stepping:  0x9
    CPU Type:  0x0
    Speed:  3800 Mhz
    8 logical processors
    8 physical processors
    HyperThreading:  Unsupported
    FCMOV:  Supported
    SSE2:  Supported
    SSE3:  Supported
    SSSE3:  Supported
    SSE4a:  Unsupported
    SSE41:  Supported
    SSE42:  Supported
    AES:  Supported
    AVX:  Supported
    CMPXCHG16B:  Supported
    LAHF/SAHF:  Supported
    PrefetchW:  Unsupported

Operating System Version:
    Windows 7 (64 bit)
    Wine Version: wine-3.5
    NTFS:  Supported
    Crypto Provider Codes:  Supported 311 0x0 0x0 0x0

Video Card:
    Driver:  Intel(R) HD Graphics 4000
    DirectX Driver Name:  igdumd32.dll
    Driver Version:  1.0
    DirectX Driver Version:  8.15.10.1666
    Driver Date: 1 1 2017
    OpenGL Version: 3.0
    Desktop Color Depth: 32 bits per pixel
    DirectX Card: Intel(R) G45/G43
    VendorID:  0x8086
    DeviceID:  0x2e22
    Revision Not Detected
    Number of Monitors:  1
    Number of Logical Video Cards:  1
    No SLI or Crossfire Detected
    Primary Display Resolution:  1920 x 1080
    Desktop Resolution: 1920 x 1080
    Primary Display Size: 20.00" x 11.26" (22.91" diag)
                                            50.8cm x 28.6cm (58.2cm diag)
    Primary Bus Type Not Detected
    Primary VRAM: -1024 MB
    Supported MSAA Modes:  2x 4x 8x 16x 

Sound card:
    Audio device: Out: default

Memory:
    RAM:  15895 Mb

Miscellaneous:
    UI Language:  English
    Media Type:  Undetermined
    Total Hard Disk Space Available:  950316 Mb
    Largest Free Hard Disk Block:  32317 Mb
    OS Install Date: May 08 2010
    Game Controller: None detected
    VR Headset: None detected

As you can see, it lists Driver: Intel(R) HD Graphics 4000 instead of my NVidia card. When I open Skyrim for the first time, I get the message "Your video hardware was not identified. Video settings have been set for Low Quality.". I tried to install Steam in a WINEARCH=win32 prefix but got the same result.

I found other threads mentioning similar issues but there was no real explanation of the issue or how to solve it. They often referred to something called "device id". I checked this device ID database. My card is listed with the id 0x1c62 ("0x1c62 GP106 [GeForce GTX 1050 Mobile]").
The Useful registry keys page mentions the following key for the device id: HKEY_CURRENT_USER/Software/Wine/Direct3D/VideoPciDeviceID. I opened `regedit` but there was no `Direct3D` directory in the `Wine` entry.
I am also afraid that if I don't set the ID properly (but force it) I may get more issues afterwards. I also some people proposing to disable Intel's GPU in the BIOS but I'd prefer to avoid it (I think it's safer to have it enable in case I have an issue with my NVidia driver).

I am not very familiar with GPUs or Wine but can provide your more info if needed. Thanks in advance for any help. :)
demurgos
Newbie
Newbie
Posts: 4
Joined: Fri Apr 13, 2018 6:35 am

Re: Wine uses integrated Intel GPU instead of dedicated NVid

Post by demurgos »

I think I made some progress: I understand that my computer uses Nvidia Optimus. I cannot disable the intel part in my Bios. I tried running "wine steam" through primusrun but still had the same results. I'll keep you updated if I get some progress.
demurgos
Newbie
Newbie
Posts: 4
Joined: Fri Apr 13, 2018 6:35 am

Re: Wine uses integrated Intel GPU instead of dedicated NVid

Post by demurgos »

I fixed my solution: this was not a Wine issue but a configuration issue on my computer.

The most reliable way to use my discret Nvidia GPU with Wine was to use it for my display server (Xorg) and use the integrated Intel GPU only as a pass-through (only this GPU has access to my monitor).

I spent a lot of time and tried many configurations before finding the solution. There are a few things that I still do not understand entirely but here is what worked:

- Uninstall `bumblebee` and `primus` (I think they may interfer, not sure).

- Create /etc/modprobe.d/prime.conf (I think this is what I was missing, but I don't know what it does):

Code: Select all

options nvidia_drm modeset=1
- Create /etc/X11/xorg.conf

Code: Select all

Section "Module"
    Load "modesetting"
EndSection

Section "Device"
    Identifier "nvidia"
    Driver "nvidia"
    BusID "PCI:1:0:0"
    Option "AllowEmptyInitialConfiguration"
EndSection
- Create /usr/share/sddm/scripts/Xsetup (I use SDDM, check the config file for your Display Manager)

Code: Select all

!/bin/sh
# Xsetup - run as root before the login dialog appears

xrandr --setprovideroutputsource modesetting NVIDIA-0
xrandr --auto
After this, Steam (both with and without wine) should display the Nvidia GPU as the graphics card. Skyrim still does not detect it and has issues (cutscenes, sound) but this is unrelated.
User avatar
Bob Wya
Level 12
Level 12
Posts: 3068
Joined: Sat Oct 16, 2010 7:40 pm

Re: Wine uses integrated Intel GPU instead of dedicated NVid

Post by Bob Wya »

@demurgos

This issue is already discussed in more detail in the Arch Wiki:
Arch Wiki: NVIDIA Optimus

Problems with hybrid graphics are generally not Wine issues...
But simply indicate a misconfigured system setup.
Create /etc/modprobe.d/prime.conf (I think this is what I was missing, but I don't know what it does):
Well you probably want to find out - preferably before you hose your system! :roll:

Reading the Nvidia 390.48 driver documentation would be a good start!

It's generally recommended to enable modesetting for the nvidia proprietary driver.
This can be done either as Linux kernel boot option (my choice) or a modprobe override (your example).
See: Arch Wiki: Kernel mode setting.

tl;dr the mode setting technology allows multiple graphics drivers to co-exist and has many other performance and functionality benefits...
E.g. in my experience the proprietary Nvidia drivers - don't support dropping to TTY* text consoles, on UEFI-based systems, without enabling modesetting support.

Bob
demurgos
Newbie
Newbie
Posts: 4
Joined: Fri Apr 13, 2018 6:35 am

Re: Wine uses integrated Intel GPU instead of dedicated NVid

Post by demurgos »

Thanks for the explanation. I'll probably configure it as kernel boot option next time I'll reinstall my system. I've ready many discussions on Optimus and related issues, but by the end I was getting frustrated and did not expect to get it to work so I just posted my solution before leaving my computer.

It's still good to better understand. Now that I know what I have on my system and how to make it work, I'll dive a bit deeper to better understand it. It's just that most things tend to work out of the box so I was a bit surprised by my issue.

(By the way, I blocked my system once yesterday while testing, but I just edited some text files manually so it was easy to boot with a USB drive and revert the changes: at least I have backups and don't really fear to mess with the system...)

Thanks :)
wildtux
Level 3
Level 3
Posts: 56
Joined: Sat Aug 13, 2016 10:05 am

Re: Wine uses integrated Intel GPU instead of dedicated NVid

Post by wildtux »

Use nvidia-prime-select (https://github.com/wildtruc/nvidia-prime-select) or the tool send with your distro (ubuntu have, arch not sure).
Locked