Giter Site home page Giter Site logo

wildtruc / nvidia-prime-select Goto Github PK

View Code? Open in Web Editor NEW
128.0 128.0 14.0 185 KB

This a fork of FedoraPrime enhanced for all linux distributions

License: GNU General Public License v3.0

Makefile 9.01% Shell 90.99%
linux nvidia nvidia-prime-select optimus shell-script zenity

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

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

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?

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.

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?

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 ?

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)

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?

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.

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.

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

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 />

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

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.