bayasdev / envycontrol

Easy GPU switching for Nvidia Optimus laptops under Linux
MIT License
1.26k stars 61 forks source link

[BUG] nvidia mode not working #140

Closed kamperemu closed 7 months ago

kamperemu commented 12 months ago

Describe the bug Nvidia mode doesn't work properly (specifically for lightdm in my case)

To Reproduce

  1. fresh install of arch linux with base base-devel linux linux-firmware xorg-server qtile lightdm lightdm-gtk-greeter
  2. boot into lightdm
  3. Install envycontrol. Run sudo envycontrol -s nvidia
  4. reboot
  5. there will be a black screen with a cursor blinking.
  6. However if you're on a dual screen setup, the login manager will be there on the secondary display instead of the primary display

Expected behavior There should be a login screen (and if plugged into an extra display it should show up on the primary display)

Screenshots Excluded because pretty self explanatory

System Information:

D3vil0p3r commented 11 months ago

same issue here. Im using Arch with xfce and when I switch to NVIDIA mode, my environment switch to the second monitor instead of my laptop one.

xrandr detects only the second monitor:

Screen 0: minimum 8 x 8, current 3840 x 2160, maximum 32767 x 32767
HDMI-0 disconnected (normal left inverted right x axis y axis)
DP-0 connected 3840x2160+0+0 (normal left inverted right x axis y axis) 700mm x 390mm
   3840x2160     60.00*+  59.94    50.00    29.97    25.00    23.98  
   2560x1440     59.95  
   1920x1080     60.00    59.94    50.00    29.97    25.00    23.98  
   1680x1050     59.95  
   1440x900      59.89  
   1366x768      59.79  
   1280x1024     75.02    60.02  
   1280x960      60.00  
   1280x800      59.81  
   1280x768      59.87  
   1280x720      60.00    59.94    50.00  
   1152x864      75.00  
   1024x768      75.03    70.07    60.00  
   800x600       75.00    72.19    60.32    56.25  
   720x576       50.00  
   720x480       59.94  
   640x480       75.00    72.81    59.94    59.93  
DP-1 disconnected (normal left inverted right x axis y axis)

