Author Topic: Installation of nvidia prime on manjaro  (Read 9094 times)

0 Members and 2 Guests are viewing this topic.

Offline Doaxan

  • Neuling
  • *
  • Posts: 33
  • I'm new. Be nice!
  • Branch: unstable
  • Desktop: Manjaro i3, Bspwm
  • GPU Card: Intel HD4000 + Nvidia GTX660M
  • GPU driver: non-free
  • Skill: Intermediate
Installation of nvidia prime on manjaro
« on: 27. February 2016, 15:35:09 »
As I managed to launch nvidia prime under manjaro, I decided to share experience of installation and setup of this. But for a start, let's learn in what differences of nvidia prime from bumblebee, it is absolutely different approaches of use of the nvidia optimus technology which aren't combined with each other.

In what advantages of nvidia prime over bumblebee:
The video card nvidia will be used by default
It means that system and the applications started in it will work only at the discrete video card, it isn't necessary to start every time applications by means of the optirun command from bumblebee package.

Higher performance, in comparison with bumblebee
It isn't always correct, but in some applications it is possible because prime works through DMA, in difference from bumblebee which uses a random access memory.

Graphically, the system becomes more responsive

But there are some problems:
overheating
As the discrete video card will work for all applications, it can become the reason of overheating of your device. On devices with the good cooling system everything is normal well.

Tearing (the effect of "torn" image)
Don't try to get rid of a tearing, at the time of writing of article (27.02.16) there is no method to get rid of it except how to use the built-in video card Intel with Option "DRI" "3" and bumblebee. But nvidia released patches, avoid the tearing, which should be available in the kernel version 4.5 and the new version of Xorg. Xorg 1.18 has no these patches.
You can recognize news by this problem according to this link: https://devtalk.nvidia.com/default/topic/775691/linux/vsync-issue-nvidia-prime-ux32vd-with-gt620-m-/5
Tearing should not be with the arrival of wayland, nvidia but not yet implemented wayland support for their video cards.
Check if you have tearing there, you can use this video: https://youtu.be/cuXsupMuik4

Installation:
During installation the following articles can be necessary for you:
https://wiki.archlinux.org/index.php/NVIDIA_Optimus From this article I adopted the most part of experience for setup.
https://wiki.manjaro.org/index.php?title=Mhwd
1) Delete the current video driver
You can make it through the graphic utility of mhwd, or delete drivers via the terminal
Code: [Select]
sudo mhwd -r pci video-hybrid-intel-nvidia-bumblebee
2) Install video-nvidia
Code: [Select]
sudo mhwd -i pci video-nvidia -f
3) Edit the file /etc/X11/xorg.conf.d/90-mhwd.conf
The file is the link on /etc/X11/mhwd.d/nvidia.conf, but doesn't matter you change the file itself or delete the link and you will create the 90-mhwd.conf.
Code: [Select]
sudo nano /etc/X11/xorg.conf.d/90-mhwd.conf
Don't try to use the standard file 90-mhwd generated by mhwd, you receive the "blank" console at best, and in the worst you will lose control over system.

The file 90-mhwd.conf for Lenovo y580 notebook (Intel HD4000 + Nvidia gtx 660m) mhwd generated by default:
Code: [Select]
# nvidia-xconfig: X configuration file generated by nvidia-xconfig
# nvidia-xconfig: version 352.79 (buildmeister@swio-display-x64-rhel04-15) Wed Jan 13 17:02:24 PST 2016

Section "ServerLayout"
Identifier "Layout0"
Screen 0 "Screen0" 0 0
InputDevice "Keyboard0" "CoreKeyboard"
InputDevice "Mouse0" "CorePointer"
EndSection

Section "Files"
EndSection

Section "InputDevice"

# generated from default
Identifier "Mouse0"
Driver "mouse"
Option "Protocol" "auto"
Option "Device" "/dev/psaux"
Option "Emulate3Buttons" "no"
Option "ZAxisMapping" "4 5"
EndSection

Section "InputDevice"

# generated from default
Identifier "Keyboard0"
Driver "kbd"
EndSection

Section "Monitor"
Identifier "Monitor0"
VendorName "Unknown"
ModelName "Unknown"
HorizSync 28.0 — 33.0
VertRefresh 43.0 — 72.0
Option "DPMS"
EndSection

Section "Device"
Identifier "Device0"
Driver "nvidia"
VendorName "NVIDIA Corporation"
Option "NoLogo" "1"
Option "metamodes" "nvidia-auto-select +0+0 { ForceFullCompositionPipeline = On }"
EndSection

Section "Screen"
Identifier "Screen0"
Device "Device0"
Monitor "Monitor0"
DefaultDepth 24
SubSection "Display"
Depth 24
EndSubSection
EndSection

Section "Extensions"
Option "Composite" "Enable"
EndSection

Section "InputClass"
Identifier "Keyboard Defaults"
MatchIsKeyboard "yes"
Option "XkbOptions" "terminate:ctrl_alt_bksp"
EndSection

It is necessary to change this file 90-mhwd.conf, to a working for nvidia prime:
Code: [Select]
# nvidia-xconfig: X configuration file generated by nvidia-xconfig
# nvidia-xconfig: version 352.79 (buildmeister@swio-display-x64-rhel04-15) Wed Jan 13 17:02:24 PST 2016

Section "ServerLayout"
Identifier "Layout0"
Screen 0 "Screen0"
Inactive "intel"
InputDevice "Keyboard0" "CoreKeyboard"
InputDevice "Mouse0" "CorePointer"
EndSection

