Dual-GPU nvidia-prime configuration script
[code] something README
---
This is an old info, so I'm not sure whether this script is effective or not for recent nvidia environment.
非常に古い情報なので、
1) 最近の環境でスクリプトが正常に動作するかどうか
2) これを必要とするユーザーがまだ存在するのか
よくわかりません。
私自身の備忘録として書き留めておきます。
元情報:
https://forums.developer.nvidia.com/t/oops-something-went-wrong-and-the-system-cant-recover/47975/11
[code] something README
: ' / ***************************************************************************** Dual-GPU nvidia-prime configuration script by D7X Please make sure you have installed the latest nvidia driver from the official nvidia website Enables nvidia-prime on dual-gpu systems. Tested on dual-gpu system with nvidia gtx960m and intel hd530 graphics on kernel 4.9 Made possible thanks to generix https://devtalk.nvidia.com/default/topic/995110/linux/oops-something-went-wrong-and-the-system-can-t-recover/ To test whether it was successful run xrandr --listproviders. You should get something like: Providers: number : 2 Provider 0: id: 0x20a cap: 0x1, Source Output crtcs: 0 outputs: 0 associated providers: 1 name:NVIDIA-0 Provider 1: id: 0x44 cap: 0x2, Sink Output crtcs: 3 outputs: 2 associated providers: 1 name:modesetting You may also need to add nvidia-drm.modeset=1 to /etc/default/grub For any comments please e-mail to: nospam@promisedev.com ****************************************************************************** / ' デュアルGPUnvidia-prime構成スクリプト。 nvidiaの公式Webサイトから最新のnvidiaドライバーがインストールされていることを確認してください デュアルGPUシステムでnvidia-primeを有効にします。 カーネル4.9でnvidiagtx960mおよびintelhd530グラフィックスを使用したデュアルGPUシステムでテスト済み Generixのおかげで可能になりました https://devtalk.nvidia.com/default/topic/995110/linux/oops-something-went-wrong-and-the-system-can-t-recover/ 成功したかどうかをテストするには、xrandr--listprovidersを実行します。 次のような出力が表示されれば成功です。 Providers: number : 2 Provider 0: id: 0x20a cap: 0x1, Source Output crtcs: 0 outputs: 0 associated providers: 1 name:NVIDIA-0 Provider 1: id: 0x44 cap: 0x2, Sink Output crtcs: 3 outputs: 2 associated providers: 1 name:modesetting nvidia-drm.modeset=1を/etc/ default/grubに追加する必要がある場合があります |
script : nvprime.sh
[code]
: ' / ***************************************************************************** Dual-GPU nvidia-prime configuration script by D7X Please make sure you have installed the latest nvidia driver from the official nvidia website Enables nvidia-prime on dual-gpu systems. Tested on dual-gpu system with nvidia gtx960m and intel hd530 graphics on kernel 4.9 Made possible thanks to generix https://devtalk.nvidia.com/default/topic/995110/linux/oops-something-went-wrong-and-the-system-can-t-recover/ To test whether it was successful run xrandr --listproviders. You should get something like: Providers: number : 2 Provider 0: id: 0x20a cap: 0x1, Source Output crtcs: 0 outputs: 0 associated providers: 1 name:NVIDIA-0 Provider 1: id: 0x44 cap: 0x2, Sink Output crtcs: 3 outputs: 2 associated providers: 1 name:modesetting You may also need to add nvidia-drm.modeset=1 to /etc/default/grub For any comments please e-mail to: nospam@promisedev.com ****************************************************************************** / ' #!/bin/bash echo "Checking for available display managers..." lightdm_path="/etc/lightdm" lightdm_setup_file="/etc/lightdm/display_setup.sh" lightdm_conf="$lightdm_path/lightdm.conf" if [ -d $lightdm_path ]; then echo "lightdm detected, configuring $light_dm_setup_file ..." echo '#!/bin/sh' >> $lightdm_setup_file echo 'xrandr --setprovideroutputsource modesetting NVIDIA-0' >> $lightdm_setup_file echo 'xrandr --auto' >> $lightdm_setup_file chmod +x $lightdm_setup_file echo "configuring $lightdm_conf ..." echo "Making a backup of $lightdm_conf to $lightdm_conf.bak" cp $lightdm_conf "$lightdm_conf.bak" sed -i -e s/'type=xlocal'/'type=xlocal\ndisplay-setup-script=\/etc\/lightdm\/display_setup.sh'/g $lightdm_conf echo "[OK] lightdm configured."; fi sddm_path="/usr/share/sddm/scripts" sddm_setup_file="/usr/share/sddm/scripts/Xsetup" if [ -d $sddm_path ]; then echo "sddm detected, configuring $sddm_setup_file ..." echo 'xrandr --setprovideroutputsource modesetting NVIDIA-0' >> $sddm_setup_file echo 'xrandr --auto' >> $sddm_setup_file echo "[OK] sddm configured."; fi gdm_path="/usr/share/gdm/greeter/autostart" gdm_setup_file="/usr/share/gdm/greeter/autostart/optimus.desktop" gdm_entry='[Desktop Entry] Type=Application Name=Optimus Exec=sh -c "xrandr --setprovideroutputsource modesetting NVIDIA-0; xrandr --auto" NoDisplay=true X-GNOME-Autostart-Phase=DisplayServer' if [ -d $gdm_path ]; then echo "gdm detected, configuring $gdm_setup_file" echo "$gdm_entry" > $gdm_setup_file cp $gdm_setup_file ~/.config/autostart echo "[OK] gdm configured" fi xdg_path="/etc/xdg" xdg_setup_file="/etc/xdg/autostart/optimus.desktop" if [ -d $xdg_path ]; then echo "xdg detected as well, configuring $xdg_setup_file" echo "$gdm_entry" > $xdg_setup_file cp $xdg_setup_file ~/.config/autostart echo "[OK] xdg configured" fi kdm_path="/usr/share/config/kdm" kdm_setup_file="/usr/share/config/kdm/Xsetup" if [ -d $kdm_path ]; then echo "kdm detected, configuring $light_dm_setup_file ..." echo '#!/bin/sh' >> $kdm_setup_file echo 'xrandr --setprovideroutputsource modesetting NVIDIA-0' >> $kdm_setup_file echo 'xrandr --auto' >> $kdm_setup_file echo "[OK] kdm configured." fi echo "Getting the correct Bus ID ..." pci_bus_id=`nvidia-xconfig --query-gpu-info | grep 'BusID : ' | cut -d ' ' -f6` echo $pci_bus_id echo -n "Is this the correct nvidia busid ? Press [enter] to continue, or type a new Bus ID: " read PARAM if [ ! -z $PARAM ]; then pci_bus_id=$PARAM fi echo "Using $pci_bus_id ..." echo "Generating new xorg.conf file ..." xorg_conf='Section "ServerLayout" Identifier "layout" Screen 0 "nvidia" Inactive "intel" EndSection Section "Device" Identifier "nvidia" Driver "nvidia" BusID "'$pci_bus_id'" EndSection Section "Screen" Identifier "nvidia" Device "nvidia" Option "AllowEmptyInitialConfiguration" EndSection Section "Device" Identifier "intel" Driver "modesetting" EndSection Section "Screen" Identifier "intel" Device "intel" EndSection' echo "*** Generated xorg.conf file: " echo "$xorg_conf" echo "******************************" read -p "Are you sure? (a backup will be made) (Y/n) " -r XORG_CONFIRM_OVERRIDE if [ $XORG_CONFIRM_OVERRIDE = "y" ] || [ $XORG_CONFIRM_OVERRIDE = "Y" ]; then xorg_conf_f="/etc/X11/xorg.conf" echo "Creating $xorg_conf_f.backup" cp $xorg_conf_f "$xorg_conf_f.backup" echo "overriding with the new configuration ..." echo "$xorg_conf" > $xorg_conf_f else echo "operation aborted, exitting..." exit fi echo "Configuration done, try to reboot" |
[code] example of my xorg.conf
Section "ServerLayout" Identifier "layout" Screen 0 "nvidia" Inactive "intel" EndSection Section "Device" Identifier "nvidia" Driver "nvidia" VendorName "NVIDIA Corporation" BoardName "GeForce 940MX" BusID "PCI:1:0:0" EndSection Section "Screen" Identifier "nvidia" Device "nvidia" Option "AllowEmptyInitialConfiguration" EndSection Section "Device" Identifier "intel" Driver "modesetting" EndSection Section "Screen" Identifier "intel" Device "intel" EndSection |
---
[2022-07-15] 新規
[ ]