Loading…

Video Acceleration on Ubuntu with Nouveau and a GTX 760

If you find this article helpful, you might want to consider using my referral code (ARM7IBQY) to sign-up for Shadow. (Although it most likely is too late, when you’re faced with the following problem. 😁)

Baseline scenario

I ran into an issue with the Nouveau-driver for my GTX 760 when I tried to use the cloud gaming service offered by Shadow.

Shadow offers a Desktop-as-a-Service product mostly focused on gaming. In comparison to other services like GeForce Now or Google Stadia it offers way more flexibility, but no included game-licenses. Unlike GeForce Now you can freely access the complete setup and install anything you want and, most important, play any game you’ve already purchased. You aren’t forced to rely on the games offered by the service. In short, you pay for a complete Windows 10 setup with certain hardware specs and the video output is streamed from the datacenter over the internet to the Shadow-Client on your local device.

Another advantage is the availability of linux support. Shadow offers an AppImage package. AppImage is a possibility to distribute a software together with all needed components, so that no further dependencies on the host are needed.

Although no further software is needed for the offered AppImage, the streaming part relies on the availability of hardware decoding (H.264 or H.265). Most desktop systems include a integrated graphics chip bundled with the processor, which can handle this with the OSS drivers available by default. As I opted for an Intel XEON, which does not include said part (and therefore was a bit cheaper), I had to rely on my GTX 760 for the hardware decoding.

Sadly, the proprietary NVIDIA driver offered through the settings menu of Ubuntu is not compatible with Shadow (for whatever reasons). The driver needs a patch offered here. I first opted for this solution, but wasn’t really successful. After the first euphoric moments of use it just never worked again. I would get the connecting/starting screen displayed forever.

When switching to the bare nouvaeu driver you are faced with the missing hardware decoding, which renders this otherwise nice OSS approach useless in this scenario.

After nearly a day of troubleshooting I found a solution for my specific case, which might be useful for others.

Using Nouveau with proprietary parts from NVIDIA

It is possible to use nouveau and pair it with the hardware decoding part of the proprietary NVIDIA driver blob. I found this possibility here.

There you can find a table, which card is considered to be in which interface generation (VP1, …) and if this generation is able to decode H.264 with a bit of help. In my case the GTX 760 falls in the VP5 category, which does support H.264 (and other codecs).

I therefore just followed the commands offered and ended up with a working system:

# Python is needed for the execution of the script used for extracting. Although it will be part of many distributions, you might need to install it first

# create a temporary working directory
mkdir /tmp/nouveau

# go into said directory
cd /tmp/nouveau

# Download a python script to dismantle the NVIDIA driver
wget https://raw.github.com/envytools/firmware/masterextract_firmware.py

# Get the latest driver package supported by the script
wget http://us.download.nvidia.com/XFree86/Linux-x86/340.108/NVIDIA-Linux-x86-340.108.run

# Run the installer with the --extract-only option to receive the content
sh NVIDIA-Linux-x86-325.15.run --extract-only

# extract the needed files with the python script downloaded
python3 extract_firmware.py

# create a new folder for the hardware-decoding components (if you ever had installed the proprietary NVIDIA driver this directory may already exist)
sudo mkdir /lib/firmware/nouveau

# Copy the relevant content in the firmware folder
sudo cp -d nv* vuc-* /lib/firmware/nouveau/

# Reboot (the /tmp/* folder will be deleted)

You can confirm the availability of hardware encoding using vainfo

# If not already installed
sudo apt install vainfo

# No root needed
vainfo

If the output contains H264 or H265 you’re good to go.

Author: Armin Jacob

Business Information Technology student at Kiel University, on his way through the net and world. Occasionally working with Ubiquiti Hardware and pfSense. Also interested in payment solutions.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.