Bumblebee-Project / Bumblebee

Bumblebee daemon and client rewritten in C
http://www.bumblebee-project.org/
GNU General Public License v3.0
1.29k stars 142 forks source link

[Feature Request] PMMethod=unload_modules #978

Closed IngeniousDox closed 5 years ago

IngeniousDox commented 6 years ago

This was discussed in https://github.com/Bumblebee-Project/bbswitch/issues/140 by me and ArchangeGabriel. And before that, it was suggested by Liskin that a new bugreport would be handy. But since he is busy / lazy (his words), I figured I would make it it, so it is visible as a seperate issue, and not drowned in the bigger discussion. The reason for this feature request is the following:

With newer dGPUs and newer kernels, it is enough to load the nvidia modules to power on the dGPU, and unload the nvidia modules to unload to disable the dGPU again. Lekenstyn suspects it is due to https://github.com/torvalds/linux/commit/abf92f86361b commit.

And indeed, setting PMMethod to none works just fine for me on my Dell XPS15 9570 to use Optirun. (and some others have had the same success on similar configurations). However, after Optirun is done, the nvidia modules are not unloaded, so the dGPU stays powered on. This means you have to modprobe -r them yourself. However, this either requires manual handling or wrapper scripts on the user part. Hence this is the feature request:

_A new PMMethod called something like "unloadmodules", that unloads the modules after Optirun is used.

Dox

karolherbst commented 6 years ago

this would need bumlebee to set power/control to auto on the GPU and the parent PCIe host, otherwise the GPU might simply stay on even with no driver loaded. I think software like TLP even blacklist GPUs and don't ever set them to auto.

liskin commented 6 years ago

@karolherbst laptop-mode-tools certainly doesn't do this by itself — the default is to blacklist just storage and input devices: https://github.com/rickysarraf/laptop-mode-tools/blob/lmt-upstream/etc/laptop-mode/conf.d/runtime-pm.conf#L46

karolherbst commented 6 years ago

seems like TLP only has some comments about it in their config actually. Maybe I changed it locally and simply forgot about it.

karolherbst commented 6 years ago

Anyway, it makes sense to still verify it as we can't depend on userspace doing it already.

IngeniousDox commented 6 years ago

I will have to retest this. During my testing I used Powertop to toggle it manually.

I assumed I would use just enable power savings in TLP for nvida (it Blacklists it by default), but that seems to have created a race condition. Sometimes I would be able to load the module and run optirun, other times it put the bus/gpu back in sleep before optirun started.

Adding it to startup also seems to give some issues: https://bbs.archlinux.org/viewtopic.php?pid=1800773#p1800773

Now, I'm not sure if it should be Bumblebee changing it to auto, or if we should configure our setups correctly. I want to use nvidia-xrun aswell and have requested there aswell to get an option to not use bbswitch, see: https://github.com/Witko/nvidia-xrun/issues/67. So I would probably want to set power management correctly myself. But indeed, letting bumblebeed setting it on boot could work aswell, and perhaps is more in line of what people would expect from bumblebee.

Lekensteyn commented 6 years ago

Now, I'm not sure if it should be Bumblebee changing it to auto, or if we should configure our setups correctly.

Whether this method works or not is highly dependent on the kernel version, so some form of autodetection must happen. Perhaps a shell script that is started before the daemon?

IngeniousDox commented 6 years ago

Just linking this Issue/Request to a PR that yawor made. He talked about it in the Arch forum thread. He first had a linuxpm method, but now he has settled on an extra config option: https://github.com/Bumblebee-Project/Bumblebee/pull/983

yawor commented 6 years ago

Hi. Somehow I've missed this feature request and I've posted PR with my solution. My reasoning behind it is that it is simple and doesn't promise anything more than what it does. The new config option AlwaysUnloadKernelDriver in driver-* section, when set to true, forces Bumblebee to unload the driver when it's not needed anymore - even with PM method disabled. The naming of the option doesn't promise that it shuts down the card. Only that it unloads the driver. Now it's up to the user to set it up correctly, so the kernel shuts down the card. You're right that TLP doesn't touch dGPU's power control (/sys/bus/pci/devices/0000:01:00.0/power/control in Dell's case) at all, leaving it set to on. But I've created a /etc/tmpfiles.d/nvidia_pm.conf file containing:

w /sys/bus/pci/devices/0000:01:00.0/power/control - - - - auto

which sets value auto at boot.

cassandracomar commented 6 years ago

I can confirm that @yawor's branch + linux pm + tlp all work together. With bbswitch removed, PMMethod set to none, and AlwaysUnloadKernelDriver set, I have a working optirun that powers up the card and is able to unload the driver after the program using it quits. Power management then kicks in and the card turns off. One thing that I had to do was ensure bbswitch was blacklisted so it didn't start and power off the card the first time. As soon as that happens, the driver can't be loaded again.

rockorequin commented 6 years ago

+1 for this. Making bumblebee unload the nvidia modules each time and letting the kernel handle powering the card up and down instead of bbswitch works well on my xps15-9560, including after suspend/resume.

IngeniousDox commented 5 years ago

Closing this issue/request, since yawors PR has been pushed to develop.

IngeniousDox commented 5 years ago

@yawor Your AlwaysUnloadKernelDriver=true works. However, now (after updating entire system / bios etc) I'm having issues with enabling the card when the nvidia dGPU PM is set to "auto". Are you still able to use it yourself without any modifications?

