JackHack96 / dell-xps-9570-ubuntu-respin

Collection of scripts and tweaks to adapt Ubuntu running smooth on Dell XPS 15 9570.
999 stars 113 forks source link

prime-select intel high idle watts, use bbswitch to turn card off #50

Closed mdevrees closed 5 years ago

mdevrees commented 5 years ago

Hi to all reading this,

I downloaded your already respun ISO and installed everything. Switched the prime-select query to intel (it was displaying nvidia) but the idle watt usage in Powertop was still high (around ~12W-15W ish). I saw the installationg of bbswitch coming along in the xps-tweaks.sh script.

By default bbswitch is not initialized at boot, but you can do so via sudo modprobe bbswitch and then it will create a file called /proc/acpi/bbswitch with value 0000:01:00.0 ON. Since the prime-select is now intel, it should not use the nvidia driver and you should be able to turn it off with

sudo tee /proc/acpi/bbswitch <<<OFF

You can also create a modprobe file (sudo touch /etc/modprobe.d/bbswitch.conf) and add

options bbswitch load_state=0 unload_state=1

which will turn it off on load (the loading of the module) and turn it on on unload (the unloading of the module at computer off for example).

For some reason I cannot get bbswitch to load on computer start, but I don't mind using sudo modprobe bbswitch on every boot.

My machine has an i7 8550H with 16GB of ram and the 1080p screen, non-touch. On 50% brightness, idle watts are now around 7W

JackHack96 commented 5 years ago

Uhm that's strange, normally bbswitch should not be needed for powering off the nvidia card, it should be automatic with prime-select.

mdevrees commented 5 years ago

Yes it is. While prime-select is set to Intel, it still leaves the card 'on' I googled around a bit and found this comment created by github user tvld, basically checking if the card is set to 'on' in /sys/bus/pci/devices/0000\:01\:00.0/power/control. I created the systemctl startup script:

sudo nano /lib/systemd/system/gpuoff.service
[Unit]
Description=Power-off gpu

[Service]
Type=oneshot
ExecStart=/bin/bash -c "if [[ `prime-select query` == 'intel' ]]; then echo auto > /sys/bus/pci/devices/0000\:01\:00.0/power/control; fi"

[Install]
WantedBy=default.target

ran it to test sudo systemctl start gpuoff.service and now the output was

$ cat /sys/bus/pci/devices/0000\:01\:00.0/power/control
auto

so now I set the script to be started on boot: sudo systemctl enable gpuoff.service and now powertop: The battery reports a discharge rate of 7.66 W and sometimes even lower, around 5W or 6W. Without bbswitch enabled (as /proc/acpi/bbswitch does not exist)