Fedora Optimus

Is this really about Transformers?

NVIDIA logoIt’s still quite hard for me to believe: I’ve got NVIDIA Optimus working on my Fedora 18 laptop!

When I bought this laptop, I had no idea it had this technology on board. To be honest, I didn’t know a thing about Optimus. When it arrived, I discovered that, not only I had no means of using the discrete NVIDIA graphic card, but I’d better find a way to turn it off, or the whole PC would be on fire in matter of minutes.

Basically, I’m talking about this:

dario@Abyss ~]$ lspci|grep -i vga
00:02.0 VGA compatible controller: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller (rev 09)
01:00.0 VGA compatible controller: NVIDIA Corporation GF108 [GeForce GT 540M] (rev ff)

And Wikipedia calls it “an optimization technology”. Sure, tell me about it!!

Well, as usual, I started digging to see what I can do, and found out the Bumblebee project, which looked really promising from the beginning. Unfortunately, it turned out not to be the case, not at that time at least, as it was 2010, the project was still in its very early days, and was supported only for Ubuntu, while I was  running Fedora 16 at the time. I managed in setting it up by hand, to the point where it was working, but it never became really usable.

To switch the discrete GPU off and avoid overheating, I found acpi_call, compiled it, added it to DKMS, and settled around the idea of hearing nothing more from this laptop’s NVIDIA card. Never.

But then…

I still don’t know why, about a month ago, after having updated the laptop to Fedora 18, I decided to google for something like ‘bumblebee fedora‘… And I saw the light!

Optimus Prime

Optimus Prime (Photo credit: BenSpark)

First of all, we now have a really nice page in the official Fedora wiki about how to install and get Optimus running. I tried this way first, and got almost there, but couldn’t claim 100% success. In fact, my card (which, BTW, is a NVIDIA Corporation GF108 [GeForce GT 540M]) does not seem to be that well supported by Linux’s nouveau driver, or at least by Linux’s nouveau running in a “Optimus configuration”. In fact, I couldn’t get any application to really use the discrete card and, most important, I couldn’t dynamically turn on and off the discrete card, which, well, is the whole point!

The solution is to use proprietary NVIDIA drivers and a really really really nice step by step tutorial on how to set them up for a Optimus environment can be found at this link. Actually, Viger from http://forums.if-not-true-then-false.com did much more than that: he has (or has found and links to) some nice RPM packages that makes things unbelievably comfortable to set up. So, here’s what I did:

# ln -s /etc/modprobe.d/blacklist.conf /usr/lib/modprobe.d/
# echo "blacklist nouveau" >> /etc/modprobe.d/blacklist.conf
# dracut /boot/initramfs-$(uname -r).img $(uname -r)
# yum -y install http://install.linux.ncsu.edu/pub/yum/itecs/public/bumblebee/fedora18/x86_64/acpi-handle-hack-0.0.2-1.fc18.x86_64.rpm
# yum -y install http://install.linux.ncsu.edu/pub/yum/itecs/public/bumblebee/fedora18/x86_64/bbswitch-0.5.0-1.fc18.x86_64.rpm
# yum -y install http://install.linux.ncsu.edu/pub/yum/itecs/public/bumblebee/fedora18/x86_64/bumblebee-3.0.1-2.fc18.x86_64.rpm
# yum -y install http://install.linux.ncsu.edu/pub/yum/itecs/public/bumblebee/fedora18/x86_64/primus-0.0.12112012-8.fc18.x86_64.rpm
# yum install VirtualGL
# yum -y --nogpgcheck install http://install.linux.ncsu.edu/pub/yum/itecs/public/bumblebee-nonfree/fedora18/noarch/bumblebee-nonfree-release-1.0-1.noarch.rpm
# yum install Install bumblebee-nvidia
# reboot

And then you are done. Finished. Everything works! The super cool thing about the bumblebee-nonfree package is that it takes care entirely of installing the NVIDIA proprietary Xorg drivers in a non standard location, as it is required by Optimus, and really painful to do by hand.