Section "Files"
EndSection

Section "InputDevice"

# generated from default
Identifier "Mouse0"
Driver "mouse"
Option "Protocol" "auto"
Option "Device" "/dev/psaux"
Option "Emulate3Buttons" "no"
Option "ZAxisMapping" "4 5"
EndSection

Section "InputDevice"

# generated from default
Identifier "Keyboard0"
Driver "kbd"
EndSection

Section "Monitor"
Identifier "Monitor0"
VendorName "Unknown"
ModelName "Unknown"
HorizSync 28.0 — 33.0
VertRefresh 43.0 — 72.0
Option "DPMS"
EndSection

Section "Device"
Identifier "Device0"
Driver "nvidia"
BusID "PCI:1:0:0"
VendorName "NVIDIA Corporation"
Option "NoLogo" "1"
Option "metamodes" "nvidia-auto-select +0+0 { ForceFullCompositionPipeline = On }"
EndSection

Section "Screen"
Identifier "Screen0"
Device "Device0"
Monitor "Monitor0"
DefaultDepth 24
SubSection "Display"
Depth 24
EndSubSection
Option "AllowEmptyInitialConfiguration" "Yes"
# Change to your resolution
Monitor "1920x1080"
EndSection

Section "Device"
Identifier "intel"
Driver "modesetting"
BusID "PCI:0:2:0"
Option "AccelMethod" "sna"
Option "DRI" "3"
EndSection

Section "Screen"
Identifier "intel"
Device "intel"
EndSection

Section "Extensions"
Option "Composite" "Enable"
EndSection

Section "InputClass"
Identifier "Keyboard Defaults"
MatchIsKeyboard "yes"
Option "XkbOptions" "terminate:ctrl_alt_bksp"
EndSection

By means of the website https://www.diffchecker.com/diff you can compare the configuration file, to mine.
Shortly about modification of the file 90-mhwd.conf:
Change the section Section "ServerLayout", having cleaned 2 digits after Screen 0 "Screen0" and add the parameter Inactive "intel".
In the section Device relating to nvidia
Section "Device"
Identifier "Device0"
Driver "nvidia"

add BusID "PCI:1:0:0", where "PCI:1:0:0" specify the address of the discrete video card nvidia which can be learned a command:
Code: [Select]
lspci | grep -E "VGA|3D"Output:
Code: [Select]
00:02.0 VGA compatible controller: Intel Corporation 3rd Gen Core processor Graphics Controller (rev 09)
01:00.0 VGA compatible controller: NVIDIA Corporation GK107M [GeForce GTX 660M] (rev ff)
In the section Section "Screen" add the parameter Option "AllowEmptyInitialConfiguration" "Yes" and Monitor "1920x1080", where "1920x1080 specify the resolution of the display.
After the end of the section Section "Screen" ... EndSection add the following 2 sections:
Code: [Select]
Section "Device"
Identifier "intel"
Driver "modesetting"
# Change to your PCI
BusID "PCI:0:2:0"
Option "AccelMethod" "sna"
Option "DRI" "3"
EndSection

Section "Screen"
Identifier "intel"
Device "intel"
EndSection
Don't forget to specify the address PCI for the built-in video card Intel.

4) Change the file of $ ~/.xinitrc, having added the following two lines to the beginning of the file:
Code: [Select]
nano ~/.xinitrcxrandr --setprovideroutputsource modesetting NVIDIA-0
xrandr --auto

5) Change the settings of your window manager (graphical login manager), depending on whether you are using:
!SDDM:
Code: [Select]
sudo nano /usr/share/sddm/scripts/Xsetupxrandr --dpi 142
xrandr --setprovideroutputsource modesetting NVIDIA-0
xrandr --auto

!LightDM:
Code: [Select]
sudo nano /etc/lightdm/display_setup.shxrandr --setprovideroutputsource modesetting NVIDIA-0
xrandr --auto

Make the script executable:
# chmod +x /etc/lightdm/display_setup.sh

Now configure lightdm to run the script by editing the [SeatDefaults] section in /etc/lightdm/lightdm.conf:
Code: [Select]
sudo nano /etc/lightdm/lightdm.conf[SeatDefaults]
display-setup-script=/etc/lightdm/display_setup.sh
« Last Edit: 27. February 2016, 17:52:11 by Doaxan »

Offline przemuz

  • Neuling
  • *
  • Posts: 24
  • Desktop: KDE
  • GPU Card: nVidia 660m
  • Skill: Novice
Re: Installation of nvidia prime on manjaro
« Reply #1 on: 23. March 2016, 16:51:37 »
Can I change to intel if I dont need nvidia when I for example dont have charger? Like prime-indicator http://www.webupd8.org/2014/01/prime-indicator-lets-you-quickly-switch.html

Offline eduardo

  • Sr. Mitglied
  • ****
  • Posts: 316
  • Branch: testing
  • Desktop: KDE plasma 5
  • GPU Card: Intel HDGraphics 4400 / Nvidia Geforce 960M
  • GPU driver: non-free on nvidia
  • Kernel: linux44, linux45_RC
  • Skill: Novice
Re: Installation of nvidia prime on manjaro
« Reply #2 on: 10. May 2016, 18:23:22 »
Did you manage to run vulkan apps with that approach? Since bumblebee doesnt support it.
But seems to be than the latest driver has this feature than looks more ideal
http://us.download.nvidia.com/XFree86/Linux-x86/364.19/README/randr14.html