Shared publicly  - 
 
For those who are not aware yet - +Alexander Monakov's primus solution is what most would call "done" now, and definitely ready to try out if you're still using optirun!

Simply download and compile, then use the included primusrun script instead of optirun. Keep your bumblebee daemon/settings as they have been for optirun, no need to change anything - just replace "optirun" by "primusrun". You'll have to set it up manually for now, but it only involves 2 (single-arch) or 3 (multiarch) files so is relatively easy.

Main advantages this has over the optirun/VirtualGL solution:
- Less overhead (better framerates!) and cleaner solution (no networking or compression involved at all).
- Fixes the "bug" that causes bumblebee to shut down the GPU too early sometimes (no more need for the "optirun bash" workaround - ever!).
- Less buggy/glitchy, easier to debug.
- Only uses/starts secondary GPU for OpenGL parts of applications - everything else remains on your main GPU (power savings).

Give it a spin and make sure to report any bugs/problems you find on the github issue tracker for primus (see link -> issues).

Most of you are probably wondering - will we pack this as part of bumblebee in the future? Most likely, yes! We have to get the team together and make some decisions about this and what will happen to optirun first (on some distros - specifically those that use statically compiled libglapi.so - primus will not work (yet?), so the VirtualGL solution should remain available for that small group of people...).
42
11
Luo Pei's profile photoAndrea Arteaga's profile photoLiam Dawe's profile photoMyc Clark's profile photo
37 comments
 
Sounds great!
Guys, once more a big thanks for your awesome work.

BTW: nice to see such a direct support for Gentoo.
 
Excellent good work guys I use optirun all the time, I hope since this gives better performance that it become default in the future for distros that support it.
 
This sounds great ! Thanks for all the amazing work !

Is there any chance that in future bumblebee will automatically switch between main GPU and secondary GPU when needed ? Like how it actually works on windows ?
 
I can't thank you guys enough.  My m17xr4 burned though battery before I started using bumblebee, 1.5 hours max.  Now I get around 6 hours.  I will have to try this other client to see how it compares.  I would love to see it combined with optirun to get an easy to install effective solution for optimus capable machines.
 
Wierd, using primus I have as much performance as using the Intel card, but with optirun I have more as expected:

[pedro@jack~]$ glxgears
303 frames in 5.0 seconds = 60.451 FPS
301 frames in 5.0 seconds = 60.058 FPS
301 frames in 5.0 seconds = 60.057 FPS

[pedro@jack~]$ optirun glxgears
2483 frames in 5.0 seconds = 496.592 FPS
2649 frames in 5.0 seconds = 529.727 FPS
2440 frames in 5.0 seconds = 487.774 FPS

[pedro@jack~]$ primusrun glxgears
primus: profiling: readback: 60.4 fps, 0.8% app, 4.8% map, 94.4% wait
primus: profiling: display: 60.0 fps, 0.8% wait, 4.2% upload, 95.0% draw+swap
306 frames in 5.0 seconds = 61.130 FPS
primus: profiling: readback: 60.1 fps, 0.0% app, 4.8% map, 95.2% wait
primus: profiling: display: 60.1 fps, 0.0% wait, 4.5% upload, 95.5% draw+swap
301 frames in 5.0 seconds = 60.072 FPS
primus: profiling: readback: 60.0 fps, 0.0% app, 4.9% map, 95.1% wait
primus: profiling: display: 60.1 fps, 0.0% wait, 4.4% upload, 95.6% draw+swap
301 frames in 5.0 seconds = 60.051 FPS


Is this expected?
 
You see the effect of vblank synchronization. Prepend vblank_mode=0 to the command line to disable it, but don't abuse it - your LCD panel does not show more than 60 frames per second anyway
 
It worked! Thanks!

7632 frames in 5.0 seconds = 1526.268 FPS
7739 frames in 5.0 seconds = 1547.613 FPS
7538 frames in 5.0 seconds = 1507.526 FPS

Why do you say for me to not to abuse it?

In this post it's said that the secondary GPU will only be used on the OpenGL parts of the aplication, but I tried to run Steam through Wine and the LED for the GPU switiching it turned on as soon as Steam starts. I suppose this doesn't work for Wine applications?
 
Because your LCD panel only shows 60 frames per second. Rendering more than that is not useful.

Something in Steam loads the OpenGL library and that causes primus to turn on the dGPU.
 
Ok, thanks for your help and good job! :)
Luo Pei
 
Good job! Thanks you!
 
Very interesting, can't wait to try this out.
Thanks a lot (and Bravo for both Bumblebee and Pirmus developpers)
 
I will try this on Fedora as soon as i can grab my laptop...
(Now we only need a "automatic" mode) ;-) 
 
For a very dumb automatic mode ( = offloading all OpenGL activity) you can add paths to primus' libGL.so.1 to /etc/ld.so.conf. But beware if you're using a WM that does compositing via OpenGL -- it'll break.
 
+Alexander Monakov 
In that case, I will wait for a wile for a "smart" auto mode
(But still thanks for all the hard work! =3)
 
+Pedro Araújo Steam actually shows most of its user interface through OpenGL (through wine, anyway). I guess it makes sense, that way they only had to make one interface for both the main application and the game overlays.
 
+Ivo Glasius Looks like you're missing the OpenGL headers. Something like mesa-devel might provide those (not sure about package name there, I didn't look it up, this is from memory - you may want to actually search for the package containing that .h file).
 
could use a little friendly help +Alexander Monakov or +Bumblebee Project  , still pretty new to these kind of things lol. getting this error
squshy@squshy-ubuntu:~$ sudo apt-get install primus
[sudo] password for squshy: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 primus : Depends: nvidia-current (>= 304.37) but 295.40-0ubuntu1.1 is to be installed
E: Unable to correct problems, you have held broken packages.
squshy@squshy-ubuntu:~$ 

