Bug 3240

Summary: bbswitch-kmod
Product: Package Reviews Reporter: leigh scott <leigh123linux>
Component: Review RequestAssignee: Nicolas Chauvet <kwizart>
Status: RESOLVED WONTFIX    
Severity: normal CC: fedora, negativo17, rpmfusion-package-review
Priority: P5    
Version: Current   
Hardware: All   
OS: GNU/Linux   
namespace:

Description leigh scott 2014-05-16 19:16:02 CEST
SPEC: http://leigh123linux.fedorapeople.org/pub/review/bbswitch/1/bbswitch-kmod.spec

SRPM: http://leigh123linux.fedorapeople.org/pub/review/bbswitch/1/bbswitch-kmod-0.8-1.fc20.src.rpm

Suitable for rpmfusion-free.


bbswitch is a kernel module which automatically detects the required ACPI calls for two kinds of Optimus laptops. It has been verified to work with "real" Optimus and "legacy" Optimus laptops (at least, that is how I call them). The machines on which these tests has performed are:

    Clevo B7130 - GT 425M ("real" Optimus, Lekensteyns laptop)
    Dell Vostro 3500 - GT 310M ("legacy" Optimus, Samsagax' laptop)

(note: there is no need to add more supported laptops here as the universal calls should work for every laptop model supporting either Optimus calls)

It's preferred over manually hacking with the acpi_call module because it can detect the correct handle preceding _DSM and has some built-in safeguards:

    You're not allowed to disable a card if a driver (nouveau, nvidia) is loaded.
    Before suspend, the card is automatically enabled. When resuming, it's disabled again if that was the case before suspending. Hibernation should work, but it not tested.

Precautionary measure :

    On some machines, turning off the card is permanent and the card does not reappear on subsequents reboots, which can result into the screen staying black all the time, including the BIOS screen. If it occurs, first try to shutdown, unplug power cord, remove battery, wait 30s, then put everything back in and boot. If it's not solved, then the solution is to reset the BIOS to factory settings. Before executing bbswitch for the first time, it is therefore recommended to take note of the full key sequence in the BIOS to do a reset.

https://github.com/Bumblebee-Project/bbswitch
Comment 1 Nicolas Chauvet 2014-05-16 20:58:00 CEST
I'm taking over this one as I'm still uncertain about bumbleble
Comment 2 leigh scott 2014-05-17 13:29:21 CEST
(In reply to comment #1)
> I'm taking over this one as I'm still uncertain about bumbleble

I'm not sure that I'm even going to package bumblebee yet.
bbswitch as I understand it has the ability to disable the unused card without bumblebee.

http://ubuntuguide.net/turn-off-discrete-nvidia-optimus-graphics-card-ubuntu

I believe this would be useful for users to prevent heat issues.
Comment 3 Nicolas Chauvet 2014-05-17 13:31:47 CEST
(In reply to comment #2)
...
> I believe this would be useful for users to prevent heat issues.
I believed this was fixed with kernel 3.13 (using nouveau).
Do you have any hardware to test it ?
Comment 4 leigh scott 2014-05-17 13:48:11 CEST
(In reply to comment #3)
> (In reply to comment #2)
> ...
> > I believe this would be useful for users to prevent heat issues.
> I believed this was fixed with kernel 3.13 (using nouveau).
> Do you have any hardware to test it ?


Sorry I don't, I sure I've seen recent complaints on fedoraforum.
Comment 5 Wolfgang Ulbrich 2014-05-17 15:02:12 CEST
The bbswitch mod has nothing to do with bumblebee itself, it's only the name.
With early version of bumblebee there was no bbswich mod and i used the original VGA switcheroo from David Airlie.
http://linux-hybrid-graphics.blogspot.de/2010/10/vga-switcheroo-and-acpicall-status-so.html
http://hybrid-graphics-linux.tuxfamily.org/index.php?title=Main_Page
Later this mod called acpi_call
Those works was adopted after for the bbswitch mod.

I'm not shure if the prime kernel implementation with 3.13 does the same.
I never test it because of missing Guides, and it is only for the nouveau driver.

But the bbswitch mod is very useful for users like me, whose only watching hd-videos, using compiz on a notebook and don't play games.
For this profile i don't need the discrete nvidia card. The integrated intel card does his job well for this case and it is pretty useful to switch off the discrete card to decrease power consumption.

PS: if something needs to test notify me.
Comment 6 Thorsten Leemhuis 2014-05-18 18:01:16 CEST
(In reply to comment #5)

> I'm not shure if the prime kernel implementation with 3.13 does the same.
> I never test it because of missing Guides, and it is only for the nouveau
> driver.

Yes, guides are a problem. Maybe some of what is described for radeon in 
https://wiki.archlinux.org/index.php/hybrid_graphics
might be applicable to nvidia gpus as well; not sure if you need nouveau or not.
Comment 7 Simone Caronni 2014-05-19 15:44:30 CEST
Hello,

bbswitch does not save any power if you are using an Optimus enabled laptop with the Nvidia driver.

I have an Optimus laptop that I use everyday at work. I've written a guide for Fedora 19 to use and configure the dual card setup:

http://negativo17.org/complex-setup-with-nvidia-optimus-nouveau-prime-on-fedora-19-2/

The guide is pretty much the same for Fedora 20, only the config file for offload rendering in Nvidia is slightly different.

The bbswitch module is needed only if:

- Optimus is enabled in your bios
- The system has loaded the Nvidia drivers (it disables vga_switcheroo)

But unfortunately, to use it, you have to shutdown X, move Nvidia libraries out of the way, delete the X.org config file, echo the bbswitch proc file and restart X. This is what the customized Nvidia settings panel in Ubuntu does.

Another negative effect, is that with Nvidia and Intel, none of the card is powered down and output displays management with xrandr is all messed up. If you power off the Nvidia chip, there is no way to use the additional outputs without restarting X.

If you are using the out-of the box experience of Fedora/RHEL, vga_switcheroo is enabled (Nouveau drivers) and if there is no output connected to the Nvidia chip, it is shutdown automatically. Even running a simple "xrandr -q" powers up and down the discrete chip. Also monitor layout is consistent and adjustable with any xrandr tool.

Basically with Nouveau/Prime, the Nvidia chip is always off unless you call it explicitly with the DRI_PRIME=1 variable or connect an output of the card.
Comment 8 Simone Caronni 2014-05-19 15:46:29 CEST
(In reply to comment #5)
> I'm not shure if the prime kernel implementation with 3.13 does the same.
> I never test it because of missing Guides, and it is only for the nouveau
> driver.
> 
> But the bbswitch mod is very useful for users like me, whose only watching
> hd-videos, using compiz on a notebook and don't play games.
> For this profile i don't need the discrete nvidia card. The integrated intel
> card does his job well for this case and it is pretty useful to switch off the
> discrete card to decrease power consumption.

Starting with 3.12, you should have the discrete card already off with stock Fedora components (Nouveau, Radeon, Intel, Mesa).

Just check the content of /sys/kernel/debug/vgaswitcheroo/switch, you should see "Off" or "DynPwr" for the discrete chip.
Comment 9 Wolfgang Ulbrich 2014-05-21 15:35:56 CEST
(In reply to comment #8)
> (In reply to comment #5)
> > I'm not shure if the prime kernel implementation with 3.13 does the same.
> > I never test it because of missing Guides, and it is only for the nouveau
> > driver.
> > 
> > But the bbswitch mod is very useful for users like me, whose only watching
> > hd-videos, using compiz on a notebook and don't play games.
> > For this profile i don't need the discrete nvidia card. The integrated intel
> > card does his job well for this case and it is pretty useful to switch off the
> > discrete card to decrease power consumption.
> 
> Starting with 3.12, you should have the discrete card already off with stock
> Fedora components (Nouveau, Radeon, Intel, Mesa).
> 
> Just check the content of /sys/kernel/debug/vgaswitcheroo/switch, you should
> see "Off" or "DynPwr" for the discrete chip.

I do not have this directory.
[root@satellite rave]# ls /sys/kernel/debug/
acpi  bluetooth    cleancache  dma_buf  dynamic_debug  frontswap  hid        ips      kprobes  mce  pinctrl  sched_features  suspend_stats  usb             x86
bdi   boot_params  clk         dri      extfrag        gpio       ieee80211  iwlwifi  kvm      mei  regmap   sleep_time      tracing        wakeup_sources  xen

[root@satellite rave]# rpm -qa kernel\*
kernel-3.14.2-200.fc20.x86_64
kernel-modules-extra-3.12.6-300.fc20.x86_64
kernel-modules-extra-3.14.2-200.fc20.x86_64
kernel-3.12.6-300.fc20.x86_64
kernel-devel-3.14.2-200.fc20.x86_64
kernel-3.12.5-302.fc20.x86_64
kernel-headers-3.14.2-200.fc20.x86_64
kernel-modules-extra-3.12.5-302.fc20.x86_64
kernel-devel-3.12.5-302.fc20.x86_64
kernel-devel-3.12.6-300.fc20.x86_64

kernel 3.14.2 is running and nouveau mod is loaded, in result the unneeded discrete nvidia card is running without bbswitch mod.
Maybe there is a needed package not installed?
Note, in my notebook (MSI fx700) bios i don't have an option to switch/power off graphic cards.
Comment 10 Simone Caronni 2014-05-21 15:49:05 CEST
(In reply to comment #9)
> I do not have this directory.
> [root@satellite rave]# ls /sys/kernel/debug/
> acpi  bluetooth    cleancache  dma_buf  dynamic_debug  frontswap  hid       
> ips      kprobes  mce  pinctrl  sched_features  suspend_stats  usb            
> x86
> bdi   boot_params  clk         dri      extfrag        gpio       ieee80211 
> iwlwifi  kvm      mei  regmap   sleep_time      tracing        wakeup_sources 
> xen

That's strange. It disappears only if you're not using a dual card setup with free drivers; for example loading nvidia.ko makes vga_switcheroo to disappear; hence the need for bbswitch.

Can you do the following and paste the output?

"lspci | grep -i vga"
"dmesg | grep -i vga"
"lsmod | egrep "i915|nouveau"
Comment 11 Wolfgang Ulbrich 2014-05-21 16:32:51 CEST
(In reply to comment #10)
> (In reply to comment #9)
> That's strange. It disappears only if you're not using a dual card setup with
> free drivers; for example loading nvidia.ko makes vga_switcheroo to disappear;
> hence the need for bbswitch.
> 
> Can you do the following and paste the output?
> 
> "lspci | grep -i vga"
> "dmesg | grep -i vga"
> "lsmod | egrep "i915|nouveau"
[rave@satellite ~]$ lspci | grep -i vga
00:02.0 VGA compatible controller: Intel Corporation Core Processor Integrated Graphics Controller (rev 02)
01:00.0 VGA compatible controller: NVIDIA Corporation GF108M [GeForce GT 425M] (rev a1)
[rave@satellite ~]$ dmesg | grep -i vga
[    0.000000] Console: colour VGA+ 80x25
[    0.725179] vgaarb: device added: PCI:0000:00:02.0,decodes=io+mem,owns=io+mem,locks=none
[    0.725327] vgaarb: device added: PCI:0000:01:00.0,decodes=io+mem,owns=none,locks=none
[    0.725471] vgaarb: loaded
[    0.725560] vgaarb: bridge control possible 0000:01:00.0
[    0.725655] vgaarb: no bridge control possible 0000:00:02.0
[    2.816980] vgaarb: device changed decodes: PCI:0000:00:02.0,olddecodes=io+mem,decodes=none:owns=none
[rave@satellite ~]$ lsmod | egrep "i915|nouveau"
nouveau              1156970  0 
i915                  796218  8 
mxm_wmi                12865  1 nouveau
ttm                    80614  1 nouveau
i2c_algo_bit           13257  2 i915,nouveau
drm_kms_helper         50652  2 i915,nouveau
drm                   283747  6 ttm,i915,drm_kms_helper,nouveau
i2c_core               38656  7 drm,i915,i2c_i801,drm_kms_helper,i2c_algo_bit,nouveau,videodev
video                  19261  2 i915,nouveau
wmi                    18804  3 msi_wmi,mxm_wmi,nouveau
Comment 12 Simone Caronni 2014-05-21 17:05:35 CEST
(In reply to comment #11)
> [rave@satellite ~]$ dmesg | grep -i vga
> [    0.000000] Console: colour VGA+ 80x25
> [    0.725179] vgaarb: device added:
> PCI:0000:00:02.0,decodes=io+mem,owns=io+mem,locks=none
> [    0.725327] vgaarb: device added:
> PCI:0000:01:00.0,decodes=io+mem,owns=none,locks=none
> [    0.725471] vgaarb: loaded
> [    0.725560] vgaarb: bridge control possible 0000:01:00.0
> [    0.725655] vgaarb: no bridge control possible 0000:00:02.0

There's something missing... you should get something like the following just after:

vgaarb: device changed decodes: PCI:0000:00:02.0,olddecodes=io+mem,decodes=none:owns=io+mem
vgaarb: transferring owner from PCI:0000:00:02.0 to PCI:0000:01:00.0
vgaarb: device changed decodes: PCI:0000:01:00.0,olddecodes=io+mem,decodes=none:owns=none

Or a message (don't have here at the moment) saying that vgaarb was disabled for any reason.
Comment 13 Wolfgang Ulbrich 2014-05-21 17:14:31 CEST
(In reply to comment #12)
> There's something missing... you should get something like the following just
> after:
> 
> vgaarb: device changed decodes:
> PCI:0000:00:02.0,olddecodes=io+mem,decodes=none:owns=io+mem
> vgaarb: transferring owner from PCI:0000:00:02.0 to PCI:0000:01:00.0
> vgaarb: device changed decodes:
> PCI:0000:01:00.0,olddecodes=io+mem,decodes=none:owns=none
> 
> Or a message (don't have here at the moment) saying that vgaarb was disabled
> for any reason.

No, that was the complete output.
[rave@satellite ~]$ dmesg | grep -i vga
[    0.000000] Console: colour VGA+ 80x25
[    0.725179] vgaarb: device added: PCI:0000:00:02.0,decodes=io+mem,owns=io+mem,locks=none
[    0.725327] vgaarb: device added: PCI:0000:01:00.0,decodes=io+mem,owns=none,locks=none
[    0.725471] vgaarb: loaded
[    0.725560] vgaarb: bridge control possible 0000:01:00.0
[    0.725655] vgaarb: no bridge control possible 0000:00:02.0
[    2.816980] vgaarb: device changed decodes: PCI:0000:00:02.0,olddecodes=io+mem,decodes=none:owns=none
[rave@satellite ~]$
Comment 14 Wolfgang Ulbrich 2014-05-21 19:23:35 CEST
opps, my fault,
after removing some old forgotten remains from further bbswich configuration,
vgaschwitheroo is there.
[root@satellite rave]# cat /sys/kernel/debug/vgaswitcheroo/switch 
0:IGD:+:Pwr:0000:00:02.0
1:DIS: :DynOff:0000:01:00.0

@ Simone Caronni
Are those vgaswitcheroo commands valid?
https://help.ubuntu.com/community/HybridGraphics
I've probs to switch the cards, but that's off topic.
Comment 15 Simone Caronni 2014-05-21 20:18:17 CEST
(In reply to comment #14)
> @ Simone Caronni
> Are those vgaswitcheroo commands valid?
> https://help.ubuntu.com/community/HybridGraphics
> I've probs to switch the cards, but that's off topic.

Yes, they are, with a few variations soon the default.

BTW, I've update my guide yesterday, but drop me an email and do not write here if you have any issue/comments/feedback, etc.:

http://negativo17.org/complex-setup-with-nvidia-optimus-nouveau-prime-on-fedora-20/


Regards,
--Simone
Comment 16 Nicolas Chauvet 2016-11-24 14:13:04 CET
I don't think we will ever implement this solution.
gpu switching will only be supported with nouveau/intel.

If you want nvidia, that will be outputsource only not offload, so if anyone want to disable the GPU card, then the way it can be supported in the foreseeable future is to reboot using nouveau/intel.