Optimus on the Gigabyte p34w v5 under Ubuntu 15.10

09 March 2016

Through much experimentation I have finally been able to get optimus to
work on the Gigabyte p34w v5; however, the specific implementation is far from
flawless. In particular, starting the bumblebee daemon on boot causes the system
to hang indefinitely. Thus one must start and stop bumblebeed as needed.

Installing software

Getting bumblebee installed is a bit interesting on 15.10. The only instructions
I found that work can be
found in this StackOverflow post.
Because bumblebeed causes the machine to hang on boot, I’ve had to modify
the instructions somewhat.

Boot your machine

Install nvidia driver and bumblebee in the same command. I actually used
the CUDA Debian package for Ubuntu 15.04 described in my
previous post about the p35w v5
however you can use anything after nvidia-352 where support for the GTX 970m
was added. The Simple method of doing this is as follows:

sudo aptitude install bumblebee nvidia-352 prime-select

After this is done, do not reboot. Instead immediately switch to the
intel driver using prime-select:

sudo prime-select intel

Now configure bumblebee. Edit /etc/bumblebee/bumblebee.conf as
follows: Set Driver=nvidia and replace nvidia-common with nvidia-352 in the
[driver-nvidia] section. I’ve posted my full bumblebeed.conf file below
as a reference if you need it.

Next /etc/bumblebee/xorg.conf.nvidia, uncomment BusID "PCI:01:00:0"

Now disable the bumblebeed service with the following command

sudo systemctl disable bumblebeed.service

Reboot the system. With any luck it will come up running on the Intel card.

Using Optimus / Bumblebee

Because we disabled the bumblebee daemon on boot, we have to activate it whenever
we want to use it. This is fairly easy to do with a few scripts.
To turn on the NVIDIA card and start bumblebeed, I execute this
nvidia-start.sh script:

#!/bin/bashsudo modprobe bbswitch
sudo service bumblebeed start

And to put the machine back into a power-saving mode after using the
NVIDIA card, I use the following nvidia-stop.sh script:

The nvidia-stop.sh script (1) unloads all of the modules (including the NVIDIA
unified virtual memory module if you use CUDA), (2) shuts down the bumblebee
service, (3) tells bbswitch to shut off the card, and then (4) echos the
current state of the card.

Power consumption

Using a Kill A Watt
power usage meter I checked the power consumption of my laptop with and without
the NVIDIA card enabled. My results, shown in the following table, show that
the bumblebee and bbswitch do indeed disable the discrete GPU; however, there
appears to be a small (0.4 Watt) draw when the card is off, but not disabled.

Idle State

Consumption (W)

Note

Integrated only

14.5

Discrete GPU disabled in BIOS

bbswitch off

14.9

bbswitch on

30.4

Running applications on the discrete card

To execute an application on the NVIDIA card, simply run it using either
optirun or primusrun as follows:

optirun program-name

One thing you will undoubtably notice is that your FPS is inherently limited
to about 60, which is the default vsync rate of the intel graphics card.
To get higher throughput, simply change the vblank mode. Here is an example
of how you could run glxgears

export vblank_mode=0
optirun glxgears
export vblank_mode=1

Lastly, here are a few performance results for the classic FPS, Nexuiz:

Driver

Program

Bridge

Transport Method

PMMethod

FPS

i915

N/A

N/A

N/A

N/A

184

nvidia

optirun

primus

—

N/A

257

As you can see, we get a 40% boost in performance by running Nexuiz via.
optirun. I suspect the difference would be more considerable for more modern
games that push the GPU’s capabilities.

After getting it working, I haven’t experimented with different bridge methods
(valid options are auto, virtualgl and primus) or with transport methods
for VirtualGL (the options are proxy, jpeg, rgb, xv, and yuv) although
I hear the performance differences are not considerable.