vetzki / nvidia-prime-switch-sddm

MIT License
10 stars 2 forks source link

Latest Manjaro update, both intel and nvidia drivers loaded, glxinfo shows intel #2

Closed leledumbo closed 6 years ago

leledumbo commented 6 years ago

It's been a while since I use nvidia for gaming, like 2 or 3 Manjaro updates. Today I decided to use it again because I want to use the GPU for encoding some videos faster. So I git pull-ed this repo and I see some updates, rebuild and reinstall the package, sudo prime-switch -d nvidia then relogin. Executing glxinfo | grep -i vendor shows intel, while lsmod | egrep 'intel|nvidia' shows both are loaded. nvidia-settings says ERROR: Unable to load info from any available system. So it looks like while nvidia driver is loaded, I'm still using intel for display. For curiousity, I proceed executing ffmpeg with h264_nvenc codec, and it works. nvidia-smi shows the running process. So, the driver is actually working (and indeed encoding finishes faster than with CPU). However, games will not be using that driver as it follows the display one. How do I use nvidia for everything?

I use your nvidia.conf this time because mine (produced by nvidia-xconfig) is producing this:

[  1496.393] (EE) NVIDIA(0): Failed to initialize the GLX module; please check in your X
[  1496.393] (EE) NVIDIA(0):     log file that the GLX module has been loaded in your X
[  1496.393] (EE) NVIDIA(0):     server, and that the module is the NVIDIA GLX module.  If
[  1496.393] (EE) NVIDIA(0):     you continue to encounter problems, Please try
[  1496.393] (EE) NVIDIA(0):     reinstalling the NVIDIA driver.
vetzki commented 6 years ago

first, did you try to reboot after sudo prime-switch -d nvidia ? second, dont use nvidia-xconfig on optimus laptops, wont create a working config (if you want to test other configs, better dump json file to e.g. your home folder and add new driver block)

also, do you use nvidia390xx or nvidia module (396.something)? can you show output of following commands:

lspci -k