[dario@Abyss ~]$ rpm -ql bumblebee-nvidia

(where the job of moving the files in the proper directories the package creates, after having extracted/compiled them, is carried out by the /usr/sbin/bumblebee-nvidia script.)

Some nice info about how to use the discrete card via optirun are available, for instance, on the ArchLinux Wiki. For making sure that the card is disabled when not in use have a look here:

[dario@Abyss ~]$ cat /proc/acpi/bbswitch 
0000:01:00.0 OFF

(although, believe me, you can also hear that from the fact the fan is silent and the laptop not burning as much as hell!)

The last touch is this GNOME3 Extension: Bumblebee indicator.

And does it really work?

It sure does, but please, judge yourself.

Without Optimus (i.e., running on the integrated Intel card)

[dario@Abyss ~]$ glxspheres 
Polygons in scene: 62464
Visual ID of window: 0x9f
Context is Direct
OpenGL Renderer: Mesa DRI Intel(R) Sandybridge Mobile 
55.670883 frames/sec - 54.525288 Mpixels/sec
39.869175 frames/sec - 39.048747 Mpixels/sec
40.019250 frames/sec - 39.195734 Mpixels/sec

With Optimus (i.e., running on the discrete NVIDIA card)

[dario@Abyss ~]$ optirun glxspheres 
Polygons in scene: 62464
Visual ID of window: 0x21
Context is Direct
OpenGL Renderer: GeForce GT 540M/PCIe/SSE2
99.215315 frames/sec - 97.173662 Mpixels/sec
109.804884 frames/sec - 107.545319 Mpixels/sec
109.287161 frames/sec - 107.038250 Mpixels/sec
[dario@Abyss ~]$ optirun -c yuv glxspheres 
Polygons in scene: 62464
Visual ID of window: 0x21
Context is Direct
OpenGL Renderer: GeForce GT 540M/PCIe/SSE2
115.854143 frames/sec - 113.470097 Mpixels/sec
118.528492 frames/sec - 116.089413 Mpixels/sec
119.482522 frames/sec - 117.023811 Mpixels/sec
[dario@Abyss ~]$ vblank_mode=0 primusrun glxspheres
Polygons in scene: 62464
ATTENTION: default value of option vblank_mode overridden by environment.
ATTENTION: default value of option vblank_mode overridden by environment.
Visual ID of window: 0x9f
ATTENTION: default value of option vblank_mode overridden by environment.
ATTENTION: default value of option vblank_mode overridden by environment.
Context is Direct
OpenGL Renderer: GeForce GT 540M/PCIe/SSE2
primus: sorry, not implemented: glXUseXFont
270.721424 frames/sec - 265.150518 Mpixels/sec
275.764986 frames/sec - 270.090294 Mpixels/sec
276.292697 frames/sec - 270.607146 Mpixels/sec

Impressive, eh?

Wasn’t it about overheating too?

Finally, here it is what I get on a mostly idle system:

[dario@Abyss ~]$ sudo sensors
Adapter: Virtual device
temp1:        +54.0°C  (crit = +100.0°C)
temp2:        +54.0°C  (crit = +100.0°C)coretemp-isa-0000
Adapter: ISA adapter
Physical id 0:  +54.0°C  (high = +86.0°C, crit = +100.0°C)
Core 0:         +54.0°C  (high = +86.0°C, crit = +100.0°C)
Core 1:         +53.0°C  (high = +86.0°C, crit = +100.0°C)
Core 2:         +53.0°C  (high = +86.0°C, crit = +100.0°C)
Core 3:         +50.0°C  (high = +86.0°C, crit = +100.0°C)

And, again, believe me, this is something I did never achieve before, while not being able to turn the discrete card off properly.

English: NVIDIA engineering sample graphic card

English: NVIDIA engineering sample graphic card (Photo credit: Wikipedia)