Im not sure how to definitively check what my driver version is, but when I try to apt-get install nvidia-current I'm told I'm already up to date, same goes for bumblebee-nvidia....any thoughts?
 
+Stephen Rossi Sigh, the package is a bit too eager in asking the recent nvidia drivers; I am to blame. You can install newer drivers from x-swat x-updates PPA (but be careful; if unsure, please wait for an updated primus package instead).
 
As asked on github, any chance of 12.10 Ubuntu packages?
 
Nice! Thanks for the job :p
Working on Arch 
 
Great work +Alexander Monakov! Sadly, primus gives me the exact same performance as optirun, glxspheres are for both around 90fps on Ubuntu 12.04 with an Nvidia 310M. I know the GPU is not top notch, but I expected primus to give me at least a +10fps advantage on optirun. Any ideas why this is? Thank You in advance for your time.
 
Glxgears is not a good benchmark try it in actual games.
 
+Anton Postnikov, in addition to what Liam said, "PRIMUS_VERBOSE=2 primusrun glxspheres" will give you a rough idea of what's bottlenecking performance, and getting  rid of compositing window manager such as Unity will buy you a few more FPS (and fluidity).
 
Is +Bumblebee Project still under development? Last commits on GitHub are 5 months old :( According primus, I have worse Mpixels/sec rates than with optirun (like a half the values). And games don't run on primus at all.
 
valik@deimos~ $ primusrun glxgears
Xlib:  extension "NV-GLX" missing on display ":0".
X Error of failed request:  BadAlloc (insufficient resources for operation)
  Major opcode of failed request:  152 (GLX)
  Minor opcode of failed request:  24 (X_GLXCreateNewContext)
  Serial number of failed request:  17
  Current serial number in output stream:  18
what did I mess?
 
+Bumblebee Project export PRIMUS_libGLa='/usr/lib/opengl/xorg-x11/lib/libGL.so.1'
export PRIMUS_libGLd='/usr/lib/opengl/xorg-x11/lib/libGL.so.1'
glxgears, glxspheres and nexuiz are running good, but when I'm trying to run e.g. trine 2: 
valik@deimos~ $ primusrun trine2
primus: fatal: failed to load any of the libraries: /usr/lib/opengl/xorg-x11/lib/libGL.so.1
/usr/lib/opengl/xorg-x11/lib/libGL.so.1: wrong ELF class: ELFCLASS64
 
Hi Alexander:

I built Primus for Ubuntu 10.10 (really Lucid) using packages for Precise Pangolin sucessfully.

The problem: Primus is running in Intel Graphic Card

Check it out:

blackout@blackout:~$ primusrun glxspheres
Polygons in scene: 62464
Visual ID of window: 0x21
Context is Indirect
OpenGL Renderer: Mesa DRI Intel(R) Ironlake Mobile GEM 20100330 DEVELOPMENT
30.912598 frames/sec - 34.498459 Mpixels/sec
29.005150 frames/sec - 32.369748 Mpixels/sec
26.601657 frames/sec - 29.687450 Mpixels/sec
29.766702 frames/sec - 33.219640 Mpixels/sec
26.317999 frames/sec - 29.370887 Mpixels/sec
30.093342 frames/sec - 33.584170 Mpixels/sec
26.066754 frames/sec - 29.090497 Mpixels/sec
27.584131 frames/sec - 30.783890 Mpixels/sec
26.114036 frames/sec - 29.143265 Mpixels/sec
29.294416 frames/sec - 32.692568 Mpixels/sec
30.421927 frames/sec - 33.950871 Mpixels/sec
28.718431 frames/sec - 32.049768 Mpixels/sec
27.563123 frames/sec - 30.760445 Mpixels/sec
blackout@blackout:~$ glxspheres
Polygons in scene: 62464
Visual ID of window: 0x96
Context is Direct
OpenGL Renderer: Mesa DRI Intel(R) Ironlake Mobile GEM 20100330 DEVELOPMENT
20.726771 frames/sec - 23.131077 Mpixels/sec
18.681042 frames/sec - 20.848043 Mpixels/sec
18.560451 frames/sec - 20.713464 Mpixels/sec
20.721018 frames/sec - 23.124656 Mpixels/sec
19.400033 frames/sec - 21.650437 Mpixels/sec
18.555946 frames/sec - 20.708436 Mpixels/sec
19.831654 frames/sec - 22.132125 Mpixels/sec
20.169067 frames/sec - 22.508678 Mpixels/sec
19.462231 frames/sec - 21.719850 Mpixels/sec
19.063136 frames/sec - 21.274460 Mpixels/sec
20.233008 frames/sec - 22.580037 Mpixels/sec
18.617221 frames/sec - 20.776818 Mpixels/sec
20.475033 frames/sec - 22.850137 Mpixels/sec
20.263970 frames/sec - 22.614590 Mpixels/sec
20.442343 frames/sec - 22.813654 Mpixels/sec
21.390729 frames/sec - 23.872053 Mpixels/sec
20.395688 frames/sec - 22.761587 Mpixels/sec

How to run Primus in NVIDIA Card?

I don't see any option named "backend=primus" in /etc/bumblebee/bumblebee.conf

Greatings!

Noel Merino Hernández.
 
+Noel Merino You probably put primus library in the wrong place. Read the primusrun script. Ubuntu 10.10 is too old though, even if you sort out this issue, you might hit something else, like non-shared libglapi that breaks primus on Fedora 16.
Add a comment...