Furthermore, glxinfo | grep OpenGL does not return NVIDIA but `LLVM``:

OpenGL vendor string: Mesa
OpenGL renderer string: llvmpipe (LLVM 16.0.6, 256 bits)
OpenGL core profile version string: 4.5 (Core Profile) Mesa 23.2.1-arch1.2
OpenGL core profile shading language version string: 4.50
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 4.5 (Compatibility Profile) Mesa 23.2.1-arch1.2
OpenGL shading language version string: 4.50
OpenGL context flags: (none)
OpenGL profile mask: compatibility profile
OpenGL extensions:
OpenGL ES profile version string: OpenGL ES 3.2 Mesa 23.2.1-arch1.2
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20
OpenGL ES profile extensions:

Despite by running hwinfo it finds both iGPU and NVIDIA GPU:

28: PCI 100.0: 0300 VGA compatible controller (VGA)
  [Created at pci.386]
  Unique ID: VCu0.0lI7h2uReU3
  Parent ID: vSkL.+qP7vwNkUf8
  SysFS ID: /devices/pci0000:00/0000:00:01.0/0000:01:00.0
  SysFS BusID: 0000:01:00.0
  Hardware Class: graphics card
  Model: "nVidia TU106M [GeForce RTX 2060 Mobile]"
  Vendor: pci 0x10de "nVidia Corporation"
  Device: pci 0x1f11 "TU106M [GeForce RTX 2060 Mobile]"
  SubVendor: pci 0x1462 "Micro-Star International Co., Ltd. [MSI]"
  SubDevice: pci 0x126a 
  Revision: 0xa1
  Driver: "nvidia"
  Driver Modules: "nvidia"
  Memory Range: 0xa4000000-0xa4ffffff (rw,non-prefetchable)
  Memory Range: 0x90000000-0x9fffffff (ro,non-prefetchable)
  Memory Range: 0xa0000000-0xa1ffffff (ro,non-prefetchable)
  I/O Ports: 0x5000-0x507f (rw)
  Memory Range: 0xa5000000-0xa507ffff (ro,non-prefetchable,disabled)
  IRQ: 148 (3324088 events)
  Module Alias: "pci:v000010DEd00001F11sv00001462sd0000126Abc03sc00i00"
  Driver Info #0:
    Driver Status: nouveau is not active
    Driver Activation Cmd: "modprobe nouveau"
  Driver Info #1:
    Driver Status: nvidia_drm is not active
    Driver Activation Cmd: "modprobe nvidia_drm"
  Driver Info #2:
    Driver Status: nvidia is active
    Driver Activation Cmd: "modprobe nvidia"
  Config Status: cfg=new, avail=yes, need=no, active=unknown
  Attached to: #24 (PCI bridge)

38: PCI 02.0: 0300 VGA compatible controller (VGA)
  [Created at pci.386]
  Unique ID: _Znp.OrdtUzJTPd3
  SysFS ID: /devices/pci0000:00/0000:00:02.0
  SysFS BusID: 0000:00:02.0
  Hardware Class: graphics card
  Device Name: "Onboard - Video"
  Model: "Intel CoffeeLake-H GT2 [UHD Graphics 630]"
  Vendor: pci 0x8086 "Intel Corporation"
  Device: pci 0x3e9b "CoffeeLake-H GT2 [UHD Graphics 630]"
  SubVendor: pci 0x1462 "Micro-Star International Co., Ltd. [MSI]"
  SubDevice: pci 0x126a 
  Driver: "i915"
  Driver Modules: "i915"
  Memory Range: 0xa3000000-0xa3ffffff (rw,non-prefetchable)
  Memory Range: 0x80000000-0x8fffffff (ro,non-prefetchable)
  I/O Ports: 0x6000-0x603f (rw)
  Memory Range: 0x000c0000-0x000dffff (rw,non-prefetchable,disabled)
  IRQ: 146 (974 events)
  Module Alias: "pci:v00008086d00003E9Bsv00001462sd0000126Abc03sc00i00"
  Driver Info #0:
    Driver Status: i915 is active
    Driver Activation Cmd: "modprobe i915"
  Config Status: cfg=new, avail=yes, need=no, active=unknown

My system has the following packages installed:

local/nvidia-open-dkms 535.113.01-6
    NVIDIA open kernel modules
local/nvidia-settings 535.113.01-1
    Tool for configuring the NVIDIA graphics driver
local/nvidia-utils 535.113.01-2
    NVIDIA drivers utilities
local/nvtop 3.0.2-1
    GPUs process monitoring for AMD, Intel and NVIDIA
local/opencl-nvidia 535.113.01-2
    OpenCL implemention for NVIDIA
D3vil0p3r commented 11 months ago

@kamperemu I had nvidia-exec package installed on my system. I uninstalled it and now envycontrol works correctly.

kamperemu commented 11 months ago

@D3vil0p3r don't have nvidia-exec installed. So, I think my issue is completely different.

D3vil0p3r commented 11 months ago

@D3vil0p3r don't have nvidia-exec installed. So, I think my issue is completely different.

Can you share the content of your /etc/mkinitcpio.conf and /etc/default/grub and the list of files in /etc/modprobe.d directory?

What is the output of the following commands?

echo "$XDG_SESSION_TYPE"
glxinfo | grep "OpenGL render"
lspci | grep VGA
kamperemu commented 11 months ago

@D3vil0p3r

I'm using systemd boot instead of grub

/etc/mkinitcpio.conf

# vim:set ft=sh
# MODULES
# The following modules are loaded before any boot hooks are
# run.  Advanced users may wish to specify all system modules
# in this array.  For instance:
#     MODULES=(usbhid xhci_hcd)
MODULES=(nvidia nvidia_modeset nvidia_uvm nvidia_drm)

# BINARIES
# This setting includes any additional binaries a given user may
# wish into the CPIO image.  This is run last, so it may be used to
# override the actual binaries included by a given hook
# BINARIES are dependency parsed, so you may safely ignore libraries
BINARIES=()

# FILES
# This setting is similar to BINARIES above, however, files are added
# as-is and are not parsed in any way.  This is useful for config files.
FILES=()

# HOOKS
# This is the most important setting in this file.  The HOOKS control the
# modules and scripts added to the image, and what happens at boot time.
# Order is important, and it is recommended that you do not change the
# order in which HOOKS are added.  Run 'mkinitcpio -H <hook name>' for
# help on a given hook.
# 'base' is _required_ unless you know precisely what you are doing.
# 'udev' is _required_ in order to automatically load modules
# 'filesystems' is _required_ unless you specify your fs modules in MODULES
# Examples:
##   This setup specifies all modules in the MODULES setting above.
##   No RAID, lvm2, or encrypted root is needed.
#    HOOKS=(base)
#
##   This setup will autodetect all modules for your system and should
##   work as a sane default
#    HOOKS=(base udev autodetect modconf block filesystems fsck)
#
##   This setup will generate a 'full' image which supports most systems.
##   No autodetection is done.
#    HOOKS=(base udev modconf block filesystems fsck)
#
##   This setup assembles a mdadm array with an encrypted root file system.
##   Note: See 'mkinitcpio -H mdadm_udev' for more information on RAID devices.
#    HOOKS=(base udev modconf keyboard keymap consolefont block mdadm_udev encrypt filesystems fsck)
#
##   This setup loads an lvm2 volume group.
#    HOOKS=(base udev modconf block lvm2 filesystems fsck)
#
##   NOTE: If you have /usr on a separate partition, you MUST include the
#    usr and fsck hooks.
HOOKS=(base udev autodetect modconf keyboard keymap consolefont block filesystems fsck)

# COMPRESSION
# Use this to compress the initramfs image. By default, zstd compression
# is used. Use 'cat' to create an uncompressed image.
#COMPRESSION="zstd"
#COMPRESSION="gzip"
#COMPRESSION="bzip2"
#COMPRESSION="lzma"
#COMPRESSION="xz"
#COMPRESSION="lzop"
#COMPRESSION="lz4"

# COMPRESSION_OPTIONS
# Additional options for the compressor
#COMPRESSION_OPTIONS=()

# MODULES_DECOMPRESS
# Decompress kernel modules during initramfs creation.
# Enable to speedup boot process, disable to save RAM
# during early userspace. Switch (yes/no).
#MODULES_DECOMPRESS="yes"

/etc/modprobe.d/nvidia.conf

# Automatically generated by EnvyControl

options nvidia-drm modeset=1
options nvidia NVreg_UsePageAttributeTable=1 NVreg_InitializeSystemMemoryAllocations=0

echo "$XDG_SESSION_TYPE"

x11

glxinfo | grep "OpenGL render"

OpenGL renderer string: NVIDIA GeForce RTX 3070 Ti Laptop GPU/PCIe/SSE2

lspci | grep VGA

01:00.0 VGA compatible controller: NVIDIA Corporation GA104 [Geforce RTX 3070 Ti Laptop GPU] (rev a1)
07:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Rembrandt [Radeon 680M] (rev c7)

xrandr

Screen 0: minimum 8 x 8, current 1920 x 1080, maximum 32767 x 32767
DP-0 disconnected primary (normal left inverted right x axis y axis)
DP-1 disconnected (normal left inverted right x axis y axis)
DP-2 disconnected (normal left inverted right x axis y axis)
HDMI-0 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 527mm x 296mm
   1920x1080    143.98*+ 119.98   119.88    99.93    60.00    59.94    50.00
   3840x2160     59.94    50.00    29.97    25.00    23.98
   1280x1024     75.02
   1280x720      59.94
   1024x768     119.99    75.03    60.00
   800x600      119.97    75.00    60.32
   720x576       50.00
   720x480       59.94
   640x480      120.01    75.00    59.94    59.93

There are two displays btw... it is only saying one is connected All of this is in nvidia mode of course. In hybrid mode, both displays are shown as connected

D3vil0p3r commented 11 months ago

I don't think it is an envycontrol issue. It seems to set it correctly. Can you run pacman -Qs nvidia and giving me the output?

PS: your issue is that you get a black screen with blinking cursor?

Which kernel are you using?

kamperemu commented 11 months ago

@D3vil0p3r egl-wayland 2:1.1.13-1 envycontrol 3:3.0-1 libvdpau 1.5-2 nvidia 535.113.01-8 nvidia-utils 535.113.01-2

Currently on tty2 so I can't copy and paste the output. I have typed the output from another device.

bayasdev commented 11 months ago

Currently Nvidia mode is only supported under Xorg sessions

On Tue, Oct 31, 2023, 10:37 Vedang Patel @.***> wrote:

@D3vil0p3r https://github.com/D3vil0p3r egl-wayland 2:1.1.13-1 envycontrol 3:3.0-1 libvdpau 1.5-2 nvidia 535.113.01-8 nvidia-utils 535.113.01-2

Currently on tty2 so I can't copy and paste the output. I have typed the output from another device.

— Reply to this email directly, view it on GitHub https://github.com/bayasdev/envycontrol/issues/140#issuecomment-1787470549, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALY7IYMXR3NK5WZYEU745BDYCELKPAVCNFSM6AAAAAA53PDCDKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTOOBXGQ3TANJUHE . You are receiving this because you are subscribed to this thread.Message ID: @.***>

kamperemu commented 11 months ago

I'm using an xorg session... the Wayland stuff is automatically installed with nvidia. I'm using qtile xorg.

bayasdev commented 11 months ago

@kamperemu I see, then you need to setup your display manager or xinitrc to do the xrandr thing that's documented on the project wiki

kamperemu commented 11 months ago

I'm using lightdm which is supported by envycontrol if I'm not wrong.

D3vil0p3r commented 11 months ago

@D3vil0p3r egl-wayland 2:1.1.13-1 envycontrol 3:3.0-1 libvdpau 1.5-2 nvidia 535.113.01-8 nvidia-utils 535.113.01-2

Currently on tty2 so I can't copy and paste the output. I have typed the output from another device.

Here you have these packages but in your first post you reported to have:

local/nvidia-open-dkms 535.113.01-6
    NVIDIA open kernel modules

Which kernel are you using?

PS: you are using "conflicting" packages if my assumption here is true.

kamperemu commented 11 months ago

@D3vil0p3r I haven't mentioned a dkms kernel anywhere in this thread. I have tried both the regular and dkms kernels on fresh installs for debugging at one point. Currently, I don't have any conflicting packages.

D3vil0p3r commented 11 months ago

@D3vil0p3r I haven't mentioned a dkms kernel anywhere in this thread. I have tried both the regular and dkms kernels on fresh installs for debugging at one point. Currently, I don't have any conflicting packages.

So what is your kernel?

kamperemu commented 11 months ago

The base kernel

D3vil0p3r commented 11 months ago

The base kernel

I think you can try to remove nvidia package and install nvidia-open and use again envycontrol to check what happens.

kamperemu commented 7 months ago

After switching to another OS for a while (had some university work to do), the issue just randomly fixed itself when I returned today. I'm no longer able to reproduce the bug so I'm going to close this issue.