Bug#771928: nvidia-driver: Inconsistencies between the Nvidia installer and nvidia-driver on Optimus notebook

Vincent Cheng vcheng at debian.org
Sun Jan 4 07:34:22 UTC 2015


Hi Tomaz,

Bumblebee maintainer and nvidia-driver co-maintainer here (although to
be fair w.r.t. nvidia-driver, Andreas does most of the work there :P
); sorry for the late reply!

On Wed, Dec 3, 2014 at 7:49 AM, Tomaz Fogaça <tom.fogaca at gmail.com> wrote:
> Package: nvidia-driver
> Version: 340.46-5
> Severity: important
>
> Dear Maintainer,
>
> I've struck some inconsistencies between the nvidia-driver package and the
> Nvidia installer provided by Nvidia themselves, through their site.

To the best of my understanding, what you're seeing (and I'll
elaborate further below with inline replies to the other parts of your
bug report) are probably not inconsistencies, but different methods of
enabling Optimus functionality on Linux, admittedly none of which are
seamless as with Windows. Arch Linux's wiki article on Optimus [1]
describes the current options pretty well (I suggest at least reading
the summary), i.e.

1) nouveau-only: PRIME GPU offloading using nouveau [2]
2) nvidia-only: nvidia's more recent implementation [3], also packaged
as nvidia-prime [4] in Ubuntu
3) nouveau or nvidia: bumblebee

...all of which have their own benefits and drawbacks.

It's worth pointing out that in Debian, only option 3 is packaged (as
bumblebee, bbswitch, and primus); options 1 and 2 should be possible,
but involve manual configuration. There's a request for nvidia-prime
to be packaged in Debian [5], but I simply haven't had time to get
around to it. The package in Ubuntu does not seem to be readily
backport-able to Debian, unfortunately.

> Whenever I try installing the Nvidia drivers/libraries through the Nvidia
> installer, I get the expected results: the drivers are installed and the
> libraries are
> put into place so that when I have Xorg come up, all applications requiring
> OpenGL work as expected, and it would seem to me that either the Nvidia
> installer enables
> transparent GPU switching or it just sends all commands straight to the
> discrete GPU automatically.

That's probably nvidia-prime; I actually wasn't aware that the
nvidia's installer configures that automatically (but see [3] if you
want to do it yourself). I'll point out that this doesn't offer
transparent GPU switching; in order to switch between having your main
X display be driven by either your Intel or nvidia GPU, you need to
kill your current X session and start a new one. This also partially
defeats one of the supposed benefits of Optimus, i.e. that your nvidia
GPU is powered down when not in use to save battery life on your
laptop; with nvidia-prime, with your nvidia GPU enabled, it remains
enabled and powered on until you end your current X session, as
opposed to e.g. bumblebee.

> On the other hand, if I install the 'nvidia-driver' package, which installs
> with it the OpenGL, GLX
> and Xserver libs, and then use 'update-alternatives --config glx' to have
> glx point to the nvidia implementation, and then fire up xorg, I can't get
> my OpenGL
> programs to work. 'glxinfo' gives me errors like 'Xlib: extension "GLX"
> missing on display "0:0".
>
> If I use the alternatives system to have glx point instead to mesa-diverted,
> this results in using the integrated GPU for everything.

Yes, without any X server configuration (either done by yourself or
apparently by nvidia's installer), you'll be using your intel GPU to
drive your primary display, and that requires mesa's libGL
implementation rather than nvidia's. This is the ideal configuration
if you can disable your nvidia GPU via a BIOS setting and choose not
to use your nvidia GPU.

> I'm doing all of these experiments on a live system without persistency, so
> I can mess around with configs and reset them upon reboot. Also, I'm not
> using any
> Xorg.conf file.
>
> I eventually tried using bumblebee. I used 'update-alternatives --config
> glx' to make glx point to the mesa-diverted libs and indeed, I could get
> OpenGL working (
> with 'optirun someOpenGLApp' ). But it bugs me that the Nvidia installer can
> work some magic to switch GPUs automatically or to always use the Nvidia
> card, but I
> can't get that to work with the debian nvidia packages, and must always use
> bumblebee explicitly.

And of course bumblebee is also a viable option; this allows you to
run applications using your nvidia GPU on-demand, and bumblebee will
automatically toggle your nvidia GPU on and off as necessary (this is
actually done by bbswitch), but you have to specify which applications
you want using optirun (everything uses your Intel GPU by default).
Note that bumblebee may not offer the best performance compared to
nvidia-prime (it works essentially by intercepting GLX calls and
redirecting GL rendering to an invisible, secondary X display, then
copying everything back to the primary X display, from what I
understand).

In summary, there's no perfect solution, although it would be nice if
nvidia-prime was packaged for Debian...it's on my todo list, but I
totally wouldn't mind if someone beats me in packaging it for Debian.
:)

Regards,
Vincent

[1] https://wiki.archlinux.org/index.php/NVIDIA_Optimus
[2] http://nouveau.freedesktop.org/wiki/Optimus/
[3] http://us.download.nvidia.com/XFree86/Linux-x86/319.12/README/randr14.html
[4] https://launchpad.net/ubuntu/+source/nvidia-prime
[5] http://lists.alioth.debian.org/pipermail/pkg-nvidia-devel/2014-November/010814.html



More information about the pkg-nvidia-devel mailing list