(I asked the same question in the Arch forum thread, but since I wasn't sure you were still getting notifications there, I figured it might be handy to ask you here on Github aswell. Others there seem to have the same problem.)

yawor commented 5 years ago

@IngeniousDox yes, it does work. There are some issues after waking up from a suspend, but some user posted a solution recently on Arch forum, which involves changing power control of the PCIe controller and removing the card and rescanning the PCIe bus. It seems to work well.

I'm thinking about another patch to bumblebee where a user can define custom scripts which would be run on certain moments (pre-enable, post-disable etc). Of course it would need to check if permissions of the scripts are not too wide - they shouldn't allow any user to edit them and put there something malicious as the scripts need to be run as root.

IngeniousDox commented 5 years ago

@yawor Yeah, with those scripts, or well, with putting the PCI bus to on "on" and rescanning, I can make it work aswell. Yesterday, without using that, I think optirun worked once randomly while I was fiddling, but after I restarted laptop, it never worked again. I think I had the same when I used TLP to put dGPU PM to "auto" back in August. Right now I'm using the /etc/tmpfiles.d/ like you suggested in Arch forum. And it seems to have the same effect.

I just retested, and if leave the dGPU to "On" during boot, and use Optirun once (using the Nvidia card once), and then use Powertop to toggle to turn dGPU to "Auto", I can still use Optirun afterward and it starts and stops without issues. It seems that setting dGPU to "Auto" on boot might have the same effect as your issues with suspend.

It is starting to feel to me that if you want a complete solution for our XPS 5970s (and perhaps other laptops), you would need Bumblebee to turn the PCI bus to "ON" and rescan when turning on, and back to "auto" when it is done. Your idea of using extra script was my first thought aswell, but my whole reason for opening this issue was to not have to use "extra scripts" outside of Bumblebee. But back then it truly was enough to just unload the nvidia kernel modules, but since that isn't working reliably or not at all now, we need something more.

@karolherbst already brought this up partially in the first reply above to my issue/request. So he already figured changing PM settings might be needed:

this would need bumlebee to set power/control to auto on the GPU and the parent PCIe host, otherwise the GPU might simply stay on even with no driver loaded. I think software like TLP even blacklist GPUs and don't ever set them to auto.

So your "AlwaysUnloadKernelDriver" option was a good addition already. But now a new PMMethod that sets PCI to "On", and rescans before modules are loaded, and back to "Auto" after modules are unloaded sounds better. Since you are thinking about submitting another patch, perhaps you can think in this direction.

IngeniousDox commented 5 years ago

Hmm, come to think of it, since it is also needed for michelers nvidia-xrun-pm (He uses the same method to start the card). And perhaps Askanzz optimus-manager could use it aswell. Perhaps it would be better to put it in bbswitch? or perhaps even make a "new" bbswitch called "pmswitch" and let users pick it in bumblebee?

Ok, perhaps I'm overthinking it, but decoupling the turning on of the gpu from Bumblebee like with bbswitch seems cleanest.

liskin commented 5 years ago

Um, wouldn't it perhaps be better to just fix it in kernel and don't bother with weird hacks all around the place? With 4.17, 4.18 and 4.19 it works like a charm. If something broke in 4.20, let's go and fix it.

IngeniousDox commented 5 years ago

It did/does? Interesting. I thought from reading Arch forum that people already had issues with it around the time of 4.18/4.19.

Anyways, if it is a kernel issue that could be fixed, then yes, that would be the logical place. And workarounds will suffice in the mean time.

liskin commented 5 years ago

@IngeniousDox On my hardware, it works wonderfully since https://github.com/torvalds/linux/commit/5775b843a619b3c93f946e2b55a208d9f0f48b59 and dropping bbswitch. I vaguely remember that If I try doing something bbswitch-y, it breaks again, but I'm not sure. So that may be an issue. Or there may be some hardware that needs more than this kernel fix.

IngeniousDox commented 5 years ago

Yeah, that was the reason for this Feature Request in the first place. bbswitch is not working for my xps9570, and is not needed. Just loading/unloading the modules was enough to put the dGPU to sleep and wake it up again. Unloading in Bumblebee was missing though. But this is now possible with Bumblebee with the "AlwaysUnloadKernelDriver" option.

However, with my xps9570 it currently doesn't work anymore. Trying to wake up the dGPU results in "pci 0000:01:00.0: Refused to change power state, currently in D3" now. The only way we can get it to work now is by working around by turning the PCI bus back to "On" and rescanning the bus, which gets us a dGPU that is back "On" again. See the scripts in this forum post for details.

So perhaps this is a kernel issue, perhaps something has changed in Bios (currently 1.6.0 instead of 1.3.0 or lower back then). I just don't know.

liskin commented 5 years ago

Interesting. But obviously fixable if it did work in the past. Downgrading bios might be impossible, so I'd recheck that bbswitch is disabled and try older kernel.

yawor commented 5 years ago

@IngeniousDox @liskin I have latest firmware for XPS 9570 (1.6.0) and latest Arch kernel (4.20.arch1-1) installed together with latest Nvidia driver (415.25-5). I'm able to execute optirun without any issues. What's even more interesting is that I've used suspend many times since last full reboot (uptime shows over 3 days) and I hadn't even needed to use the scripts posted on the Arch forum (PCIe bus power control etc).

Sangeppato commented 5 years ago

@yawor Without bbswitch? On my laptop if I try to use Bumblebee without bbswitch, the Nvidia module is loaded at boot by gnome-shell and Xorg/Xwayland and I'm not able to remove it to turn the GPU off

liskin commented 5 years ago

@Sangeppato Debian ships bumblebee with a bunch of modprobe.d files that prevent the module from loading automatically unless explicitly requested, you might want to take a look in there.

IngeniousDox commented 5 years ago

Well, that is something. I basically copied your setup, yawor, as posted in Arch forum, but I am using bumblebee-git from AUR instead of a PKGBUILD based on your branch, but I doubt it should matter, since it should be the same code. I don't have bbswitch installed at all.

@yawor Can you post your bumblebee.conf / xorg.conf.nvidia? Perhaps there is something there different from what I have? Other then that I can't think of anything. But if you can get it working, I should be able to do the same.

@Sangeppato Others in the Arch forum thread, have noted that Gnome-Shell always loads nvidia modules for some reason.

yawor commented 5 years ago

In main Xorg (prevent loading nvidia driver). /etc/X11/xorg.conf.d/01-noautogpu.conf

Section "ServerFlags"
    Option "AutoAddGPU" "off"
EndSection

/etc/X11/xorg.conf.d/20-intel.conf

Section "Device"
    Identifier "Intel Graphics"
    Driver "intel"
EndSection

/etc/bumblebee/bumblebee.conf

# Configuration file for Bumblebee. Values should **not** be put between quotes

## Server options. Any change made in this section will need a server restart
# to take effect.
[bumblebeed]
# The secondary Xorg server DISPLAY number
VirtualDisplay=:8
# Should the unused Xorg server be kept running? Set this to true if waiting
# for X to be ready is too long and don't need power management at all.
KeepUnusedXServer=false
# The name of the Bumbleblee server group name (GID name)
ServerGroup=bumblebee
# Card power state at exit. Set to false if the card shoud be ON when Bumblebee
# server exits.
TurnCardOffAtExit=false
# The default behavior of '-f' option on optirun. If set to "true", '-f' will
# be ignored.
NoEcoModeOverride=false
# The Driver used by Bumblebee server. If this value is not set (or empty),
# auto-detection is performed. The available drivers are nvidia and nouveau
# (See also the driver-specific sections below)
Driver=
# Directory with a dummy config file to pass as a -configdir to secondary X
XorgConfDir=/etc/bumblebee/xorg.conf.d
# Xorg binary to run
XorgBinary=Xorg

## Client options. Will take effect on the next optirun executed.
[optirun]
# Acceleration/ rendering bridge, possible values are auto, virtualgl and
# primus.
Bridge=auto
# The method used for VirtualGL to transport frames between X servers.
# Possible values are proxy, jpeg, rgb, xv and yuv.
VGLTransport=proxy
# List of paths which are searched for the primus libGL.so.1 when using
# the primus bridge
PrimusLibraryPath=/usr/lib/primus:/usr/lib32/primus
# Should the program run under optirun even if Bumblebee server or nvidia card
# is not available?
AllowFallbackToIGC=false

# Driver-specific settings are grouped under [driver-NAME]. The sections are
# parsed if the Driver setting in [bumblebeed] is set to NAME (or if auto-
# detection resolves to NAME).
# PMMethod: method to use for saving power by disabling the nvidia card, valid
# values are: auto - automatically detect which PM method to use
#         bbswitch - new in BB 3, recommended if available
#       switcheroo - vga_switcheroo method, use at your own risk
#             none - disable PM completely
# https://github.com/Bumblebee-Project/Bumblebee/wiki/Comparison-of-PM-methods

## Section with nvidia driver specific options, only parsed if Driver=nvidia
[driver-nvidia]
# Module name to load, defaults to Driver if empty or unset
KernelDriver=nvidia
AlwaysUnloadKernelDriver=true
PMMethod=auto
# colon-separated path to the nvidia libraries
LibraryPath=/usr/lib/nvidia:/usr/lib32/nvidia:/usr/lib:/usr/lib32
# comma-separated path of the directory containing nvidia_drv.so and the
# default Xorg modules path
XorgModulePath=/usr/lib/nvidia/xorg/,/usr/lib/xorg/modules
XorgConfFile=/etc/bumblebee/xorg.conf.nvidia

## Section with nouveau driver specific options, only parsed if Driver=nouveau
[driver-nouveau]
KernelDriver=nouveau
PMMethod=auto
XorgConfFile=/etc/bumblebee/xorg.conf.nouveau

To make sure that bbswitch is not loaded (bbswitch is installed because it's a dependency of nvidia-xrun, which I also have installed): /etc/modprobe.d/bbswitch.conf

blacklist bbswitch
install bbswitch /usr/bin/false

/etc/tmpfiles.d/nvidia_pm.conf

w /sys/bus/pci/devices/0000:01:00.0/power/control - - - - auto

/etc/bumblebee/xorg.conf.nvidia

Section "ServerLayout"
    Identifier  "Layout0"
    Option      "AutoAddDevices" "false"
    Option      "AutoAddGPU" "false"
EndSection

Section "Device"
    Identifier  "DiscreteNvidia"
    Driver      "nvidia"
    VendorName  "NVIDIA Corporation"

#   If the X server does not automatically detect your VGA device,
#   you can manually set it here.
#   To get the BusID prop, run `lspci | egrep 'VGA|3D'` and input the data
#   as you see in the commented example.
#   This Setting may be needed in some platforms with more than one
#   nvidia card, which may confuse the proprietary driver (e.g.,
#   trying to take ownership of the wrong device). Also needed on Ubuntu 13.04.
#   BusID "PCI:01:00:0"

#   Setting ProbeAllGpus to false prevents the new proprietary driver
#   instance spawned to try to control the integrated graphics card,
#   which is already being managed outside bumblebee.
#   This option doesn't hurt and it is required on platforms running
#   more than one nvidia graphics card with the proprietary driver.
#   (E.g. Macbook Pro pre-2010 with nVidia 9400M + 9600M GT).
#   If this option is not set, the new Xorg may blacken the screen and
#   render it unusable (unless you have some way to run killall Xorg).
    Option "ProbeAllGpus" "false"

    Option "NoLogo" "true"
    Option "UseEDID" "false"
    Option "UseDisplayDevice" "none"
#    Option "RegistryDwords" "PowerMizerEnable=0x1; PerfLevelSrc=0x2222; PowerMizerDefaultAC=0x1"
#   If your NVIDIA drivers are version 331.13 or newer, and you have a laptop
#   where some of the video outputs such as HDMI or DisplayPort are connected
#   to the NVIDIA GPU, and you sometimes connect an external monitor to those
#   ports, comment out the above two options and instead uncomment the option
#   below to allow using the external monitor when it is connected while also
#   allowing the X server to start when the monitor is disconnected.

#   Option "AllowEmptyInitialConfiguration"
EndSection

Section "ServerFlags"
 Option "IgnoreABI" "1" 
EndSection

I also have TLP installed, but as far as I remember, it's mostly unchanged: /etc/default/tlp

# ------------------------------------------------------------------------------
# tlp - Parameters for power saving
# See full explanation: http://linrunner.de/en/tlp/docs/tlp-configuration.html

# Hint: some features are disabled by default, remove the leading # to enable
# them.

# Set to 0 to disable, 1 to enable TLP.
TLP_ENABLE=1

# Operation mode when no power supply can be detected: AC, BAT.
# Concerns some desktop and embedded hardware only.
TLP_DEFAULT_MODE=AC

# Operation mode select: 0=depend on power source, 1=always use TLP_DEFAULT_MODE
# Hint: use in conjunction with TLP_DEFAULT_MODE=BAT for BAT settings on AC.
TLP_PERSISTENT_DEFAULT=0

# Seconds laptop mode has to wait after the disk goes idle before doing a sync.
# Non-zero value enables, zero disables laptop mode.
DISK_IDLE_SECS_ON_AC=0
DISK_IDLE_SECS_ON_BAT=2

# Dirty page values (timeouts in secs).
MAX_LOST_WORK_SECS_ON_AC=15
MAX_LOST_WORK_SECS_ON_BAT=60

# Hint: CPU parameters below are disabled by default, remove the leading #
# to enable them, otherwise kernel default values are used.

# Select a CPU frequency scaling governor.
# Intel Core i processor with intel_pstate driver:
#   powersave(*), performance.
# Older hardware with acpi-cpufreq driver:
#   ondemand(*), powersave, performance, conservative, schedutil.
# (*) is recommended.
# Hint: use tlp-stat -p to show the active driver and available governors.
# Important:
#   powersave for intel_pstate and ondemand for acpi-cpufreq are power
#   efficient for *almost all* workloads and therefore kernel and most
#   distributions have chosen them as defaults. If you still want to change,
#   you should know what you're doing! You *must* disable your distribution's
#   governor settings or conflicts will occur.
#CPU_SCALING_GOVERNOR_ON_AC=powersave
#CPU_SCALING_GOVERNOR_ON_BAT=powersave

# Set the min/max frequency available for the scaling governor.
# Possible values strongly depend on your CPU. For available frequencies see
# the output of tlp-stat -p.
#CPU_SCALING_MIN_FREQ_ON_AC=0
#CPU_SCALING_MAX_FREQ_ON_AC=0
#CPU_SCALING_MIN_FREQ_ON_BAT=0
#CPU_SCALING_MAX_FREQ_ON_BAT=0

# Set energy performance hints (HWP) for Intel P-state governor:
#   performance, balance_performance, default, balance_power, power
# Values are given in order of increasing power saving.
# Note: Intel Skylake or newer CPU and Kernel >= 4.10 required.
CPU_HWP_ON_AC=balance_performance
CPU_HWP_ON_BAT=balance_power

# Set Intel P-state performance: 0..100 (%).
# Limit the max/min P-state to control the power dissipation of the CPU.
# Values are stated as a percentage of the available performance.
# Requires an Intel Core i processor with intel_pstate driver.
#CPU_MIN_PERF_ON_AC=0
#CPU_MAX_PERF_ON_AC=100
#CPU_MIN_PERF_ON_BAT=0
#CPU_MAX_PERF_ON_BAT=30

# Set the CPU "turbo boost" feature: 0=disable, 1=allow
# Requires an Intel Core i processor.
# Important:
# - This may conflict with your distribution's governor settings
# - A value of 1 does *not* activate boosting, it just allows it
#CPU_BOOST_ON_AC=1
#CPU_BOOST_ON_BAT=0

# Minimize number of used CPU cores/hyper-threads under light load conditions:
#   0=disable, 1=enable.
SCHED_POWERSAVE_ON_AC=0
SCHED_POWERSAVE_ON_BAT=1

# Kernel NMI Watchdog:
#   0=disable (default, saves power), 1=enable (for kernel debugging only).
NMI_WATCHDOG=0

# Change CPU voltages aka "undervolting" - Kernel with PHC patch required.
# Frequency voltage pairs are written to:
#   /sys/devices/system/cpu/cpu0/cpufreq/phc_controls
# CAUTION: only use this, if you thoroughly understand what you are doing!
#PHC_CONTROLS="F:V F:V F:V F:V"

# Set CPU performance versus energy savings policy:
#   performance, balance-performance, default, balance-power, power.
# Values are given in order of increasing power saving.
# Requires kernel module msr and x86_energy_perf_policy from linux-tools.
ENERGY_PERF_POLICY_ON_AC=performance
ENERGY_PERF_POLICY_ON_BAT=power

# Disk devices; separate multiple devices with spaces (default: sda).
# Devices can be specified by disk ID also (lookup with: tlp diskid).
DISK_DEVICES="ata-Samsung_SSD_850_EVO_500GB_XXXX"

# Disk advanced power management level: 1..254, 255 (max saving, min, off).
# Levels 1..127 may spin down the disk; 255 allowable on most drives.
# Separate values for multiple disks with spaces. Use the special value 'keep'
# to keep the hardware default for the particular disk.
DISK_APM_LEVEL_ON_AC="254 254"
DISK_APM_LEVEL_ON_BAT="128 128"

# Hard disk spin down timeout:
#   0:        spin down disabled
#   1..240:   timeouts from 5s to 20min (in units of 5s)
#   241..251: timeouts from 30min to 5.5 hours (in units of 30min)
# See 'man hdparm' for details.
# Separate values for multiple disks with spaces. Use the special value 'keep'
# to keep the hardware default for the particular disk.
#DISK_SPINDOWN_TIMEOUT_ON_AC="0 0"
#DISK_SPINDOWN_TIMEOUT_ON_BAT="0 0"

# Select IO scheduler for the disk devices: cfq, deadline, noop (Default: cfq).
# Separate values for multiple disks with spaces. Use the special value 'keep'
# to keep the kernel default scheduler for the particular disk.
#DISK_IOSCHED="cfq cfq"

# AHCI link power management (ALPM) for disk devices:
#   min_power, med_power_with_dipm(*), medium_power, max_performance.
# (*) Kernel >= 4.15 required, then recommended.
# Multiple values separated with spaces are tried sequentially until success.
SATA_LINKPWR_ON_AC="med_power_with_dipm max_performance"
SATA_LINKPWR_ON_BAT="med_power_with_dipm min_power"

# Exclude host devices from AHCI link power management.
# Separate multiple hosts with spaces.
#SATA_LINKPWR_BLACKLIST="host1"

# Runtime Power Management for AHCI host and disks devices:
#   on=disable, auto=enable.
# EXPERIMENTAL ** WARNING: auto will most likely cause system lockups/data loss.
#AHCI_RUNTIME_PM_ON_AC=on
#AHCI_RUNTIME_PM_ON_BAT=on

# Seconds of inactivity before disk is suspended.
AHCI_RUNTIME_PM_TIMEOUT=15

# PCI Express Active State Power Management (PCIe ASPM):
#   default, performance, powersave.
PCIE_ASPM_ON_AC=performance
PCIE_ASPM_ON_BAT=powersave

# Radeon graphics clock speed (profile method): low, mid, high, auto, default;
# auto = mid on BAT, high on AC; default = use hardware defaults.
RADEON_POWER_PROFILE_ON_AC=high
RADEON_POWER_PROFILE_ON_BAT=low

# Radeon dynamic power management method (DPM): battery, performance.
RADEON_DPM_STATE_ON_AC=performance
RADEON_DPM_STATE_ON_BAT=battery

# Radeon DPM performance level: auto, low, high; auto is recommended.
RADEON_DPM_PERF_LEVEL_ON_AC=auto
RADEON_DPM_PERF_LEVEL_ON_BAT=auto

# WiFi power saving mode: on=enable, off=disable; not supported by all adapters.
WIFI_PWR_ON_AC=off
WIFI_PWR_ON_BAT=off

# Disable wake on LAN: Y/N.
WOL_DISABLE=Y

# Enable audio power saving for Intel HDA, AC97 devices (timeout in secs).
# A value of 0 disables, >=1 enables power saving (recommended: 1).
SOUND_POWER_SAVE_ON_AC=0
SOUND_POWER_SAVE_ON_BAT=1

# Disable controller too (HDA only): Y/N.
SOUND_POWER_SAVE_CONTROLLER=Y

# Power off optical drive in UltraBay/MediaBay: 0=disable, 1=enable.
# Drive can be powered on again by releasing (and reinserting) the eject lever
# or by pressing the disc eject button on newer models.
# Note: an UltraBay/MediaBay hard disk is never powered off.
BAY_POWEROFF_ON_AC=0
BAY_POWEROFF_ON_BAT=0
# Optical drive device to power off (default sr0).
BAY_DEVICE="sr0"

# Runtime Power Management for PCI(e) bus devices: on=disable, auto=enable.
RUNTIME_PM_ON_AC=on
RUNTIME_PM_ON_BAT=auto

# Exclude PCI(e) device adresses the following list from Runtime PM
# (separate with spaces). Use lspci to get the adresses (1st column).
#RUNTIME_PM_BLACKLIST="bb:dd.f 11:22.3 44:55.6"

# Exclude PCI(e) devices assigned to the listed drivers from Runtime PM.
# Default when unconfigured is "amdgpu nouveau nvidia radeon" which
# prevents accidential power-on of dGPU in hybrid graphics setups.
# Use "" to disable the feature completely.
# Separate multiple drivers with spaces.
#RUNTIME_PM_DRIVER_BLACKLIST="amdgpu nouveau nvidia radeon"

# Set to 0 to disable, 1 to enable USB autosuspend feature.
USB_AUTOSUSPEND=1

# Exclude listed devices from USB autosuspend (separate with spaces).
# Use lsusb to get the ids.
# Note: input devices (usbhid) are excluded automatically
#USB_BLACKLIST="1111:2222 3333:4444"

# Bluetooth devices are excluded from USB autosuspend:
#   0=do not exclude, 1=exclude.
USB_BLACKLIST_BTUSB=0

# Phone devices are excluded from USB autosuspend:
#   0=do not exclude, 1=exclude (enable charging).
USB_BLACKLIST_PHONE=1

# Printers are excluded from USB autosuspend:
#   0=do not exclude, 1=exclude.
USB_BLACKLIST_PRINTER=1

# WWAN devices are excluded from USB autosuspend:
#   0=do not exclude, 1=exclude.
USB_BLACKLIST_WWAN=1

# Include listed devices into USB autosuspend even if already excluded
# by the blacklists above (separate with spaces).
# Use lsusb to get the ids.
#USB_WHITELIST="1111:2222 3333:4444"

# Set to 1 to disable autosuspend before shutdown, 0 to do nothing
# (workaround for USB devices that cause shutdown problems).
#USB_AUTOSUSPEND_DISABLE_ON_SHUTDOWN=1

# Restore radio device state (Bluetooth, WiFi, WWAN) from previous shutdown
# on system startup: 0=disable, 1=enable.
# Hint: the parameters DEVICES_TO_DISABLE/ENABLE_ON_STARTUP/SHUTDOWN below
#   are ignored when this is enabled!
RESTORE_DEVICE_STATE_ON_STARTUP=0

# Radio devices to disable on startup: bluetooth, wifi, wwan.
# Separate multiple devices with spaces.
#DEVICES_TO_DISABLE_ON_STARTUP="bluetooth wifi wwan"

# Radio devices to enable on startup: bluetooth, wifi, wwan.
# Separate multiple devices with spaces.
#DEVICES_TO_ENABLE_ON_STARTUP="wifi"

# Radio devices to disable on shutdown: bluetooth, wifi, wwan.
# (workaround for devices that are blocking shutdown).
#DEVICES_TO_DISABLE_ON_SHUTDOWN="bluetooth wifi wwan"

# Radio devices to enable on shutdown: bluetooth, wifi, wwan.
# (to prevent other operating systems from missing radios).
#DEVICES_TO_ENABLE_ON_SHUTDOWN="wwan"

# Radio devices to enable on AC: bluetooth, wifi, wwan.
#DEVICES_TO_ENABLE_ON_AC="bluetooth wifi wwan"

# Radio devices to disable on battery: bluetooth, wifi, wwan.
#DEVICES_TO_DISABLE_ON_BAT="bluetooth wifi wwan"

# Radio devices to disable on battery when not in use (not connected):
#   bluetooth, wifi, wwan.
#DEVICES_TO_DISABLE_ON_BAT_NOT_IN_USE="bluetooth wifi wwan"

# Battery charge thresholds (ThinkPad only, tp-smapi or acpi-call kernel module
# required). Charging starts when the remaining capacity falls below the
# START_CHARGE_THRESH value and stops when exceeding the STOP_CHARGE_THRESH value.
# Main / Internal battery (values in %)
#START_CHARGE_THRESH_BAT0=75
#STOP_CHARGE_THRESH_BAT0=80
# Ultrabay / Slice / Replaceable battery (values in %)
#START_CHARGE_THRESH_BAT1=75
#STOP_CHARGE_THRESH_BAT1=80

# Restore charge thresholds when AC is unplugged: 0=disable, 1=enable.
#RESTORE_THRESHOLDS_ON_BAT=1

# ------------------------------------------------------------------------------
# tlp-rdw - Parameters for the radio device wizard
# Possible devices: bluetooth, wifi, wwan.

# Hints:
# - Parameters are disabled by default, remove the leading # to enable them
# - Separate multiple radio devices with spaces

# Radio devices to disable on connect.
#DEVICES_TO_DISABLE_ON_LAN_CONNECT="wifi wwan"
#DEVICES_TO_DISABLE_ON_WIFI_CONNECT="wwan"
#DEVICES_TO_DISABLE_ON_WWAN_CONNECT="wifi"

# Radio devices to enable on disconnect.
#DEVICES_TO_ENABLE_ON_LAN_DISCONNECT="wifi wwan"
#DEVICES_TO_ENABLE_ON_WIFI_DISCONNECT=""
#DEVICES_TO_ENABLE_ON_WWAN_DISCONNECT=""

# Radio devices to enable/disable when docked.
#DEVICES_TO_ENABLE_ON_DOCK=""
#DEVICES_TO_DISABLE_ON_DOCK=""

# Radio devices to enable/disable when undocked.
#DEVICES_TO_ENABLE_ON_UNDOCK="wifi"
#DEVICES_TO_DISABLE_ON_UNDOCK=""
Sangeppato commented 5 years ago

@liskin All the nvidia modules are blacklisted, but nvidia is still loaded by gnome-shell. I've tried the same configuration of @yawor and I still have the same issue, but apparently I'm not alone. Anyway bbswitch still works great on my system, I'm just experimenting

IngeniousDox commented 5 years ago

Thanks. I can't find anything different in my setup from what you have. For now I'll just live with it, and use the workaround to get stuff working. I was thinking about doing a fresh install at some point, perhaps there is something I'm overlooking. Should I have time for that in the coming weeks, I'll give it a go, and start with testing this on fresh install.

yawor commented 5 years ago

BTW I'm not using Gnome. I'm using Cinnamon with LightDM. I've also had issues with nvidia module being loaded by the display manager but the AutoAddGPU set to off fixed that for me. Maybe Gnome Shell does something which loads nvidia module anyway.

Sangeppato commented 5 years ago

@yawor Yeah this is probably gnome related, other people have reported the same issue on the Arch forum.. BTW I'm curious: was bbswitch already broken for you on a fresh install without TLP and/or Powertop installed at all? As far as I've understood bbswitch uses a different way to turn off the GPU and this could interfere with the new PM method if something like tlp or powertop is used, but it should still work if used alone right? It just feels strange that it's broken on the 9570 since it works on the 9550 and 9560 (same GPU).

yawor commented 5 years ago

@Sangeppato bbswitch method is not compatible with XPS 9570 at all. It doesn't matter if tlp or powertop is installed or not. It says it turned off the card, the card becomes unresponsive but it still draws power. After that a reboot is needed to use the card again.

KarthikNayak commented 5 years ago

@yawor I followed the steps mentioned here https://wiki.archlinux.org/index.php/Dell_XPS_15_9570#Graphics and also tried the configs you've posted above. Yet, running optirun is giving

optirun glxspheres64 [ 13.534110] [ERROR]Cannot access secondary GPU - error: Could not enable discrete graphics card

[ 13.534189] [ERROR]Aborting because fallback start is disabled.

I'm totally lost about what to do here, could you help me out or even point in the right direction.

Sangeppato commented 5 years ago

@KarthikNayak Have you got tlp or powertop installed? what's the output of dmesg | grep power after you've tried using optirun?

KarthikNayak commented 5 years ago

@Sangeppato Yes, i've got both installed! I'm using the config for tlp that @yawor put up. I've added all the info below.

❯ dmesg | grep power
[    2.140375] usb: port power management may be unreliable
[   11.103914] wlp59s0: Limiting TX power to 17 (17 - 0) dBm as advertised by 90:72:40:26:55:4d
[   21.306093] pci 0000:01:00.0: Refused to change power state, currently in D3
[ 5968.158891] pci 0000:01:00.0: Refused to change power state, currently in D3
[ 5971.809242] Modules linked in: fuse rfcomm 8021q garp mrp stp llc ccm snd_hda_codec_hdmi bnep snd_hda_codec_realtek snd_hda_codec_generic hid_multitouch hid_generic btusb btrtl btbcm btintel bluetooth cdc_acm ecdh_generic mei_wdt iTCO_wdt iTCO_vendor_support joydev mousedev arc4 i915 nls_iso8859_1 nls_cp437 vfat fat intel_rapl ath10k_pci x86_pkg_temp_thermal intel_powerclamp ath10k_core kvm_intel kvmgt vfio_mdev mdev vfio_iommu_type1 vfio ath kvm mac80211 irqbypass i2c_algo_bit crct10dif_pclmul drm_kms_helper crc32_pclmul dell_laptop ghash_clmulni_intel dell_wmi snd_hda_intel dell_smbios mxm_wmi drm idma64 intel_wmi_thunderbolt wmi_bmof snd_hda_codec cfg80211 dell_wmi_descriptor input_leds dcdbas snd_hda_core aesni_intel snd_hwdep psmouse intel_gtt aes_x86_64 mei_me snd_pcm crypto_simd cryptd agpgart glue_helper syscopyarea intel_cstate snd_timer tpm_crb intel_uncore snd i2c_hid ucsi_acpi rtsx_pci_ms sysfillrect typec_ucsi sysimgblt intel_rapl_perf pcspkr soundcore rfkill mei
[ 5971.809378] Modules linked in: fuse rfcomm 8021q garp mrp stp llc ccm snd_hda_codec_hdmi bnep snd_hda_codec_realtek snd_hda_codec_generic hid_multitouch hid_generic btusb btrtl btbcm btintel bluetooth cdc_acm ecdh_generic mei_wdt iTCO_wdt iTCO_vendor_support joydev mousedev arc4 i915 nls_iso8859_1 nls_cp437 vfat fat intel_rapl ath10k_pci x86_pkg_temp_thermal intel_powerclamp ath10k_core kvm_intel kvmgt vfio_mdev mdev vfio_iommu_type1 vfio ath kvm mac80211 irqbypass i2c_algo_bit crct10dif_pclmul drm_kms_helper crc32_pclmul dell_laptop ghash_clmulni_intel dell_wmi snd_hda_intel dell_smbios mxm_wmi drm idma64 intel_wmi_thunderbolt wmi_bmof snd_hda_codec cfg80211 dell_wmi_descriptor input_leds dcdbas snd_hda_core aesni_intel snd_hwdep psmouse intel_gtt aes_x86_64 mei_me snd_pcm crypto_simd cryptd agpgart glue_helper syscopyarea intel_cstate snd_timer tpm_crb intel_uncore snd i2c_hid ucsi_acpi rtsx_pci_ms sysfillrect typec_ucsi sysimgblt intel_rapl_perf pcspkr soundcore rfkill mei
[ 5977.115882] wlp59s0: Limiting TX power to 30 (30 - 0) dBm as advertised by 90:72:40:26:55:4c

~ 0.000003h 0.000167m 
❯ sudo optirun glxspheres64
[sudo] password for karthik: 
[ 6018.649222] [ERROR]Cannot access secondary GPU - error: [XORG] (EE) NVIDIA(GPU-0): Failed to initialize the NVIDIA GPU at PCI:1:0:0.  Please

[ 6018.649276] [ERROR]Aborting because fallback start is disabled.

~ 0.000042d 0.001009h 0.060533m 
❯ dmesg | grep power
[    2.140375] usb: port power management may be unreliable
[   11.103914] wlp59s0: Limiting TX power to 17 (17 - 0) dBm as advertised by 90:72:40:26:55:4d
[   21.306093] pci 0000:01:00.0: Refused to change power state, currently in D3
[ 5968.158891] pci 0000:01:00.0: Refused to change power state, currently in D3
[ 5971.809242] Modules linked in: fuse rfcomm 8021q garp mrp stp llc ccm snd_hda_codec_hdmi bnep snd_hda_codec_realtek snd_hda_codec_generic hid_multitouch hid_generic btusb btrtl btbcm btintel bluetooth cdc_acm ecdh_generic mei_wdt iTCO_wdt iTCO_vendor_support joydev mousedev arc4 i915 nls_iso8859_1 nls_cp437 vfat fat intel_rapl ath10k_pci x86_pkg_temp_thermal intel_powerclamp ath10k_core kvm_intel kvmgt vfio_mdev mdev vfio_iommu_type1 vfio ath kvm mac80211 irqbypass i2c_algo_bit crct10dif_pclmul drm_kms_helper crc32_pclmul dell_laptop ghash_clmulni_intel dell_wmi snd_hda_intel dell_smbios mxm_wmi drm idma64 intel_wmi_thunderbolt wmi_bmof snd_hda_codec cfg80211 dell_wmi_descriptor input_leds dcdbas snd_hda_core aesni_intel snd_hwdep psmouse intel_gtt aes_x86_64 mei_me snd_pcm crypto_simd cryptd agpgart glue_helper syscopyarea intel_cstate snd_timer tpm_crb intel_uncore snd i2c_hid ucsi_acpi rtsx_pci_ms sysfillrect typec_ucsi sysimgblt intel_rapl_perf pcspkr soundcore rfkill mei
[ 5971.809378] Modules linked in: fuse rfcomm 8021q garp mrp stp llc ccm snd_hda_codec_hdmi bnep snd_hda_codec_realtek snd_hda_codec_generic hid_multitouch hid_generic btusb btrtl btbcm btintel bluetooth cdc_acm ecdh_generic mei_wdt iTCO_wdt iTCO_vendor_support joydev mousedev arc4 i915 nls_iso8859_1 nls_cp437 vfat fat intel_rapl ath10k_pci x86_pkg_temp_thermal intel_powerclamp ath10k_core kvm_intel kvmgt vfio_mdev mdev vfio_iommu_type1 vfio ath kvm mac80211 irqbypass i2c_algo_bit crct10dif_pclmul drm_kms_helper crc32_pclmul dell_laptop ghash_clmulni_intel dell_wmi snd_hda_intel dell_smbios mxm_wmi drm idma64 intel_wmi_thunderbolt wmi_bmof snd_hda_codec cfg80211 dell_wmi_descriptor input_leds dcdbas snd_hda_core aesni_intel snd_hwdep psmouse intel_gtt aes_x86_64 mei_me snd_pcm crypto_simd cryptd agpgart glue_helper syscopyarea intel_cstate snd_timer tpm_crb intel_uncore snd i2c_hid ucsi_acpi rtsx_pci_ms sysfillrect typec_ucsi sysimgblt intel_rapl_perf pcspkr soundcore rfkill mei
[ 5977.115882] wlp59s0: Limiting TX power to 30 (30 - 0) dBm as advertised by 90:72:40:26:55:4c

~ 0.000003h 0.000167m 
❯ sudo systemctl status bumblebeed.service
● bumblebeed.service - Bumblebee C Daemon
   Loaded: loaded (/usr/lib/systemd/system/bumblebeed.service; enabled; vendor preset: disabled)
   Active: active (running) since Sat 2019-01-12 20:17:08 EST; 1h 42min ago
 Main PID: 871 (bumblebeed)
    Tasks: 1 (limit: 4915)
   Memory: 42.7M
   CGroup: /system.slice/bumblebeed.service
           └─871 /usr/bin/bumblebeed --use-syslog

Jan 12 21:58:46 xps bumblebeed[871]: [XORG] (EE) NVIDIA(GPU-0): Failed to initialize the NVIDIA graphics device!
Jan 12 21:58:46 xps bumblebeed[871]: [XORG] (EE) NVIDIA(0): Failing initialization of X screen 0
Jan 12 21:58:46 xps bumblebeed[871]: [XORG] (EE) Screen(s) found, but none have a usable configuration.
Jan 12 21:58:46 xps bumblebeed[871]: [XORG] (EE)
Jan 12 21:58:46 xps bumblebeed[871]: [XORG] (EE) no screens found(EE)
Jan 12 21:58:46 xps bumblebeed[871]: [XORG] (EE)
Jan 12 21:58:46 xps bumblebeed[871]: [XORG] (EE) Please also check the log file at "/var/log/Xorg.8.log" for additional information.
Jan 12 21:58:46 xps bumblebeed[871]: [XORG] (EE)
Jan 12 21:58:46 xps bumblebeed[871]: [XORG] (EE) Server terminated with error (1). Closing log file.
Jan 12 21:58:46 xps bumblebeed[871]: X did not start properly

~ 0.000284d 0.006819h 0.409117m 24.547s 
❯ cat /var/log/Xorg.8.log
[  6018.038] 
X.Org X Server 1.20.3
X Protocol Version 11, Revision 0
[  6018.038] Build Operating System: Linux Arch Linux
[  6018.038] Current Operating System: Linux xps 4.20.0-arch1-1-ARCH #1 SMP PREEMPT Mon Dec 24 03:00:40 UTC 2018 x86_64
[  6018.038] Kernel command line: initrd=\intel-ucode.img initrd=\initramfs-linux.img resume=/dev/mapper/arch--lvm-arch--swap root=/dev/mapper/arch--lvm-arch--root rw quiet mem_sleep_default=deep
[  6018.038] Build Date: 25 October 2018  04:42:32PM
[  6018.038]  
[  6018.038] Current version of pixman: 0.36.0
[  6018.038]    Before reporting problems, check http://wiki.x.org
    to make sure that you have the latest version.
[  6018.038] Markers: (--) probed, (**) from config file, (==) default setting,
    (++) from command line, (!!) notice, (II) informational,
    (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
[  6018.038] (==) Log file: "/var/log/Xorg.8.log", Time: Sat Jan 12 21:58:46 2019
[  6018.039] (++) Using config file: "/etc/bumblebee/xorg.conf.nvidia"
[  6018.039] (++) Using config directory: "/etc/bumblebee/xorg.conf.d"
[  6018.039] (==) Using system config directory "/usr/share/X11/xorg.conf.d"
[  6018.039] (==) ServerLayout "Layout0"
[  6018.040] (==) No screen section available. Using defaults.
[  6018.040] (**) |-->Screen "Default Screen Section" (0)
[  6018.040] (**) |   |-->Monitor "<default monitor>"
[  6018.040] (==) No device specified for screen "Default Screen Section".
    Using the first device section listed.
[  6018.040] (**) |   |-->Device "DiscreteNvidia"
[  6018.040] (==) No monitor specified for screen "Default Screen Section".
    Using a default monitor configuration.
[  6018.040] (**) Option "IgnoreABI" "1"
[  6018.040] (**) Option "AutoAddDevices" "false"
[  6018.040] (**) Option "AutoAddGPU" "false"
[  6018.040] (**) Ignoring ABI Version
[  6018.040] (**) Not automatically adding devices
[  6018.040] (==) Automatically enabling devices
[  6018.040] (**) Not automatically adding GPU devices
[  6018.040] (==) Automatically binding GPU devices
[  6018.040] (==) Max clients allowed: 256, resource mask: 0x1fffff
[  6018.040] (WW) The directory "/usr/share/fonts/Type1" does not exist.
[  6018.040]    Entry deleted from font path.
[  6018.040] (WW) `fonts.dir' not found (or not valid) in "/usr/share/fonts/100dpi".
[  6018.040]    Entry deleted from font path.
[  6018.040]    (Run 'mkfontdir' on "/usr/share/fonts/100dpi").
[  6018.040] (WW) `fonts.dir' not found (or not valid) in "/usr/share/fonts/75dpi".
[  6018.040]    Entry deleted from font path.
[  6018.040]    (Run 'mkfontdir' on "/usr/share/fonts/75dpi").
[  6018.040] (==) FontPath set to:
    /usr/share/fonts/misc,
    /usr/share/fonts/TTF,
    /usr/share/fonts/OTF
[  6018.040] (++) ModulePath set to "/usr/lib/nvidia/xorg/,/usr/lib/xorg/modules"
[  6018.040] (==) |-->Input Device "<default pointer>"
[  6018.040] (==) |-->Input Device "<default keyboard>"
[  6018.040] (==) The core pointer device wasn't specified explicitly in the layout.
    Using the default mouse configuration.
[  6018.040] (==) The core keyboard device wasn't specified explicitly in the layout.
    Using the default keyboard configuration.
[  6018.040] (II) Module ABI versions:
[  6018.040]    X.Org ANSI C Emulation: 0.4
[  6018.040]    X.Org Video Driver: 24.0
[  6018.040]    X.Org XInput driver : 24.1
[  6018.040]    X.Org Server Extension : 10.0
[  6018.041] (--) using VT number 1

[  6018.041] (II) systemd-logind: logind integration requires -keeptty and -keeptty was not provided, disabling logind integration
[  6018.042] (II) xfree86: Adding drm device (/dev/dri/card0)
[  6018.042] (EE) /dev/dri/card0: failed to set DRM interface version 1.4: Permission denied
[  6018.043] (--) PCI:*(1@0:0:0) 10de:1c8c:1028:087c rev 161, Mem @ 0xec000000/16777216, 0xc0000000/268435456, 0xd0000000/33554432, I/O @ 0x00003000/128, BIOS @ 0x????????/524288
[  6018.043] (II) Open ACPI successful (/var/run/acpid.socket)
[  6018.043] (II) LoadModule: "glx"
[  6018.043] (II) Loading /usr/lib/xorg/modules/extensions/libglx.so
[  6018.044] (II) Module glx: vendor="X.Org Foundation"
[  6018.044]    compiled for 1.20.3, module version = 1.0.0
[  6018.044]    ABI class: X.Org Server Extension, version 10.0
[  6018.044] (II) LoadModule: "nvidia"
[  6018.044] (II) Loading /usr/lib/xorg/modules/drivers/nvidia_drv.so
[  6018.058] (II) Module nvidia: vendor="NVIDIA Corporation"
[  6018.058]    compiled for 4.0.2, module version = 1.0.0
[  6018.058]    Module class: X.Org Video Driver
[  6018.058] (II) LoadModule: "mouse"
[  6018.058] (WW) Warning, couldn't open module mouse
[  6018.058] (EE) Failed to load module "mouse" (module does not exist, 0)
[  6018.058] (II) LoadModule: "kbd"
[  6018.058] (WW) Warning, couldn't open module kbd
[  6018.059] (EE) Failed to load module "kbd" (module does not exist, 0)
[  6018.059] (II) NVIDIA dlloader X Driver  415.25  Wed Dec 12 10:05:51 CST 2018
[  6018.059] (II) NVIDIA Unified Driver for all Supported NVIDIA GPUs
[  6018.060] (II) Loading sub module "fb"
[  6018.060] (II) LoadModule: "fb"
[  6018.060] (II) Loading /usr/lib/xorg/modules/libfb.so
[  6018.062] (II) Module fb: vendor="X.Org Foundation"
[  6018.062]    compiled for 1.20.3, module version = 1.0.0
[  6018.062]    ABI class: X.Org ANSI C Emulation, version 0.4
[  6018.062] (II) Loading sub module "wfb"
[  6018.062] (II) LoadModule: "wfb"
[  6018.062] (II) Loading /usr/lib/xorg/modules/libwfb.so
[  6018.064] (II) Module wfb: vendor="X.Org Foundation"
[  6018.064]    compiled for 1.20.3, module version = 1.0.0
[  6018.064]    ABI class: X.Org ANSI C Emulation, version 0.4
[  6018.064] (II) Loading sub module "ramdac"
[  6018.064] (II) LoadModule: "ramdac"
[  6018.064] (II) Module "ramdac" already built-in
[  6018.065] (II) NVIDIA(0): Creating default Display subsection in Screen section
    "Default Screen Section" for depth/fbbpp 24/32
[  6018.065] (==) NVIDIA(0): Depth 24, (==) framebuffer bpp 32
[  6018.065] (==) NVIDIA(0): RGB weight 888
[  6018.065] (==) NVIDIA(0): Default visual is TrueColor
[  6018.065] (==) NVIDIA(0): Using gamma correction (1.0, 1.0, 1.0)
[  6018.066] (**) NVIDIA(0): Option "ProbeAllGpus" "false"
[  6018.066] (**) NVIDIA(0): Option "UseEDID" "false"
[  6018.066] (**) NVIDIA(0): Option "UseDisplayDevice" "none"
[  6018.066] (**) NVIDIA(0): Enabling 2D acceleration
[  6018.066] (**) NVIDIA(0): Ignoring EDIDs
[  6018.066] (**) NVIDIA(0): Option "UseDisplayDevice" set to "none"; enabling NoScanout
[  6018.066] (**) NVIDIA(0):     mode
[  6018.066] (II) Loading sub module "glxserver_nvidia"
[  6018.066] (II) LoadModule: "glxserver_nvidia"
[  6018.066] (II) Loading /usr/lib/nvidia/xorg/libglxserver_nvidia.so
[  6018.100] (II) Module glxserver_nvidia: vendor="NVIDIA Corporation"
[  6018.100]    compiled for 4.0.2, module version = 1.0.0
[  6018.100]    Module class: X.Org Server Extension
[  6018.101] (II) NVIDIA GLX Module  415.25  Wed Dec 12 10:05:39 CST 2018
[  6018.646] (EE) NVIDIA(GPU-0): Failed to initialize the NVIDIA GPU at PCI:1:0:0.  Please
[  6018.646] (EE) NVIDIA(GPU-0):     check your system's kernel log for additional error
[  6018.646] (EE) NVIDIA(GPU-0):     messages and refer to Chapter 8: Common Problems in the
[  6018.646] (EE) NVIDIA(GPU-0):     README for additional information.
[  6018.646] (EE) NVIDIA(GPU-0): Failed to initialize the NVIDIA graphics device!
[  6018.646] (EE) NVIDIA(0): Failing initialization of X screen 0
[  6018.646] (II) UnloadModule: "nvidia"
[  6018.646] (II) UnloadSubModule: "glxserver_nvidia"
[  6018.646] (II) Unloading glxserver_nvidia
[  6018.646] (II) UnloadSubModule: "wfb"
[  6018.646] (II) UnloadSubModule: "fb"
[  6018.646] (EE) Screen(s) found, but none have a usable configuration.
[  6018.646] (EE) 
Fatal server error:
[  6018.646] (EE) no screens found(EE) 
[  6018.646] (EE) 
Please consult the The X.Org Foundation support 
     at http://wiki.x.org
 for help. 
[  6018.646] (EE) Please also check the log file at "/var/log/Xorg.8.log" for additional information.
[  6018.646] (EE) 
[  6018.646] (EE) Server terminated with error (1). Closing log file.
Sangeppato commented 5 years ago

@KarthikNayak could you try to completely uninstall tlp, powertop and laptop-mode-tools (and remove every conf about power management, in particular check if you have a pci_pm.rules rule in either /etc/udev/rules.d, /usr/lib/udev/rules.d or /lib/udev/rules.d) and then reboot a couple of times? Does optirun work?

KarthikNayak commented 5 years ago

@Sangeppato Thanks! there are no power management files in those directories. Tried completely removing the tools mentioned too. Maybe I'm missing a step, I have a free day, will do a clean install and note down everything. Will get back here with results!

EDIT: Clean install fixed everything! :D

chriscjs commented 5 years ago

With this method vlc turns on the dgpu every time I watch a video. I do not use optirun to call vlc. Any idea on how to keep this from happening? In the terminal output vlc says its using intel iHD driver for hardware decoding, not vdpau.

haarp commented 4 years ago

Unloading the Nvidia module might not be necessary anymore on Turing or newer GPUs.

As per https://download.nvidia.com/XFree86/Linux-x86_64/440.44/README/dynamicpowermanagement.html, loading the module with NVreg_DynamicPowerManagement=0x02 and setting PCI power management to auto should do the trick. If that doesn't work, it's probaly due to kernel bugs that prevent it from powering down when USB/sound devices are present within the GPU. This was the case for me. These can be unbound to make it work.