Nvidia optimus with linux

Nvidia optimus with linux

A subreddit for discussions and news about gaming on the GNU/Linux family of operating systems (including the Steam Deck).

You know that moment when you have a gaming laptop with an nvidia card and you install a Linux Distro on it and everything just works perfectly? Yeah, me neither.

This guide is intended to help people who have laptops that use Nvidia’s Optimus technology.

NVIDIA Optimus is a technology that allows an Intel integrated GPU and discrete NVIDIA GPU to be built into and accessed by a laptop.

Before I start getting into the meat of the guide, I want to mention that this guide is being written with Arch Linux (or it’s derivatives) in mind. However, most of this information is relevant for other distros as well.

Now, let’s start at the beginning.

The Beginning

So, you think you have a laptop that uses Optimus Graphics eh? Well, lucky for you, there’s a way to verify that:

Grab a terminal, and type in: lspci -vnn | grep ‘\»[030[02]\]’

If it outputs 2 lines, then it means you have an Optimus system and you should read further on.

If it outputs 1 line, then this guide might not help you.

Example output: (This is what it should look like)

00:02.0 VGA compatible controller [0300]: Intel Corporation Haswell-ULT Integrated Graphics Controller [8086:0a16] (rev 09) (prog-if 00 [VGA controller])

01:00.0 3D controller [0302]: NVIDIA Corporation GK107M GeForce GT 750M 10de:0fe4 (rev ff) (prog-if ff)

The Middle

So, now that we’ve verified that you indeed have an Optimus system, let’s see how we can get it to work.

So, while researching, I found 4 potential ways to get Optimus working properly.

  1. Disabling one of the GPUs in the BIOS.
  2. nvidia-prime
  3. Bumblebee
  4. nvidia-xrun

Disabling one of the GPUs

Here’s what you need to know about this method:

  • It doesn’t allow GPU switching. i.e. Only one of your GPUs will be on at all times. This means that your active graphics chip won’t switch between powersaving (Intel) and performance (Nvidia) like it’s supposed to in a traditional Optimus setting. This can lead to more battery consumption (if you turn off Intel and keep Nvidia on) or less performance (if you turn off Nvidia and keep Intel on).
  • There’s a chance that your BIOS doesn’t even have the option of turning GPUs off. (Mine didn’t.)
Читайте также:  Linux nvidia drivers nvidia geforce

If your BIOS has the option of turning off GPUs, and you don’t mind using just one GPU at all times, then you can turn off one of the GPUs and use the other one normally.

If, however, your BIOS doesn’t support turning off GPUs, then keep reading.

Nvidia-Prime

Okay, I know I said this guide was going to be geared towards Arch and Arch based users, and that was definitely how I originally planned it, but I felt like I should mention this solution as well.

Nvidia-Prime is a solution that is exclusive to Ubuntu and Ubuntu-based distros. The package itself comes along with the nvidia drivers in Ubuntu.

If you open up the nvidia settings application on Ubuntu, there’s a section where you can pick what GPU you want active at the time.

Once you pick the GPU you want, you just need to log off and log back in and the changes take place.

This solution works similarly to the previous BIOS one, since at any given time, only one card is active.

Bumblebee is a solution that attempts to make the Optimus functionality actually work in GNU/Linux systems.

Through bumblebee, you have the option of switchable graphics. i.e., you can launch heavy applications on your Nvidia card while keeping everything else on the Intel card.

Installing Bumblebee on Arch is very straightforward. Just run the following command:

sudo pacman -S bumblebee mesa xf86-video-intel nvidia lib32-nvidia-utils lib32-virtualgl nvidia-settings bbswitch primus lib32-primus

All of the packages are available in the repos.

Now, once bumblebee is installed, you can launch applications on your Nvidia card by using the prefix primusrun .

Читайте также:  Window theme linux mint

So, assuming you want to run something like Blender and use the Nvidia card for rendering, you would launch blender using primusrun blender .

If you’re attempting to launch a game through steam, and you want to use your Nvidia card for it, then go to the game’s launch options and type in: primusrun %command% . This will ensure that your game is run on your Nvidia card, and not your intel card.

Now, here’s some things worth noting about bumblebee:

  • The primusrun command that’s used to invoke your Nvidia card makes it so that your framerate in the application is synced to your monitor’s refresh rate. So, if you have a monitor that has a refresh rate of 60Hz, then your framerate is capped at 60fps. (Vsync is forced).
  • This 60fps limit can be removed by using vblank_mode=0 primusrun however, there’s a chance that you will see some tearing.
  • You cannot launch vulkan games with bumblebee.
  • This is more of a personal point, but bumblebee breaks when you put your laptop in suspend mode, and it requires a reboot to fix. Hibernation works perfectly though. Note that this does not mean that suspension is broken everywhere, it works perfectly on a friend’s system.

You may want to check out some of the most common problems and their solutions over at the wiki .

nvidia-xrun is something that I discovered very recently. It is slightly more complex to set up than the other solutions, but in my experience, nvidia-xrun has given me the best performance so far.

Let’s talk about how nvidia-xrun works for a second.

When you use Nvidia-xrun, what you’re doing is you’re running a separate X Server on a free tty which is run completely on your Nvidia GPU.

Читайте также:  Mozilla 6 для linux

Now, if you have access to the Arch User Repository, then the developer maintains a package there .

If you prefer compiling it on your own, then there is also nvidia-xrun-git also in the AUR.

Naturally, this makes things a lot easier for us.

==Note: You will need to install the Bumblebee packages before proceeding==

First, install the nvidia-xrun package from one of those places.

Next, we will want to install another desktop environment which we’ll use for the xrun xsession. Personally, I chose openbox since it was the lightest thing I could come up with at the time. But really, it’s just up to you.

Then, create a .nvidia-xinitrc which automatically starts the Desktop Environment when you run the xrun command.

vim ~/.nvidia-xinitrc and type in openbox-session and save the file.

Now, switch to a free tty, ( Ctrl + Alt + F3-F6 ) and login.

After logging in, type in nvidia-xrun and it should start the openbox session on your Nvidia card.

If my instructions weren’t clear, you can check out the dev’s instructions on the github page .

Now, here’s some things about nvidia-xrun:

  • It lets you launch Vulkan games
  • Games, at least in my experience, run much better on nvidia-xrun compared to bumblebee.
  • Since it uses bumblebee’s bbswitch, suspend still remains broken for me on nvidia-xrun, however, hibernation works. Once again, I’d like to say that the suspension bug seems unique to me, it works perfectly for my friend.
  • It works similar to nvidia-prime on Ubuntu, so if you’re on Ubuntu, just use that instead.

The End

This guide is the result of many hours of research in trying to get the most out of my own Optimus setup. I sincerely hope it helps someone.

Feel free to pm me in case you have any questions.

Also, shoutout to the official /r/linux_gaming Discord channel , we have a live tech support channel there and there’s usually someone willing to help out.

Источник

Оцените статью
Adblock
detector