Pages

24 February 2013

Dell XPS 15 L502X Optimus Graphics under Ubuntu 12.04

Firstly I apologise for the quality of this article, its somewhere between the quality of the notes that I usually write for myself to keep track of instructions like this, and the quality that I publish so others can follow the logic. I'm a bit out of time at the moment, but thought these instructions could be of use to more people than just myself so I thought that I'd put in some effort to get them out...but only just so much effort.

Its been a while since I've played around trying to get the NVIDIA card in this laptop to play nicely under Linux and I thought I'd give it another spin. This laptop has Optimus which when it was released meant there were quite limited options in terms of getting NVIDIA GPU working. I played around with it a little bit back then, but the bumblebee project was really in its infancy, and getting it all installed and working was quite painful. Whilst I found things are still more complicated than they need to be obviously the bumblebee team have done a huge amount of work to get things working this well as they do now. Unfortunately the install process from Ubuntu on this laptop is still a little more difficult than it needs to be, so I've taken the time to list some notes on how I managed to get everything working.

Overview

To the best of my understanding the following diagram explains how the graphics hardware in this laptop is connected (apologies for the quality of the diagram, but hopefully its enough to convey the message).

This means that if you have just the Intel GPU working you can get access to both the laptop display and the display port. If you have just the NVIDIA GPU enabled you can get the HDMI output to work. When Optimus is enabled content is rendered on the GPU and copied back to the Intel GPU for display on the laptop panel or display port. It seems that the bumblebee team are keen to get HDMI working whilst using bumblebee, but they arn't there yet.

This currently leaves you with two options:

Intel - Bumblebee - Laptop display + Display Port: You can get the laptops internal display working and the display port working. You can even enable hardware rendering on the NVIDIA GPU using bumblebee to support Optimus for display on the either of these displays.

NVIDIA - HDMI: You can get the HDMI port working with all content rendered on the NVIDIA GPU.

Unfortunately presently you can't have both options working at the same time.

All of these instructions presume a fresh install of Ubuntu 12.04 (in my case 12.04.02), presumeably if you've done any other config there could be reminants of an old install that leave these instructions not working.

Intel - Bumblebee - Laptop display + Display Port

Installing Bumblebee to primarily use the Intel GPU and load the NVIDIA GPU selectively for GPU intensive applications.

The advantages of this method are that you can use both the internal laptop display and the display port simultaneously as well as the more powerful NVIDIA GPU when you need to and have bumblebee manage the power of the NVIDIA GPU so its not wasting as much power when it's idle.

Initially I essentially followed the bumblebee guide for intalling it under Linux which is fairly straight forward:
http://bumblebee-project.org/install.html#Ubuntu

This means that after reboot you're left in a state worse than before and you just be left with a black screen with no graphics driver loaded what so ever. Infact it leaves the system so screwed up that on boot you can't even ctrl+alt+f1 to switch to a tty.

...So where do you go from here...

Well if you're sensible you will reinstall the Intel drivers before you reboot and you'll happily be on your way.
$ sudo apt-get install xserver-xorg-video-intel

If you make the mistake that I did and reboot before you install the Intel driver you will be left with a black screen and you wont be able to log in what so ever. I found that while the system is still booting you can switch to one of the virtual consoles by pressing crtl+alt+f1, you must do this while the system is booting because once the system has reached the login state you can't swap back to the virtual console. Once you've got to the the virtual console login and just follow the instruction above. After this point you should be able to get x to start correctly:$ sudo service lightdm start(sometimes you need to reboot at this point to get x to start, I've even seen a couple of times where two restarts are required before everything gets going correctly)After you login you should be able to run bumblebee using:$ optirum glxspheres

Configuration files:

/etc/X11/xorg.conf/etc/bumblebee/*

NVIDIA - HDMI

If you don't care about the laptop display / display port / Optimus / Bumblebee / Power managment and just want to get the NVIDIA card running displaying on HDMI using the most up to date driver from NVIDIA.

Download the latest driver from NVIDIA currently 310.32:Install the kernel sources (the driver warns you about this if you forget and get part way through and need them): $ sudo apt-get install linux-headers-generic

The NVIDIA driver sets up everything you need, with one exception. Because there are two GPU's in the machine you need to tell the x configuration which card you want the driver to be applied to. If you reboot now without updating the xorg configuration the driver wont be loaded correctly. In this case you need to update the xorg.conf file to tell it which device to load the nvidia driver for.