Results 1 to 6 of 6

Thread: Nvidia Optimus with Bumblebee and Primus Tips

  1. #1

    Default Nvidia Optimus with Bumblebee and Primus Tips

    ### Background ###

    As many of you know Bumblebee is the current workaround for using Nvidia optimus with linux. At the heart of bumblebee has been VirtualGL which is now being superseded by Primus.

    If you have Bumblebee you'll know that to use your discrete card you need to invoke "optirun <application>" from the command line and then after a short wait your application runs using the VirtualGL backend. Unfortunately the VirtualGL backend does not play nice with some applications, particularly Wine and Crossover. Primus is the replacement of optirun and it all it means to the end user is that instead of using optirun you now invoke an app with "primusrun <application>".

    I highly recommend (as do the developers of Bumbleebee) primus over VirtualGL because there are a host of benefits. My favorite benefit is that it works perfectly with wine and Crossover meaning I can play my Windows games on my discrete card instead of having to use my integrated one and has substantially better performance too. Here is a post by the Bumblebee Project on G+: https://plus.google.com/102207276811...ts/ic3AJRKf2VF

    ### Installation ###

    A fine, upstanding member of out community has already made a repo for us with OBS. software.opensuse.org:

    *Install the 32bit version if running a 64bit OS along with the 64bit one as you need it for Wine/Crossover as they are 32bit. I recommend a reboot after install Primus but I don't think it is essential.

    Now if you try run something with primusrun you'll get an error something like primus:
    Code:
    fatal: failed to load any of the libraries: /usr/$LIB/nvidia-bumblebee/libGL.so.1 ...
    Don't worry, the fix is super easy! All you need to do is copy a few folders and you are done.

    From a terminal run:

    Code:
     sudo mkdir /usr/lib/nvidia-bumblebee
    sudo cp /usr/lib/nvidia/* /usr/lib/nvidia-bumblebee
    sudo mkdir /usr/lib64/nvidia-bumblebee/
    sudo cp /usr/lib64/nvidia/* /usr/lib64/nvidia-bumblebee
    Again you might need to reboot. You could always do this with dolphin in super-user mode and just copy paste the files in the same folder and just specify "nvidia-bumblebee" as the folder name. I would highly recommend this to most users as its harder to make a mess up.

    ### Testing ###
    Code:
    vblank_mode=0 primusrun glxspheres
    It should give something like this:
    Code:
    :~> 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: 0x96                                                                                                            
    ATTENTION: default value of option vblank_mode overridden by environment.                                                            
    ATTENTION: default value of option vblank_mode overridden by environment.                                                            
    ATTENTION: option value of option vblank_mode ignored.                                                                               
    Context is Direct                                                                                                                    
    OpenGL Renderer: GeForce GT 550M/PCIe/SSE2                                                                                           
    primus: sorry, not implemented: glXUseXFont                                                                                          
    236.366525 frames/sec - 263.785042 Mpixels/sec                                                                                       
    241.331845 frames/sec - 269.326339 Mpixels/sec                                                                                       
    240.886716 frames/sec - 268.829575 Mpixels/sec                                                                                       
    241.437659 frames/sec - 269.444427 Mpixels/sec                                                                                       
    239.505292 frames/sec - 267.287906 Mpixels/sec
    In comparison, optirun gives:

    Code:
    :~> vblank_mode=0 optirun glxspheres                                                                              
    Polygons in scene: 62464                                                                                                             
    Visual ID of window: 0x21                                                                                                            
    Context is Direct                                                                                                                    
    OpenGL Renderer: GeForce GT 550M/PCIe/SSE2
    110.628062 frames/sec - 123.460917 Mpixels/sec
    122.449406 frames/sec - 136.653538 Mpixels/sec
    133.291433 frames/sec - 148.753240 Mpixels/sec
    133.511781 frames/sec - 148.999148 Mpixels/sec
    134.822179 frames/sec - 150.461552 Mpixels/sec
    ### Summary ###

    This will not bork your system and is really worth your time if you're a Nvidia Optimus/Bumblebee user. The improvement in performance alone is worth checking out while the greater flexibility with Wine/Crossover is a real bonus for gamers.

    Hope this helps!

    ### Tip ###

    To launch a crossover app like steam with primusrun try:

    Code:
    primusrun /opt/cxoffice/bin/wine --bottle "<name of bottle>" --cx-app <name of application>
    E.g.
    Code:
    primusrun /opt/cxoffice/bin/wine --bottle "Steam" --cx-app steam.exe
    ### Disclaimer ###

    If this breaks your system, deletes data or irrecoverably ruins your digital life then I am not to be held responsible as you took these steps yourself and should always double check everything you do. Try at your own risk!

  2. #2

    Default Re: Nvidia Optimus with Bumblebee and Primus Tips

    Quote Originally Posted by me3064 View Post

    From a terminal run:

    Code:
     sudo mkdir /usr/lib/nvidia-bumblebee
    sudo cp /usr/lib/nvidia/* /usr/lib/nvidia-bumblebee
    sudo mkdir /usr/lib64/nvidia-bumblebee/
    sudo cp /usr/lib64/nvidia/* /usr/lib64/nvidia-bumblebee
    Why not just link the directories, so if the nvidia libraries are updated, primus won't be using outdated libraries?
    Code:
    sudo ln -s /usr/lib/nvidia /usr/lib/nvidia-bumblebee
    sudo ln -s /usr/lib64/nvidia /usr/lib64/nvidia-bumblebee
    Also,
    I had to add a lib line to primusrun, because nvidia libraries were not in the lib path:
    Code:
    PRIMUS_libGL=${PRIMUS_libGL}:/usr/\$LIB/nvidia/
    which I added just after this line:
    Code:
    # PRIMUS_libGL=${PRIMUS_libGL}:/usr/\$LIB/opengl/nvidia/lib
    Thanks for the information!
    Eric

    OpenSuse 12.2
    Nvidia drivers installed from: Index of /repositories/home:/Bumblebee-Project:/nVidia:/latest/openSUSE_12.2
    bumblebee and primus installed from: Index of /repositories/home:/Overman79/openSUSE_12.2
    Got this from the 3rd post in: https://forums.opensuse.org/english/...iguration.html

  3. #3
    Join Date
    Jun 2008
    Location
    Auckland, NZ
    Posts
    20,173
    Blog Entries
    1

    Default Re: Nvidia Optimus with Bumblebee and Primus Tips

    Thanks for posting this info on Primus me3064. It's good to see the development that is going on in support of those with hybrid graphics hardware. I don't own such hardware so, haven't really kept up with the state of play.

  4. #4

    Default Re: Nvidia Optimus with Bumblebee and Primus Tips

    Quote Originally Posted by EricDavis View Post
    Why not just link the directories, so if the nvidia libraries are updated, primus won't be using outdated libraries?
    Code:
    sudo ln -s /usr/lib/nvidia /usr/lib/nvidia-bumblebee
    sudo ln -s /usr/lib64/nvidia /usr/lib64/nvidia-bumblebee
    Idiot me! Why did I "forget" about symlinks. They are such useful little things. This is definitely a better solution.

    Quote Originally Posted by EricDavis
    Also,
    I had to add a lib line to primusrun, because nvidia libraries were not in the lib path:
    Code:
    PRIMUS_libGL=${PRIMUS_libGL}:/usr/\$LIB/nvidia/
    which I added just after this line:
    Code:
    # PRIMUS_libGL=${PRIMUS_libGL}:/usr/\$LIB/opengl/nvidia/lib
    That's surprising. I didn't have to do that at all. I wonder what differences in set-up we have that would cause something like that. The use of symlinks shouldn't be a factor.

    Another thing, people should remember to disable composting desktops when working with primus. You'll get skipped frames, poor performance and sometimes artifacts/tearing. On KDE you can just hit Alt+Shift+F12 to toggle composting on and off.

  5. #5
    Join Date
    Jun 2008
    Location
    Groningen, Netherlands
    Posts
    19,644
    Blog Entries
    14

    Default Re: Nvidia Optimus with Bumblebee and Primus Tips

    Quote Originally Posted by me3064 View Post
    Idiot me!
    Another thing, people should remember to disable composting desktops when working with primus. You'll get skipped frames, poor performance and sometimes artifacts/tearing. On KDE you can just hit Alt+Shift+F12 to toggle composting on and off.
    And here's another one that should have thought about something. Uninstalled vdrift (my testcase) before thinking about disabling KDE's desktop effects
    ° Appreciate my reply? Click the star and let me know why.

    ° Perfection is not gonna happen. No way.

    https://en.opensuse.org/openSUSE:Board#Members
    http://en.opensuse.org/User:Knurpht
    http://nl.opensuse.org/Gebruiker:Knurpht

  6. #6

    Default Re: Nvidia Optimus with Bumblebee and Primus Tips

    Hi guys,

    I just got my Sager NP9150 laptop with 3rd gen intel i7 processor and nVidia GTX 670MX graphics card, and installed opensuse 12.2 on it. I installed bumblebee from Index of /repositories/home:/Overman79/openSUSE_12.2 and nvidia drivers from Index of /repositories/home:/Bumblebee-Project:/nVidia:/latest/openSUSE_12.2 . I then created the links like so:
    Code:
    sudo ln -s /usr/lib/nvidia /usr/lib/nvidia-bumblebee sudo ln -s /usr/lib64/nvidia /usr/lib64/nvidia-bumblebee
    Now, I can run opensuse without "nomodeset" in boot options. I can also run programs with optirun and primusrun, but I am getting more performance using optirun instead of running with primusrun:

    Code:
    shekhar@nuxpc:~> optirun glxspheres
    Polygons in scene: 62464
    Visual ID of window: 0x21
    Context is Direct
    OpenGL Renderer: GeForce GTX 670MX/PCIe/SSE2
    128.540991 frames/sec - 143.451746 Mpixels/sec
    128.211575 frames/sec - 143.084118 Mpixels/sec
    129.766444 frames/sec - 144.819351 Mpixels/sec
    129.740692 frames/sec - 144.790612 Mpixels/sec
    Code:
    shekhar@nuxpc:~> primusrun glxspheres
    Polygons in scene: 62464
    Visual ID of window: 0x9a
    Context is Direct
    OpenGL Renderer: GeForce GTX 670MX/PCIe/SSE2
    primus: sorry, not implemented: glXUseXFont
    61.028143 frames/sec - 68.107407 Mpixels/sec
    59.687538 frames/sec - 66.611293 Mpixels/sec
    59.677998 frames/sec - 66.600646 Mpixels/sec
    59.683653 frames/sec - 66.606956 Mpixels/sec
    59.706089 frames/sec - 66.631995 Mpixels/sec
    59.652635 frames/sec - 66.572340 Mpixels/sec
    Code:
    shekhar@nuxpc:~> glxspheres
    Polygons in scene: 62464                                                                       
    Visual ID of window: 0x9a                                                                       
    Context is Direct                                                                               
    OpenGL Renderer: Mesa DRI Intel(R) Ivybridge Mobile                                                 
    55.882620 frames/sec - 62.365004 Mpixels/sec                                                           
    57.641833 frames/sec - 64.328286 Mpixels/sec                                                           
    59.194579 frames/sec - 66.061150 Mpixels/sec                                                             
    55.231061 frames/sec - 61.637864 Mpixels/sec                                                                   
    58.113533 frames/sec - 64.854703 Mpixels/sec                                                                   
    57.230644 frames/sec - 63.869399 Mpixels/sec                                                                   
    57.193870 frames/sec - 63.828359 Mpixels/sec                                                                   
    57.134889 frames/sec - 63.762536 Mpixels/sec

    While using primusrun, the performance is similiar to that of running without optirun. Also, while using primus, it says "sorry, not implemented: glXUseXFont".

    Any idea on why I am getting poor performance with primusrun?

    Found the culprit: vblank_mode=0 was missing, (I am assuming, it drops the frames to match with the display framerate to avoid unnecessary computation)

    Code:
    shekhar@nuxpc:~> 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: 0x9a                                                                                                  
    ATTENTION: default value of option vblank_mode overridden by environment.                                                  
    ATTENTION: default value of option vblank_mode overridden by environment.                                                  
    ATTENTION: option value of option vblank_mode ignored.
    Context is Direct
    OpenGL Renderer: GeForce GTX 670MX/PCIe/SSE2
    primus: sorry, not implemented: glXUseXFont
    347.210224 frames/sec - 387.486610 Mpixels/sec
    373.126234 frames/sec - 416.408877 Mpixels/sec
    372.699481 frames/sec - 415.932620 Mpixels/sec
    371.692007 frames/sec - 414.808280 Mpixels/sec
    Last edited by wildnux; 22-Dec-2012 at 20:21. Reason: Found why the performance was poor!
    ___________________________________________

    नेपालीको छोरो
    help spread the word of linux
    ___________________________________________

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •