Git Product home page Git Product logo

nvidia-prime-select's Introduction

nvidia-prime-select

This is a fork of FedoraPrime enhanced for all linux distributions.


Offlaod Technologie Testing preview

Please read Offload file for more details.


Introduction

Seeking for a tools to swicht entirely from default Intel® GPU to the discret Nvidia® graphic card, I discover FedoraPrime.

It comes really useful for my default distro, Fedora, but not so cool for my custom Nvidia® driver install, FedoraPrime is Fedora only with a default driver config.

Thus, I discided to go deeper to solve that particular issue and a few others as well.

  • Choose for a custom driver install
  • Automatically configure xrandr for multi screens (or not)
  • Start Nvidia® GPU instead the default one whatever the end user desktop you choose.

Update message

2019-09-05 - v0.9.20

WARNING: Do a 'sudo make install' this time, too much important things changed and don't forget to make a backup of /etc/nvidia-prime. (with root/admin terminal, do:) mv -f /etc/nvidia-prime /etc/nvidia-prime.bak (to remove safely after controls)

2019-08-20

There were many issues with grub config reported. It is hopefully fix and updated now. Please don't forget to report even if you think it's too minor and pointless.

2018-04-01

Dev test was running on Fedora 24, since upgraded to Fedora 27 it appears that xrandr on modesettings is broken and dosn't work anymore for discret nvidia.

2018-04-13

Finally, the script needed a complete rewrite. For user, basics are still the same, but they work differently than the previous version.

Read Changelog display before install/uninstall/update.

Thanks to the Nvidia Devtalk thread and to nospam_ that giving me the necessary base to understand what changed.

Also added a libraries and xorg config editor.

Library.conf is install by default and checked if configured.

There stil some issue with some session managers, see Known Issues at page bottom.

Hope you'll like those changes and don't forget to send any bug you get. :)

2018-04-16

Big mistake in repos upload :s. Forgot to send library.conf with last upgrade. My apologies.

2018-04-22

Multi display issue, see CHANGELOG.md.

2018-04-24

Added options config file, report.sample and some fixes to grub and xrandr sections. See CHANGELOG.md.


Usage

Default usage :

nvidia-prime-select option

Options

  • intel : use the default GPU
  • nvidia : use the Nvidia® GPU

Before all

In old version it was mandatory to edit library.conf first in case of special Nvidia drivers install. Now you can setup them directly with nvidia-prime-ui before entering you new setup.

Gnome and Cinnamon use a monitors.xml(~/.config/monitors.xml) file to keep your screen config and overide any other setup if it doesn't match the xml file.

Gdm Gnome3 may cause issue in some case. See Issue chapter in bottom ofthe page and send report if you can fix it this way.

nvidia-prime-select comes with a library.conf file to set custom installation directories up (same case if you come from an other distro). If you're in this case, edit it first before launching/installing anything.

Example of my custom driver install in Fedora 23:

  nv_drv_32='/opt/nvidia/lib'
  nv_drv_64='/opt/nvidia/lib64'
  nv_xorg_path='/opt/nvidia/xorg/modules'
  rc_dir='/etc/rc.d'

Or use the simpliest way and launch nvidia-prime-ui from settings menu.

nvidia-prime-select come also with 2 default xorg configs for Intel® and Nvidia®. Edit them as you wish before or after luanching command (edit function is available in nvidia-prime-ui).

Install

nvidia-prime-select use the same install process as FedoraPrime :

git clone https://github.com/wildtruc/nvidia-prime-select.git
cd nvidia-prime-select
sudo make install

To update, run :

sudo make update

To uninstall, run :

sudo make uninstall

When done, launch the commandline as admin/superuser or with nvidia-prime-ui as normal user. Then logout and restart your session.

The script will setup your actual xrandr configuration automatically.

Dependencies

  • zenity (updates messages and UI display)

Notes

Option "DPI" "96 x 96" is set by default in the xorg.nvidia.conf because xrandr set it at 75 by default. If you have a weaker Nvidia® GPU, it's maybe a good thing to let it at 75 if you want to play some games smoother.

Usually when the Nvidia® GPU starts the screen display some weird black lines at first, if it is, it means that Nvidia® GPU is started.

Known issues

The script has been test on Gnome Shell, Gnome Classic, Cinnamon, LXQT, Kodi (for previous version, lightdm only for new one).

  • The only issue comes with Gnome Classic, desktop crash on final start. I'm not sure it comes from Gnome Classic itself.
  • For Fedora users upgrading from Fedora 23 to 24 using the dnf tools, don't forget to re-enable the service after the first reboot. You have to probably reset your display xrandr config too.
  • Since Fedora 24, rc.nivia schedule time set is not enough to let GDM fully start. Need to extend from 5 to 10 secondes (update 10/08/16).
  • Session restart on gdm (gnome3) may cause result in a blank screen. In previous nvidia-prime-select, this issues was fix by inserting a delay waiting for full gdm start before insert xrandr command line. Try to uncomment 'sleep' function in /etc/nvidia-prime/xinitrc.prime and different delay. If it doesn't fix, think to change session manager to lightdm.
  • In some case, xrandr display config (~.config/monitors.xml) could conflict with nvidia-prime-select xrandr auto conf function. First, remove ~.config/monitors.xml, and restart your session. If it doesn't fix, set your display again and disable nvidia-prime.desktop autostart (menu > system > pref > personal > autostart), then restart your session.
  • At session restart login has a strange behaviour and could take 30/40s to display correctly. It maybe a polkit issue, but not sure. Need debug and figure out.
  • Do not hesitate to send issue reports on Github page.

nvidia-prime-select's People

Contributors

hellcp avatar wildtruc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nvidia-prime-select's Issues

turn off Nvidia on the run.

I see that you haven't implanted bbswitch in this script. May i ask the reason behind it? And i use hardcoded prime and i use intel driver instead of modesetting every xorg configuration is the same. I opened this issue as a discussion .Sorry in advance if it was pointless/inapropriate.

Test on Fedora 30

OS: Fedora 30 (Gnome 3.32.2)
CPU: Intel i5-6200U
GPU: NVIDIA GTX 950M

nvidia-prime-select intel is working fine. nvidia-smi report GPU-Util as 0 constantly. (Which I think it means the GPU is OFF?)

nvidia-prime-select nvidia isn't working. Couldn't login to the Gnome. Could it be a problem of GDM?

nvidia-prime-select default is working fine tho. It brings NVIDIA back as well. So why not:
nvidia-prime-select intel to switch to Intel
nvidia-prime-select default to switch to NVIDIA

What is the different between default and nvidia ?

PC does not initiate after install

I have a laptop with OpenSUSE installed and use i3wm. After installing and selecting nvidia, my PC will reboot and either not load the greeter (lightdm), or load the greeter but immediately crash after login, returning to the greeter after that.

I tried sudo make uninstall and sudo make clear, both of which did not work. Then decided to delete the nvidia-prime file, to no avail. The PC still does not work and the only way to access it is through tty.

How do I revert this and get my PC back to normal? Thank you.

One more grub.conf issue

So I was looking at the code after running the command and getting this error:

nvidia-prime-select query sed: can't read /boot/grub2/grub.cfg: No such file or directory
(Im using EFI) at on line 89 and 91 it looks like the script isnt using the previous grub_cfg var:

if [ $modeset_check -gt 0 ]; then sed -Eni -e "s|(linux.*$boot_key.*ro) (nvidia-drm.modeset=[0-9])(.*)$|\1 $modset\3|g;p" /boot/grub2/grub.cfg else sed -Eni -e "s|(linux.*$boot_key.*ro)(.*)$|\1 $modset \2|g;p" /boot/grub2/grub.cfg fi

Should the path at the end be $grub_cfg ?

Thank you (from a Debian user)!

Thank you for this amazing software. I can't tell you how many Debian installs I hosed before finding this. Works perfectly on Debian 11.

Zenity is a dependency, yet is not mentioned as a pre-requisite

On gentoo (KDE), while running 'sudo make install':

mkdir -p /etc/nvidia-prime
install -Dm755 -t /usr/bin/ nvidia-prime-ui
install -Dm755 -t /usr/sbin/ nvidia-prime-select
install -Dm644 -t /etc/nvidia-prime/ xorg.nvidia.conf
install -Dm644 -t /etc/nvidia-prime/ xorg.intel.conf
install -Dm644 -t /etc/nvidia-prime/ library.conf
install -Dm644 -t /etc/nvidia-prime/ options.conf
install -Dm644 -t /etc/nvidia-prime/ report.sample
install -Dm644 -t /etc/nvidia-prime/ nvidia-prime.desktop
install -Dm644 -t /etc/nvidia-prime/ nvidia-session.desktop
install -Dm644 -t /usr/share/pixmaps/ nvidia-prime.png
install -Dm644 -t /usr/share/applications/ nvidia-prime-ui.desktop
install -Dm644 -t /usr/share/polkit-1/actions/ com.github.pkexec.nvidia-prime-select.policy
install -Dm644 -t /usr/share/polkit-1/actions/ com.github.pkexec.nvidia-prime-editor.policy
bash ./changelog.sh
./changelog.sh: line 6: --width=200: command not found
./changelog.sh: line 11: --width=520: command not found

Checking if zenity is installed and exiting with a message saying something like "zenity is required but not installed", or having a cli fallback, would be a nice feature. I had to dig into the changelog.sh file to understand what was going wrong.

Thanks

grub config should be optional