DIRS="/etc/modules-load.d/ /etc/modprobe.d /etc/X11/mhwd.d"; for i in $DIRS; do for j in $i/*; do printf "%s ----->\n\n%s\n\n" "$j" "$(cat $j)" ; done; done

printf "/usr/.../nvidia.conf ----->\n\n%s\n\n" "$(cat /usr/share/X11/xorg.conf.d/10-nvidia-drm-outputclass.conf)"

ls -l /etc/X11/xorg.conf.d

cat /usr/share/sddm/scripts/Xsetup

xrandr --listproviders

egrep -i 'nvidia|intel|i915|modesetting|primarygpu' /path/to/xorg.log file  (should be /var/log/Xorg.0.log, if unsure check timestamp)
leledumbo commented 6 years ago

first, did you try to reboot after sudo prime-switch -d nvidia ?

of course, it's a common SOP.

second, dont use nvidia-xconfig on optimus laptops, wont create a working config

I don't this time, previously I use it because the supplied config, which only sets device section is somehow insufficient.

do you use nvidia390xx or nvidia module (396.something)?

nvidia:

local/linux414-nvidia 1:396.54-6 (linux414-extramodules)
    NVIDIA drivers for linux.
local/linux418-nvidia 1:396.54-5 (linux418-extramodules)
    NVIDIA drivers for linux.

can you show output of following commands:

Sure, but at this time I've gone back to intel only since the combo seems unstable:

lspci -k

trimmed to interesting bits:

01:00.0 3D controller: NVIDIA Corporation GP107M [GeForce GTX 1050 Mobile] (rev a1)
    Subsystem: ASUSTeK Computer Inc. GP107M [GeForce GTX 1050 Mobile]
    Kernel modules: nouveau, nvidia_drm, nvidia

DIRS="/etc/modules-load.d/ /etc/modprobe.d /etc/X11/mhwd.d"; for i in $DIRS; do for j in $i/*; do printf "%s ----->\n\n%s\n\n" "$j" "$(cat $j)" ; done; done

/etc/modules-load.d//linux414-virtualbox-host-modules.conf ----->

vboxdrv
vboxnetadp
vboxnetflt
vboxpci

/etc/modules-load.d//linux418-virtualbox-host-modules.conf ----->

vboxdrv
vboxnetadp
vboxnetflt
vboxpci

/etc/modules-load.d//mhwd-gpu.conf ----->

nvidia
nvidia-modeset
nvidia-drm
nvidia-uvm

/etc/modules-load.d//modules.conf ----->

# List of modules to load at boot

/etc/modules-load.d//undervolt-msr.conf ----->

# Load the MSR module on boot to allow writing to the voltage registers
msr

/etc/modprobe.d/audio_powersave.conf ----->

options snd_hda_intel power_save=1

/etc/modprobe.d/blacklist-pcspkr.conf ----->

# this is how you mute annoying beeps in console and shutdown
blacklist pcspkr

/etc/modprobe.d/droidcam.conf ----->

options v4l2loopback_dc width=320 height=240

/etc/modprobe.d/i2c_hid_blacklist.conf ----->

blacklist i2c_hid

/etc/modprobe.d/iwlwifi.conf ----->

options iwlwifi power_save=1 d0i3_disable=0 uapsd_disable=0
options iwldvm force_cam=0

/etc/modprobe.d/mhwd-gpu.conf ----->

blacklist nouveau
blacklist ttm
options nvidia-drm modeset=1

/etc/modprobe.d/nvidia.conf ----->

blacklist nouveau
blacklist nvidiafb
blacklist rivafb

/etc/modprobe.d/nvidia-drm.conf ----->

options nvidia_drm modeset=1

/etc/modprobe.d/r8169_blacklist.conf ----->

blacklist r8169
blacklist r8168

/etc/X11/mhwd.d/intel.conf ----->

Section "OutputClass" # needed if nvidia module loaded, else glx is broken
    Identifier "intel"
    ModulePath "/usr/lib/xorg/modules/extensions"
EndSection

Section "Device"
    Identifier "intel"
    Driver "intel"
    BusID "PCI:0:2:0"
    Option "AccelMethod" "sna"
    Option "DRI" "3"
EndSection

Section "DRI"
    Group "video"
    Mode 0666
EndSection

Section "Extensions"
    Option "Composite" "Enable"
    Option "RENDER" "Enable"
EndSection

/etc/X11/mhwd.d/intel-modesetting.conf ----->

Section "Device"
    Identifier "intel"
    Driver "modesetting"
    BusID "PCI:0:2:0"
EndSection

/etc/X11/mhwd.d/nvidia.conf ----->

# nvidia-xconfig: X configuration file generated by nvidia-xconfig
# nvidia-xconfig:  version 396.24  (buildmeister@swio-display-x64-rhel04-13)  Thu Apr 26 01:13:52 PDT 2018

Section "Module"
    Load "modesetting"
EndSection

#Section "ServerLayout"
#    Identifier     "Layout0"
#    Screen      0  "Screen0"
#    InputDevice    "Keyboard0" "CoreKeyboard"
#    InputDevice    "Mouse0" "CorePointer"
#EndSection

Section "Files"
EndSection

Section "InputDevice"
    # generated from default
    Identifier     "Mouse0"
    Driver         "mouse"
    Option         "Protocol" "auto"
    Option         "Device" "/dev/psaux"
    Option         "Emulate3Buttons" "no"
    Option         "ZAxisMapping" "4 5"
EndSection

Section "InputDevice"
    # generated from default
    Identifier     "Keyboard0"
    Driver         "kbd"
EndSection

#Section "Monitor"
#    Identifier     "Monitor0"
#    VendorName     "Unknown"
#    ModelName      "Unknown"
#    #HorizSync       30.0 - 83.0
#    #VertRefresh     56.0 - 75.0
#    Option         "DPMS"
#EndSection

Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    BusID          "PCI:1:0:0"
    Option         "AllowEmptyInitialConfiguration"
    Option         "NoLogo" "1"
EndSection

#Section "Screen"
#    Identifier     "Screen0"
#   Device         "Device0"
#    Monitor        "Monitor0"
#    DefaultDepth    24
#    SubSection     "Display"
#    Depth       24
#    EndSubSection
#EndSection

Section "Extensions"
    Option         "Composite" "Enable"
EndSection

Section "InputClass"
    Identifier          "Keyboard Defaults"
    MatchIsKeyboard        "yes"
    Option              "XkbOptions" "terminate:ctrl_alt_bksp"
EndSection

/etc/X11/mhwd.d/nvidia.conf.ori ----->

Section "Module"
    Load "modesetting"
EndSection

Section "Device"
    Identifier "nvidia"
    Driver "nvidia"
    BusID "PCI:1:0:0"
#    Option "Coolbits" "Value" # show powermizer panel in nvidia settings
#    Option "IgnoreDisplayDevices" "DisplayDevice" # ignore ghost output, does not work with nvidia-drm.modest=1 (DisplayDevice value e.g. "CRT")
EndSection

/etc/X11/mhwd.d/optimus.conf ----->

# nvidia-xconfig: X configuration file generated by nvidia-xconfig
# nvidia-xconfig:  version 396.24  (buildmeister@swio-display-x64-rhel04-13)  Thu Apr 26 01:13:52 PDT 2018

Section "Module"
    Load "modesetting"
EndSection

Section "ServerLayout"
    Identifier     "Layout0"
    Screen      0  "Screen0"
    InputDevice    "Keyboard0" "CoreKeyboard"
    InputDevice    "Mouse0" "CorePointer"
EndSection

Section "Files"
EndSection

Section "InputDevice"
    # generated from default
    Identifier     "Mouse0"
    Driver         "mouse"
    Option         "Protocol" "auto"
    Option         "Device" "/dev/psaux"
    Option         "Emulate3Buttons" "no"
    Option         "ZAxisMapping" "4 5"
EndSection

Section "InputDevice"
    # generated from default
    Identifier     "Keyboard0"
    Driver         "kbd"
EndSection

Section "Monitor"
    Identifier     "Monitor0"
    VendorName     "Unknown"
    ModelName      "Unknown"
    HorizSync       30.0 - 83.0
    VertRefresh     56.0 - 75.0
    Option         "DPMS"
EndSection

Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    BusID          "PCI:1:0:0"
    Option         "AllowEmptyInitialConfiguration"
    Option         "NoLogo" "1"
EndSection

Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
    SubSection     "Display"
    Depth       24
    EndSubSection
EndSection

Section "Extensions"
    Option         "Composite" "Enable"
EndSection

Section "InputClass"
    Identifier          "Keyboard Defaults"
    MatchIsKeyboard        "yes"
    Option              "XkbOptions" "terminate:ctrl_alt_bksp"
EndSection

printf "/usr/.../nvidia.conf ----->\n\n%s\n\n" "$(cat /usr/share/X11/xorg.conf.d/10-nvidia-drm-outputclass.conf)"

/usr/.../nvidia.conf ----->

Section "OutputClass"
    Identifier "intel"
    MatchDriver "i915"
    Driver "modesetting"
EndSection

Section "OutputClass"
    Identifier "nvidia"
    MatchDriver "nvidia-drm"
    Driver "nvidia"
    Option "AllowEmptyInitialConfiguration"
    Option "PrimaryGPU" "yes"
    ModulePath "/usr/lib/nvidia/xorg"
    ModulePath "/usr/lib/xorg/modules"
EndSection

ls -l /etc/X11/xorg.conf.d

total 12
-rw-r--r-- 1 root root 420 Jul 14 20:23 00-keyboard.conf
-rw-r--r-- 1 root root 348 Apr 17  2016 50-wireless_mouse.conf
lrwxrwxrwx 1 root root  26 Sep 24 07:51 90-mhwd.conf -> /etc/X11/mhwd.d/intel.conf

cat /usr/share/sddm/scripts/Xsetup

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

xrandr --setprovideroutputsource modesetting NVIDIA-0;
xrandr --auto;

xrandr --listproviders

Providers: number : 1
Provider 0: id: 0x48 cap: 0xb, Source Output, Sink Output, Sink Offload crtcs: 4 outputs: 5 associated providers: 0 name:Intel

egrep -i 'nvidia|intel|i915|modesetting|primarygpu' /path/to/xorg.log file

[     6.489] (**) |   |-->GPUDevice "intel"
[     6.509] (**) OutputClass "intel" ModulePath extended to "/usr/lib/xorg/modules/extensions,/usr/lib/xorg/modules"
[     6.516] (II) LoadModule: "intel"
[     6.517] (II) Loading /usr/lib/xorg/modules/drivers/intel_drv.so
[     6.521] (II) Module intel: vendor="X.Org Foundation"
[     6.521] (II) intel: Driver for Intel(R) Integrated Graphics Chipsets:
    915G, E7221 (i915), 915GM, 945G, 945GM, 945GME, Pineview GM,
[     6.521] (II) intel: Driver for Intel(R) HD Graphics
[     6.521] (II) intel: Driver for Intel(R) Iris(TM) Graphics
[     6.521] (II) intel: Driver for Intel(R) Iris(TM) Pro Graphics
[     6.521] (II) intel(0): Using Kernel Mode Setting driver: i915, version 1.6.0 20180514
[     6.521] (II) intel(0): SNA compiled from 2.99.917-847-g25c9a2fc
[     6.522] (--) intel(0): gen9 engineering sample
[     6.522] (--) intel(0): CPU: x86-64, sse2, sse3, ssse3, sse4.1, sse4.2, avx, avx2; using a maximum of 4 threads
[     6.522] (II) intel(0): Creating default Display subsection in Screen section
[     6.522] (==) intel(0): Depth 24, (--) framebuffer bpp 32
[     6.522] (==) intel(0): RGB weight 888
[     6.522] (==) intel(0): Default visual is TrueColor
[     6.522] (**) intel(0): Option "Backlight" "intel_backlight"
[     6.522] (II) intel(0): Output eDP1 has no monitor section
[     6.533] (**) intel(0): Found backlight control interface intel_backlight (type 'raw') for output eDP1
[     6.533] (II) intel(0): Enabled output eDP1
[     6.533] (II) intel(0): Output HDMI1 has no monitor section
[     6.533] (II) intel(0): Enabled output HDMI1
[     6.533] (II) intel(0): Output DP1 has no monitor section
[     6.533] (II) intel(0): Enabled output DP1
[     6.533] (II) intel(0): Output HDMI2 has no monitor section
[     6.533] (II) intel(0): Enabled output HDMI2
[     6.533] (--) intel(0): Using a maximum size of 256x256 for hardware cursors
[     6.533] (II) intel(0): Output VIRTUAL1 has no monitor section
[     6.533] (II) intel(0): Enabled output VIRTUAL1
[     6.533] (--) intel(0): Output eDP1 using initial mode 1920x1080 on pipe 0
[     6.534] (==) intel(0): TearFree enabled
[     6.534] (==) intel(0): Using gamma correction (1.0, 1.0, 1.0)
[     6.534] (==) intel(0): DPI set to (96, 96)
[     6.535] (II) intel(0): SNA initialized with Kabylake (gen9) backend
[     6.535] (==) intel(0): Backing store enabled
[     6.535] (==) intel(0): Silken mouse disabled
[     6.535] (II) intel(0): HW Cursor enabled
[     6.535] (==) intel(0): DPMS enabled
[     6.535] (==) intel(0): Display hotplug detection enabled
[     6.535] (II) intel(0): [DRI2] Setup complete
[     6.535] (II) intel(0): [DRI2]   DRI driver: i965
[     6.535] (II) intel(0): [DRI2]   VDPAU driver: va_gl
[     6.535] (II) intel(0): direct rendering: DRI2 DRI3 enabled
[     6.535] (II) intel(0): hardware support for Present enabled
[     6.564] (II) intel(0): switch to mode 1920x1080@60.0 on eDP1 using pipe 0, position (0, 0), rotation normal, reflection none
[     6.574] (II) intel(0): Setting screen physical size to 508 x 285
[     6.934] (II) config/udev: Adding input device HDA Intel PCH HDMI/DP,pcm=3 (/dev/input/event10)
[     6.935] (II) config/udev: Adding input device HDA Intel PCH HDMI/DP,pcm=7 (/dev/input/event11)
[     6.935] (II) config/udev: Adding input device HDA Intel PCH HDMI/DP,pcm=8 (/dev/input/event12)
[     6.935] (II) config/udev: Adding input device HDA Intel PCH HDMI/DP,pcm=9 (/dev/input/event13)
[     6.935] (II) config/udev: Adding input device HDA Intel PCH HDMI/DP,pcm=10 (/dev/input/event14)
[     6.936] (II) config/udev: Adding input device HDA Intel PCH Headphone (/dev/input/event9)
[     8.535] (II) intel(0): EDID vendor "LGD", prod id 1135
[     8.535] (II) intel(0): Printing DDC gathered Modelines:
[     8.535] (II) intel(0): Modeline "1920x1080"x0.0  138.70  1920 1968 2000 2080  1080 1083 1088 1111 +hsync -vsync (66.7 kHz eP)

Tell me if you need one after prime-switch -d nvidia.

vetzki commented 6 years ago

thats quite a mess:

now as you have removed some of the mess, either uninstall prime-switch pkg git clone again (you can now use --branch current for current nvidia driver or nvidia390xx for legacy driver. You card support current driver ) build package and reinstall again

or

try again with sudo prime-switch -d nvidia and check afterwards if symlink is correct (/etc/X11/xorg.conf.d points to /etc/X11/mhwd.d/nvidia.conf)

if symlink is still pointing to intel.conf please show me used json file and output of command.

if you encounter further problems please reply again

best regards,

leledumbo commented 6 years ago

I'll try reinstalling and switching to nvidia again tonight.

vetzki commented 6 years ago

Yes, files in /etc/X11/mhwd.d aren't used unless symlinked. Of course you can keep them if you want to.

according to your ouput, the nvidia.conf file from this package is nvidia.conf.ori not nvidia.conf (and optimus.conf looks like nvidia.conf)

https://github.com/vetzki/nvidia-prime-switch-sddm/blob/current/nvidia.conf

use either nvidia.conf of this package or adjust filename in json file (dont change provided, dump and use copy instead. But best would be if you use nvidia.conf file of this package)

the config you currently use as nvidia.conf wont work with optimus laptops

edit: and remove etc/modprobe.d/nvidia-drm.conf and avoid multiply module files with same/similar content

in general it looks like you mixed https://forum.manjaro.org/t/howto-set-up-prime-with-nvidia-proprietary-driver/40225 and this package together, which is not advisable.

best regards,

leledumbo commented 6 years ago

I've done clean reinstallation of nvidia-prime-switch-sddm (remove + install) and do prime-switch -d nvidia, here's the new result of above commands that may have changed:

DIRS="/etc/modules-load.d/ /etc/modprobe.d /etc/X11/mhwd.d"; for i in $DIRS; do for j in $i/*; do printf "%s ----->\n\n%s\n\n" "$j" "$(cat $j)" ; done; done

/etc/modules-load.d//linux414-virtualbox-host-modules.conf ----->

vboxdrv
vboxnetadp
vboxnetflt
vboxpci

/etc/modules-load.d//linux418-virtualbox-host-modules.conf ----->

vboxdrv
vboxnetadp
vboxnetflt
vboxpci

/etc/modules-load.d//mhwd-gpu.conf ----->

nvidia
nvidia-modeset
nvidia-drm
nvidia-uvm

/etc/modules-load.d//modules.conf ----->

# List of modules to load at boot

/etc/modules-load.d//undervolt-msr.conf ----->

# Load the MSR module on boot to allow writing to the voltage registers
msr

/etc/modprobe.d/audio_powersave.conf ----->

options snd_hda_intel power_save=1

/etc/modprobe.d/blacklist-pcspkr.conf ----->

# this is how you mute annoying beeps in console and shutdown
blacklist pcspkr

/etc/modprobe.d/droidcam.conf ----->

options v4l2loopback_dc width=320 height=240

/etc/modprobe.d/i2c_hid_blacklist.conf ----->

blacklist i2c_hid

/etc/modprobe.d/iwlwifi.conf ----->

options iwlwifi power_save=1 d0i3_disable=0 uapsd_disable=0
options iwldvm force_cam=0

/etc/modprobe.d/mhwd-gpu.conf ----->

blacklist nouveau
blacklist ttm
options nvidia-drm modeset=1

/etc/modprobe.d/nvidia.conf ----->

blacklist nouveau
blacklist nvidiafb
blacklist rivafb

/etc/modprobe.d/nvidia-drm.conf ----->

options nvidia_drm modeset=1

/etc/modprobe.d/r8169_blacklist.conf ----->

blacklist r8169
blacklist r8168

/etc/X11/mhwd.d/intel.conf ----->

Section "OutputClass" # needed if nvidia module loaded, else glx is broken
    Identifier "intel"
    ModulePath "/usr/lib/xorg/modules/extensions"
EndSection

Section "Device"
    Identifier "intel"
    Driver "intel"
    BusID "PCI:0:2:0"
    Option "AccelMethod" "sna"
EndSection

Section "DRI"
    Group "video"
    Mode 0666
EndSection

Section "Extensions"
    Option "Composite" "Enable"
    Option "RENDER" "Enable"
EndSection

/etc/X11/mhwd.d/intel-modesetting.conf ----->

Section "Device"
    Identifier "intel"
    Driver "modesetting"
    BusID "PCI:0:2:0"
EndSection

/etc/X11/mhwd.d/nvidia.conf ----->

Section "Module"
    Load "modesetting"
EndSection

Section "Device"
    Identifier "nvidia"
    Driver "nvidia"
    BusID "PCI:1:0:0"
#    Option "Coolbits" "Value" # show powermizer panel in nvidia settings
#    Option "IgnoreDisplayDevices" "DisplayDevice" # ignore ghost output, does not work with nvidia-drm.modest=1 (DisplayDevice value e.g. "CRT")
EndSection

ls -l /etc/X11/xorg.conf.d

total 12
-rw-r--r-- 1 root root 420 Jul 14 20:23 00-keyboard.conf
-rw-r--r-- 1 root root 348 Apr 17  2016 50-wireless_mouse.conf
lrwxrwxrwx 1 root root  27 Sep 28 10:52 90-mhwd.conf -> /etc/X11/mhwd.d/nvidia.conf

cat /usr/share/sddm/scripts/Xsetup

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

check() {
python -c '
import os

SYSFS_PATH="/sys/bus/pci/devices"
devs = os.listdir(SYSFS_PATH)
gpus = [ "/sys/bus/pci/devices/"+i+"/" for i in devs if "0x03000" in open(SYSFS_PATH+"/"+i+"/class").read() ]

_g = (True for i in gpus if "nouveau" in os.path.realpath(i+"driver"))

for v in _g:
  if True:
    print(v)
    exit(0)
exit(1)
'
}

if [[  == True ]];
    then
  # nouveau (see also https://nouveau.freedesktop.org/wiki/Optimus/)
  xrandr --setprovideroffloadsink nouveau Intel;
  # if second gpu output not accessible
  # xrandr --setprovideroutputsource nouveau Intel
    else
  # nvidia
  xrandr --setprovideroutputsource modesetting NVIDIA-0; # not necessarily needed
fi

xrandr --auto;

unset check;

xrandr --listproviders

Providers: number : 1
Provider 0: id: 0x48 cap: 0xb, Source Output, Sink Output, Sink Offload crtcs: 4 outputs: 5 associated providers: 0 name:Intel

egrep -i 'nvidia|intel|i915|modesetting|primarygpu' /var/log/Xorg.0.log

[ 62312.271] (**) |   |-->GPUDevice "nvidia"
[ 62312.530] (II) LoadModule: "modesetting"
[ 62312.530] (II) Loading /usr/lib/xorg/modules/drivers/modesetting_drv.so
[ 62312.531] (II) Module modesetting: vendor="X.Org Foundation"
[ 62312.533] (II) LoadModule: "intel"
[ 62312.533] (II) Loading /usr/lib/xorg/modules/drivers/intel_drv.so
[ 62312.533] (II) Module intel: vendor="X.Org Foundation"
[ 62312.533] (II) LoadModule: "nvidia"
[ 62312.533] (II) Loading /usr/lib/xorg/modules/drivers/nvidia_drv.so
[ 62312.540] (II) Module nvidia: vendor="NVIDIA Corporation"
[ 62312.540] (II) modesetting: Driver for Modesetting Kernel Drivers: kms
[ 62312.540] (II) intel: Driver for Intel(R) Integrated Graphics Chipsets:
  915G, E7221 (i915), 915GM, 945G, 945GM, 945GME, Pineview GM,
[ 62312.540] (II) intel: Driver for Intel(R) HD Graphics
[ 62312.540] (II) intel: Driver for Intel(R) Iris(TM) Graphics
[ 62312.540] (II) intel: Driver for Intel(R) Iris(TM) Pro Graphics
[ 62312.540] (II) NVIDIA dlloader X Driver  396.54  Tue Aug 14 22:15:03 PDT 2018
[ 62312.541] (II) NVIDIA Unified Driver for all Supported NVIDIA GPUs
[ 62312.541] (WW) Falling back to old probe method for modesetting
[ 62312.541] (II) intel(0): Using Kernel Mode Setting driver: i915, version 1.6.0 20180514
[ 62312.541] (II) intel(0): SNA compiled from 2.99.917-847-g25c9a2fc
[ 62312.950] (II) UnloadModule: "nvidia"
[ 62312.951] (--) intel(0): gen9 engineering sample
[ 62312.951] (--) intel(0): CPU: x86-64, sse2, sse3, ssse3, sse4.1, sse4.2, avx, avx2; using a maximum of 4 threads
[ 62312.951] (II) intel(0): Creating default Display subsection in Screen section
[ 62312.951] (==) intel(0): Depth 24, (--) framebuffer bpp 32
[ 62312.951] (==) intel(0): RGB weight 888
[ 62312.951] (==) intel(0): Default visual is TrueColor
[ 62312.951] (**) intel(0): Option "Backlight" "intel_backlight"
[ 62312.951] (II) intel(0): Output eDP1 has no monitor section
[ 62313.357] (**) intel(0): Found backlight control interface intel_backlight (type 'raw') for output eDP1
[ 62313.384] (II) intel(0): Enabled output eDP1
[ 62313.384] (II) intel(0): Output HDMI1 has no monitor section
[ 62313.384] (II) intel(0): Enabled output HDMI1
[ 62313.384] (II) intel(0): Output DP1 has no monitor section
[ 62313.384] (II) intel(0): Enabled output DP1
[ 62313.384] (II) intel(0): Output HDMI2 has no monitor section
[ 62313.384] (II) intel(0): Enabled output HDMI2
[ 62313.384] (--) intel(0): Using a maximum size of 256x256 for hardware cursors
[ 62313.384] (II) intel(0): Output VIRTUAL1 has no monitor section
[ 62313.384] (II) intel(0): Enabled output VIRTUAL1
[ 62313.384] (--) intel(0): Output eDP1 using initial mode 1920x1080 on pipe 0
[ 62313.384] (==) intel(0): TearFree enabled
[ 62313.384] (==) intel(0): Using gamma correction (1.0, 1.0, 1.0)
[ 62313.384] (==) intel(0): DPI set to (96, 96)
[ 62313.386] (II) UnloadModule: "modesetting"
[ 62313.386] (II) Unloading modesetting
[ 62313.386] (II) intel(0): SNA initialized with Kabylake (gen9) backend
[ 62313.386] (==) intel(0): Backing store enabled
[ 62313.386] (==) intel(0): Silken mouse disabled
[ 62313.386] (II) intel(0): HW Cursor enabled
[ 62313.386] (==) intel(0): DPMS enabled
[ 62313.386] (==) intel(0): Display hotplug detection enabled
[ 62313.386] (II) intel(0): [DRI2] Setup complete
[ 62313.386] (II) intel(0): [DRI2]   DRI driver: i965
[ 62313.386] (II) intel(0): [DRI2]   VDPAU driver: va_gl
[ 62313.386] (II) intel(0): direct rendering: DRI2 DRI3 enabled
[ 62313.386] (II) intel(0): hardware support for Present enabled
[ 62313.402] (II) intel(0): switch to mode 1920x1080@60.0 on eDP1 using pipe 0, position (0, 0), rotation normal, reflection none
[ 62313.408] (II) intel(0): Setting screen physical size to 508 x 285
[ 62314.724] (II) config/udev: Adding input device HDA Intel PCH HDMI/DP,pcm=7 (/dev/input/event10)
[ 62314.724] (II) config/udev: Adding input device HDA Intel PCH HDMI/DP,pcm=8 (/dev/input/event11)
[ 62314.725] (II) config/udev: Adding input device HDA Intel PCH HDMI/DP,pcm=9 (/dev/input/event12)
[ 62314.726] (II) config/udev: Adding input device HDA Intel PCH HDMI/DP,pcm=10 (/dev/input/event13)
[ 62314.726] (II) config/udev: Adding input device HDA Intel PCH Headphone (/dev/input/event8)
[ 62314.727] (II) config/udev: Adding input device HDA Intel PCH HDMI/DP,pcm=3 (/dev/input/event9)
[ 62315.385] (II) intel(0): EDID vendor "LGD", prod id 1135
[ 62315.385] (II) intel(0): Printing DDC gathered Modelines:
[ 62315.385] (II) intel(0): Modeline "1920x1080"x0.0  138.70  1920 1968 2000 2080  1080 1083 1088 1111 +hsync -vsync (66.7 kHz eP)

At least I can see Xsetup content is no longer the same, but xrandr still only lists intel as provider. grep-ing EE in /var/log/Xorg.0.log now gives me this:

(EE) Screen 1 deleted because of no matching config section
vetzki commented 6 years ago

its strange that the nviida module gets unloaded [ 62312.950] (II) UnloadModule: "nvidia"

can you try this nvidia config?:

Section "ServerLayout"
   Identifier "layout"
   Screen 0 "nvidia"
   Inactive "intel"
EndSection

Section "Device"
   Identifier "nvidia"
   Driver "nvidia"
   BusID "PCI:1:0:0"
EndSection

Section "Screen"
   Identifier "nvidia"
   Device "nvidia"
   Option "AllowEmptyInitialConfiguration"
EndSection

Section "Device"
   Identifier "intel"
   Driver "modesetting"
EndSection

Section "Screen"
   Identifier "intel"
   Device "intel"
EndSection

(from http://us.download.nvidia.com/XFree86/Linux-x86/396.24/README/randr14.html)

also if you dont have nvidiafb installed can you also remove following files (they probably dont cause any issues, but also shouldn't be needed) ?:

edit: for testing: can you also remove the line options nvidia-drm modeset=1 from fiile /etc/modprobe.d/mhwd-gpu.conf

leledumbo commented 6 years ago

can you try this nvidia config?

Done, blackscreen again, here's what I got from egrep -i 'nvidia|intel|i915|modesetting|primarygpu' /var/log/Xorg.0.log.old:

[    14.316] (**) |-->Screen "nvidia" (0)
[    14.316] (**) |   |-->Device "nvidia"
[    14.316] (**) |   |-->GPUDevice "nvidia"
[    14.316] (**) |   |-->GPUDevice "intel"
[    14.316] (==) No monitor specified for screen "nvidia".
[    14.316] (**) |-->Inactive Device "intel"
[    14.325] (II) LoadModule: "nvidia"
[    14.325] (II) Loading /usr/lib/xorg/modules/drivers/nvidia_drv.so
[    14.333] (II) Module nvidia: vendor="NVIDIA Corporation"
[    14.333] (II) LoadModule: "modesetting"
[    14.333] (II) Loading /usr/lib/xorg/modules/drivers/modesetting_drv.so
[    14.337] (II) Module modesetting: vendor="X.Org Foundation"
[    14.337] (II) NVIDIA dlloader X Driver  396.54  Tue Aug 14 22:15:03 PDT 2018
[    14.337] (II) NVIDIA Unified Driver for all Supported NVIDIA GPUs
[    14.337] (II) modesetting: Driver for Modesetting Kernel Drivers: kms
[    14.472] (II) NVIDIA(0): Creating default Display subsection in Screen section
    "nvidia" for depth/fbbpp 24/32
[    14.472] (==) NVIDIA(0): Depth 24, (==) framebuffer bpp 32
[    14.472] (==) NVIDIA(0): RGB weight 888
[    14.472] (==) NVIDIA(0): Default visual is TrueColor
[    14.472] (==) NVIDIA(0): Using gamma correction (1.0, 1.0, 1.0)
[    14.472] (**) NVIDIA(0): Option "AllowEmptyInitialConfiguration"
[    14.472] (**) NVIDIA(0): Enabling 2D acceleration
[    14.472] (EE) NVIDIA(0): Failed to initialize the GLX module; please check in your X
[    14.472] (EE) NVIDIA(0):     log file that the GLX module has been loaded in your X
[    14.472] (EE) NVIDIA(0):     server, and that the module is the NVIDIA GLX module.  If
[    14.472] (EE) NVIDIA(0):     you continue to encounter problems, Please try
[    14.472] (EE) NVIDIA(0):     reinstalling the NVIDIA driver.
[    15.106] (II) NVIDIA(0): NVIDIA GPU GeForce GTX 1050 (GP107-A) at PCI:1:0:0 (GPU-0)
[    15.106] (--) NVIDIA(0): Memory: 4194304 kBytes
[    15.106] (--) NVIDIA(0): VideoBIOS: 86.07.40.00.2b
[    15.106] (II) NVIDIA(0): Detected PCI Express Link width: 16X
[    15.106] (II) NVIDIA(0): Validated MetaModes:
[    15.106] (II) NVIDIA(0):     "NULL"
[    15.106] (II) NVIDIA(0): Virtual screen size determined to be 640 x 480
[    15.106] (WW) NVIDIA(0): Unable to get display device for DPI computation.
[    15.106] (==) NVIDIA(0): DPI set to (75, 75); computed from built-in default
[    15.141] (II) modeset(G0): glamor X acceleration enabled on Mesa DRI Intel(R) HD Graphics 630 (Kaby Lake GT2) 
[    15.206] (II) NVIDIA: Using 24576.00 MB of virtual memory for indirect memory
[    15.206] (II) NVIDIA:     access.
[    15.230] (II) NVIDIA(0): Setting mode "NULL"
[    15.233] (==) NVIDIA(0): Disabling shared memory pixmaps
[    15.233] (==) NVIDIA(0): Backing store enabled
[    15.233] (==) NVIDIA(0): Silken mouse disabled
[    15.233] (==) NVIDIA(0): DPMS enabled
[    15.233] (II) NVIDIA(0): [DRI2] Setup complete
[    15.233] (II) NVIDIA(0): [DRI2]   VDPAU driver: nvidia
[    16.244] (II) config/udev: Adding input device HDA Intel PCH HDMI/DP,pcm=7 (/dev/input/event10)
[    16.244] (II) config/udev: Adding input device HDA Intel PCH HDMI/DP,pcm=8 (/dev/input/event11)
[    16.245] (II) config/udev: Adding input device HDA Intel PCH HDMI/DP,pcm=9 (/dev/input/event12)
[    16.246] (II) config/udev: Adding input device HDA Intel PCH HDMI/DP,pcm=10 (/dev/input/event13)
[    16.247] (II) config/udev: Adding input device HDA Intel PCH Headphone (/dev/input/event8)
[    16.248] (II) config/udev: Adding input device HDA Intel PCH HDMI/DP,pcm=3 (/dev/input/event9)
[   126.867] (II) NVIDIA(0): Setting mode "NULL"
[   129.369] (II) NVIDIA(GPU-0): Deleting GPU-0

Looks like it wants a Monitor section in the config but can't find one.

/etc/modprobe.d/nvidia.conf /etc/modprobe.d/nvidia-drm.conf

Removed (renamed to .conf.noneed actually, but should be the same as modprobe requires .conf extension for an option file to load).

can you also remove the line options nvidia-drm modeset=1 from fiile /etc/modprobe.d/mhwd-gpu.conf

Done as well.

vetzki commented 6 years ago

this should not happen: ... [ 14.472] (EE) NVIDIA(0): Failed to initialize the GLX module; please check in your X [ 14.472] (EE) NVIDIA(0): log file that the GLX module has been loaded in your X [ 14.472] (EE) NVIDIA(0): server, and that the module is the NVIDIA GLX module. If [ 14.472] (EE) NVIDIA(0): you continue to encounter problems, Please try [ 14.472] (EE) NVIDIA(0): reinstalling the NVIDIA driver. ...

does the file /usr/lib/nvidia/xorg/libglx.so exist on your system (and does the symlink point to libglx.so.nvidia_driver_version) ? xorg log should look like this: ... [ 7.684] (II) Loading /usr/lib/nvidia/xorg/libglx.so [ 8.343] (II) Module glx: vendor="NVIDIA Corporation" [ 8.352] (II) NVIDIA GLX Module 390.87 Tue Aug 21 16:10:56 PDT 2018 ...

leledumbo commented 6 years ago

does the file /usr/lib/nvidia/xorg/libglx.so exist on your system (and does the symlink point to libglx.so.nvidia_driver_version) ?

I guess so:

$ ls -l /usr/lib/nvidia/xorg/libglx.so
lrwxrwxrwx 1 root root 16 Agu 23 05:57 /usr/lib/nvidia/xorg/libglx.so -> libglx.so.396.54
vetzki commented 6 years ago

if you grep for path in your xorg log file does it look like this: ~$ grep -i path /var/log/Xorg.0.log [ 5.687] Entry deleted from font path. [ 5.688] Entry deleted from font path. [ 5.688] (==) FontPath set to: [ 5.688] (==) ModulePath set to "/usr/lib/xorg/modules" [ 5.716] (**) OutputClass "nvidia" ModulePath extended to "/usr/lib/nvidia/xorg,/usr/lib/xorg/modules,/usr/lib/xorg/modules" ?

can you also show output of grep -i glx /path/to/xorg.log-file ?

and finally, does intel_modesetting config (prime-switch -d intel_modesetting) work and xrandr --listproviders command showing 2 (modesetting) providers?

leledumbo commented 6 years ago

if you grep for path in your xorg log file does it look like this:

Almost, missing the last line:

[    14.318]    Entry deleted from font path.
[    14.318]    Entry deleted from font path.
[    14.318] (==) FontPath set to:
[    14.318] (==) ModulePath set to "/usr/lib/xorg/modules"

can you also show output of grep -i glx /path/to/xorg.log-file ?

[    14.323] (II) LoadModule: "glx"
[    14.324] (II) Loading /usr/lib/xorg/modules/extensions/libglx.so
[    14.325] (II) Module glx: vendor="X.Org Foundation"
[    14.472] (EE) NVIDIA(0): Failed to initialize the GLX module; please check in your X
[    14.472] (EE) NVIDIA(0):     log file that the GLX module has been loaded in your X
[    14.472] (EE) NVIDIA(0):     server, and that the module is the NVIDIA GLX module.  If
[    15.235] (II) Initializing extension GLX
[    15.235] (II) AIGLX: Screen 0 is not DRI2 capable
[    15.386] (II) IGLX: Loaded and initialized swrast
[    15.386] (II) GLX: Initialized DRISWRAST GL provider for screen 0
[    15.386] (II) Initializing extension NV-GLX

and finally, does intel_modesetting config (prime-switch -d intel_modesetting) work and xrandr --listproviders command showing 2 (modesetting) providers?

Do I have to relogin after executing prime-switch before executing xrandr? Without relogin, it still only shows 1.

vetzki commented 6 years ago

sorry you have to reboot after switching to intel_modesetting (nvidia modules will be disabled, thus requiring reboot)

Also I dont understand yet if using nivida why ModulePath won't include "/usr/lib/nvidia/xorg" (/usr/share/X11/xorg.conf.d/10-nvidia-drm-outputclass.conf should set this). I also tested without setting correct modulepath on my laptop with the result: I get the same glx error like you, but desktop still gets loaded and for glx llvmpipe (gallium) is used.

But currently I'm using lightdm, I will switch to sddm and test there.

Did you try without sddm (and with lightdm or no display manager)?

leledumbo commented 6 years ago

sorry you have to reboot after switching to intel_modesetting (nvidia modules will be disabled, thus requiring reboot)

Got it, but still only 1 provider.

Did you try without sddm (and with lightdm or no display manager)?

Err...no, I only have sddm atm. This repo is the sddm version anyway, right?

vetzki commented 6 years ago

Ok, still only 1 provider

Yes this is the repo for sddm

leledumbo commented 6 years ago

Today out of curiousity I decided to reinstall your package again and I notice something during installation:

/tmp/alpm_EiCg0D/.INSTALL: line 3: check: command not found

that renders the Xsetup script to be:

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

check() {
python -c '
import os

SYSFS_PATH="/sys/bus/pci/devices"
devs = os.listdir(SYSFS_PATH)
gpus = [ "/sys/bus/pci/devices/"+i+"/" for i in devs if "0x03000" in open(SYSFS_PATH+"/"+i+"/class").read() ]

_g = (True for i in gpus if "nouveau" in os.path.realpath(i+"driver"))

for v in _g:
  if True:
    print(v)
    exit(0)
exit(1)
'
}

if [[  == True ]];
    then
    # nouveau (see also https://nouveau.freedesktop.org/wiki/Optimus/)
    xrandr --setprovideroffloadsink nouveau Intel;
    # if second gpu output not accessible
    # xrandr --setprovideroutputsource nouveau Intel
    else
    # nvidia
    xrandr --setprovideroutputsource modesetting NVIDIA-0; # not necessarily needed
fi

xrandr --auto;

unset check;

which looks wrong to my eyes (at least that if [[ == True ]]; shouldn't happen).

vetzki commented 6 years ago

thanks fixed.

If I'm using sddm as display manager I encounter a strange delay of 10-20 (edit) (see also edit2) second until display manager starts. Maybe you encounter the same issue

edit2:

install either haveged or rng-tools (rng-tools if you have hardware random number generator) activate either haveged or rngd systemd service

leledumbo commented 6 years ago

And after your fix, the config you provide above:

Section "ServerLayout"
   Identifier "layout"
   Screen 0 "nvidia"
   Inactive "intel"
EndSection

Section "Device"
   Identifier "nvidia"
   Driver "nvidia"
   BusID "PCI:1:0:0"
EndSection

Section "Screen"
   Identifier "nvidia"
   Device "nvidia"
   Option "AllowEmptyInitialConfiguration"
EndSection

Section "Device"
   Identifier "intel"
   Driver "modesetting"
EndSection

Section "Screen"
   Identifier "intel"
   Device "intel"
EndSection

now works. I can now use my Nvidia card again. Thank you, you're the man!