JackHack96 / dell-xps-9570-ubuntu-respin

Collection of scripts and tweaks to adapt Ubuntu running smooth on Dell XPS 15 9570.
999 stars 113 forks source link

Enable use of PRIME Offloading on NVIDIA GPU. #112

Closed floturcocantsee closed 5 years ago

floturcocantsee commented 5 years ago

These changes enable the use of the new PRIME Offloading capability in the NVIDIA GPU driver starting from version 435.

Specifically this prompts the user if they wish to enable the feature and if yes is selected two files are created. These files are located at /etc/X11/xorg.conf.d/10-prime-offload.conf and /usr/local/bin/prime The Xorg file will configure the system appropriately for prime to function and the prime script will enable easy use of the offloading. Ex. prime glxgears

This should replace any need for bumblebee or nvidia-prime and shouldn't conflict with Ubuntu's built-in prime toggle.

I've used this same configuration on Arch Linux and Pop! OS as well and it functioned flawlessly. Testing would be appreciated and I'm open to any questions.

JackHack96 commented 5 years ago

This is so coool! Thank you very much! :D

JackHack96 commented 4 years ago

Does it work for OpenGL <4? I've tried to run Citra 3DS emulator but it says "OpenGL 3.3 unsupported"

erenatas commented 4 years ago

Can you please explain how to use this feature?

JackHack96 commented 4 years ago

Can you please explain how to use this feature?

Open a terminal, type prime + the name of the program, for example to run Mozilla Firefox on nVidia type prime firefox

floturcocantsee commented 4 years ago

Does it work for OpenGL <4? I've tried to run Citra 3DS emulator but it says "OpenGL 3.3 unsupported"

I'm not super aware of how Citra renders but the only OpenGL type unsupported by this technology is EGL currently.

wibotwi commented 4 years ago

prime glxgears works great! but prime firefix, prime google-chrome - do not work nvtop shows glxgears, but does not show browsers

JackHack96 commented 4 years ago

Does it work for OpenGL <4? I've tried to run Citra 3DS emulator but it says "OpenGL 3.3 unsupported"

I'm not super aware of how Citra renders but the only OpenGL type unsupported by this technology is EGL currently.

Citra uses OpenGL. It works ok, I simply was on Intel and thought the nVidia card could be awaken when invoking prime, but that's not the case, for now.

@wibotwi Strange I can get Firefox to run on PRIME without issues, on Ubuntu 19.10

erenatas commented 4 years ago

@wibotwi I think hardware acceleration on Chrome doesn't work. I don't know if it works on Firefox. You can check by watching a video on Youtube and see where the load of the browser is. Please let me know if you can figure it out!

IDerr commented 4 years ago

I saw that the script is adding a ppa "http://ppa.launchpad.net/aplattner/ppa/ubuntu/dists/" but there is no eoan build for this, do we have to force disco on it or is it already included with eoan ?

floturcocantsee commented 4 years ago

I saw that the script is adding a ppa "http://ppa.launchpad.net/aplattner/ppa/ubuntu/dists/" but there is no eoan build for this, do we have to force disco on it or is it already included with eoan ?

The PPA isn't necessary on Eoan. The only reason it was needed in the past was to get a backported version of Xorg with the necessary patches. These patches ship with Ubuntu Eoan as well as integration with GPU-Manager for enabling PRIME (Ubuntu calls it NVIDIA On-Demand). We should probably add a check to the script so that it doesn't prompt the user to enable PRIME on version 19.10 or newer.

floturcocantsee commented 4 years ago

Looking at the code, it appears to already check if the version is Eoan before installing the ppa. Another suggestion I'd make is to not allow it to install the xorg configuration file as it will interfere with 19.10's gpu-manager hook for Nvidia On-Demand.