On manjaro, the script fails from the command line because it can't find the grub paths.
The UI does not give an error message (but it doesn't work). So I suspect the grub issue is an unreported failure for the UI.

It seems you are touching grub to achieve modeset=1. The arch wiki has a section on manually setting up prime and it says to use a moprobe.d file, such as zz_nvidia.conf.

This is also the default approach from users in the nvidia dev forum, and it is ubuntu does it too. On ubuntu you need to initramfs -u after changing this file, but you only need to do it once. Under this approach, there is no need to rely on boot parameters.

I suggest you make the script at least pass over a failure to configure grub, better, make it optional.
If I discover that fix this a step to getting it working on manjaro/arch, I will submit a pull request.

Does not work

Hello

Nvidia-prime-select does not work home on Archlinux : when I select the nvidia card then I reboot, it's still the intel chipset of used.

Should you copy "xorg.intel.conf" and "xorg.nvidia.conf" in /etc/xorg.conf.d/ ?
and should you modify his files?

Any plans for "on demand"

Hi, thank you for nvidia-prime-select.

The ubuntu prime-select has a "on demand" feature, that uses the intel card for graphics rendering but still leaves the nvidia modules loaded. Meaning we can do computation (this is useful for me particularly because sometime I need all of my vRAM to do microscopy data processing).
I think this corresponds to the "intel" of nvidia-prime-select.

On the other hand ubuntu prime-select "intel" selection, changes the modeset for boot, blacklists nvidia modules and also has some udev rules. This results in more battery saving for the laptop as only the intel chip is available to the system.

I could try to mimic the ubuntu scripts and adapt them to nvidia-prime select.
Is there any interest from all of you for me to try to implement these changes, or you prefer me to fork nvidia-prime-select?

xorg.offload.conf not found

This commit ab8388c#diff-b67911656ef5d18c4ae36cb6741b7965R14 included reference to xorg.offload.conf but this file is not included in repo, nor generated at runtime.

mkdir -p /etc/nvidia-prime
install -Dm755 -t /usr/bin/ nvidia-prime-ui
install -Dm755 -t /usr/sbin/ nvidia-prime-select
install -Dm644 -t /etc/nvidia-prime/ xorg.nvidia.conf
install -Dm644 -t /etc/nvidia-prime/ xorg.offload.conf
install: cannot stat 'xorg.offload.conf': No such file or directory
make: *** [Makefile:14: install] Error 1

Solus Linux - Not switching

Hi,



I would like to use your script but it doesn't switch cards for me. I might need your help to figure out what is up.



This is the ouput I get when I do :



> sudo nvidia-prime-select intel



<br />cat: /boot/grub2/grub.cfg: No such file or directory <br />cat: /boot/grub2/grub.cfg: No such file or directory <br />sed: can't read /boot/grub2/grub.cfg: No such file or directory <br />

Using blender in iGPU mode not working due to opengl error

So i have been using blender with bumblebee, using just the CPU without issue, however because of suspend issuses (cant supend more than once without a black screen that needs a hard restart), im now ith prime select, when in intel mode, this is blender:

$../blender-2.83.2-linux64/blender  
Read prefs: /home/mikef/.config/blender/2.83/config/userpref.blend
/home/sources/buildbot-worker-linux_centos7/linux_lts_283/blender.git/intern/ghost/intern/GHOST_WindowX11.cpp:136: X11 glXQueryVersion() failed, verify working openGL system!
initial window could not find the GLX extension
Writing: /tmp/blender.crash.txt
Segmentation fault (core dumped)

how can i use blender without these opengl issue? do i need to install something else? this is fedora 32 on kernel:
5.7.11-200.fc32.x86_64,
an error with glxinfo is also present:

name of display: :1
Error: couldn't find RGB GLX visual or fbconfig

and i cant run glxspheres64. the gpu is off but the nvidia kernel module seems loaded.
im using these drivers:

akmod-nvidia-390xx-390.138-1.fc32.x86_64
kmod-nvidia-390xx-5.7.11-200.fc32.x86_64-390.138-1.fc32.x86_64
xorg-x11-drv-nvidia-390xx-libs-390.138-1.fc32.x86_64

and this is the hardware:

00:02.0 VGA compatible controller: Intel Corporation 3rd Gen Core processor Graphics Controller (rev 09)
01:00.0 VGA compatible controller: NVIDIA Corporation GF108M [GeForce GT 620M/630M/635M/640M LE] (rev a1)

sh ./changelog.sh might not work

sh ./changelog.sh may not work with "find", better change it to bash


diff --git a/Makefile b/Makefile
index cddfe35..708339a 100644
--- a/Makefile
+++ b/Makefile
@@ -37,7 +37,7 @@ update:
install -Dm644 -t /usr/share/applications/ nvidia-prime-ui.desktop
install -C -Dm644 -t /usr/share/polkit-1/actions/ com.github.pkexec.nvidia-prime-select.policy
install -C -Dm644 -t /usr/share/polkit-1/actions/ com.github.pkexec.nvidia-prime-editor.policy

  •   sh ./changelog.sh
    
  •   bash ./changelog.sh
    

uninstall:
rm -rf $(INSTALL_DIR)
patch.txt

Can I use NPS as kernel parameter?

I (Fedora 30) have the issue that my DM only shows up if a monitor is attached on a HDMI-port when NPS is set to nvidia (it functions like normal on intel). This makes booting kinda annoying. To solve this, I want to create two grub-entries: one for intel and one for nvidia.
Is there a way to run NPS as a kernel parameter?

UEFI Support

Currently nvidia-prime-select is hard-coded to use the legacy/BIOS boot GRUB 2 configuration at /boot/grub2/grub.cfg.

$ sudo nvidia-prime-select nvidia
cat: /boot/grub2/grub.cfg: No such file or directory

These are the locations of the UEFI GRUB 2 configurations based on the Red Hat family of operating systems:

  • Fedora = /boot/efi/EFI/fedora/grub.cfg
  • RHEL = /boot/efi/EFI/redhat/grub.cfg
  • CentOS = /boot/efi/EFI/centos/grub.cfg

Perhaps a check against lsb_release could be added to determine the operating system? Example below:

if [ ! -f /boot/grub2/grub.cfg ]; then
    operating_system=$(lsb_release --id --short)

    if [ "Fedora" == "${operating_system}" ]; then
        grub_cfg="/boot/efi/EFI/fedora/grub.cfg"
...

On a related note, the Arch Linux and Debian families of operating systems also use a different path (/boot/grub/grub.cfg) for the BIOS boot GRUB 2 configuration (and their own UEF directories). Another, more portable, example below:

if [ -f /boot/grub2/grub.cfg ]; then
    grub_cfg="/boot/grub2/grub.cfg"
elif [ -f /boot/grub/grub.cfg ]; then
    grub_cfg="/boot/grub/grub.cfg"
else
    grub_cfg="/boot/efi/EFI/$(lsb_release --id --short | awk '{print tolower($0)}')/grub.cfg"
fi

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.