UPDATE (Feb 20, 2013):
Gary (see the comments below) pointed me to the Wiki page, where all this effort to package bumblebee and friends nicely and get them into Fedora lives. Check that out: it is full of much more useful and detailed information that this humble post! :-P

About dariofaggioli

Interested in CS, programming and Open Source since like forever, I'm now a very happy Xen developer, and Citrix is from where I get my paycheck. Much more important, I am a dreamer, a madly in love husband and an enthusiastic & incredibly proud father.
This entry was posted in Fedora, General, Linux, Technology and tagged , , , , , , , , , . Bookmark the permalink.

18 Responses to Fedora Optimus

  1. Pingback: NVIDIA 310.32 on Kernel 3.7.7-201.fc18 | Dario's

  2. Nikhil Parmar says:

    Thank You very much sir.. ! It now works and i m getting a good battery life.
    The only prob i had was that, my system was running kernel 3.3.4 and a command updated the kernel header 3.7 so it didnt worked. Then i updated my kernel to 3.7 and did all above things again. And this time it worked. !
    Thank You once again. !

    • You’re welcome! Improved battery life is one of the most pleasant outcome of all this! For the kernel “issue”, you’re right, I was assuming one always run an as updated as possible system… I should have mentioned that. Glad it ended up well anyway. :-)

  3. Luigi Coppolino says:

    Ciao Dario,
    grazie per la tua guida.
    Con optirun riesco ad usare firefox con youtube con un basso uso di cpu . L’unica cosa che proprio non funziona e’ il supporto vdpau per mplayer/smplayer. Mi compare questo errore:
    Xlib: extension “NV-GLX” missing on display “:0″.
    Xlib: extension “NV-GLX” missing on display “:0″.
    [vdpau] Error when calling vdp_device_create_x11: 1
    Error opening/initializing the selected video_out (-vo) device.
    Al riguardo, avresti qualche info?

  4. Pingback: Jak zprovoznit Nvidia Optimus ve Fedoře 18 | Fedora.cz

  5. Gary Gatling says:

    Hello. Here is a link to my wiki page:


    Maybe it will help you out. I have been working on this subject on and off for about a year. (Had to take a break a while back due to surgury)


    • Hi! Nice to meet you. :-)

      That is awesome, I was not aware of the Wiki page. Thanks for the link… I’ll update the post to include it even there. I particularly appreciate your effort for getting all the packages into Fedora upstream. I know it’s tough, so, best of luck for it!

      I’m not having much issues right now, and everything seems to be working. As per another comment (which is in Italian), an area where there might be some room for improvement is VDPAU support. In particular since, with a super-quick google search, I couldn’t find any packaged solution for hybrid-windump (provided hybrid-windump is a decent solution for that, which I’m not sure).

      I’ll dig a bit more on that and update/make a new post… For now, thanks for letting me know about the Wiki again.


  6. Gary Gatling says:

    Hello. Nice to meet you. I have not tried to get VDPAU support to work. (Didn’t know about it until today actually)

    but check out:


    Albert Vilella posted this to the hybrid graphics mailing list today. Perhaps that could be modified for a fedora install without too much trouble?


    • Yep, that link was right my answer to the other comment on this blog post, asking for help with VDPAU. As I said there, I’ll try have a look and a try to it asap, and share the results…

  7. 0XV01D says:

    Reblogged this on The Linux Site.

  8. Pingback: Dario's

  9. Vojta says:

    Works perfectly. Thanks man!

  10. I am actually pleased to glance at this weblog posts which carries tons of valuable information, thanks for providing such

    • Well, what can I say… Glad it was useful! I’m going to update the laptop with Fedora 19 in the coming weeks. Let’s see how this Optimus thing will work there! :-)

  11. Hi, thank you for all this, its really useful info as I also have the nvidia optimus, and like you, I had no idea it was installed until I got the laptop home. Do you have UEFI secure boot, or have you switched to legacy mode. Reason I ask is I had problems compiling the nvidia driver. Thanks


Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s