LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 02-09-2021, 03:00 PM   #1
pr0xibus
Member
 
Registered: Apr 2004
Location: Scotland
Distribution: Slackware
Posts: 215

Rep: Reputation: 44
Current- Nvidia Optimus - Use Dedicated Card


Evening folks

I have an HP Omen Laptop with the Intel GPU and a GTX 1050, for a while I was happy with having to use prime_render_offload to run an application that required me to use the dedicated card, to be honest I wasnt going to change it until today.

I have another HP Omen, and just on the off change I wanted to have a look at Fedora (something I am contemplating putting on the kids computers).

Anyway after installing Fedora, and installing the Nvidia drivers, I noticed a section "enable NVIDIA GPU of an Optimus-based laptop all the time" I couldn't see a section on the Slackware Documentation for this, so decided to just copy over the /etc/X11/xorg.conf.d/xorg.conf to slackware, surprised as the xorg was very different, it worked.

Code:
bash-5.1$ glxinfo | egrep "OpenGL vendor|OpenGL renderer"
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: GeForce GTX 1050/PCIe/SSE2
bash-5.1$
Nvidia-smi is showing load too

Code:
NVIDIA-SMI 460.39       Driver Version: 460.39       CUDA Version: 11.2     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  GeForce GTX 1050    Off  | 00000000:01:00.0 Off |                  N/A |
| N/A   43C    P8    N/A /  N/A |    212MiB /  2000MiB |     26%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|    0   N/A  N/A      1446      G   /usr/libexec/Xorg                 104MiB |
|    0   N/A  N/A      1521      G   /usr/bin/kwin_x11                  78MiB |
|    0   N/A  N/A      1588      G   /usr/bin/plasmashell               21MiB |
|    0   N/A  N/A      2129      G   /usr/lib64/firefox/firefox          1MiB
Anyway to the question at hand,
Apart from power saving is there any other benefit to using the Optimus technology? The intel GPU was more than capable for what I was doing, general Computer usage and some light gaming on steam

Using the Nvidia card to render everything I assume will free up the CPU to a certain extent?

Last edited by pr0xibus; 02-09-2021 at 03:15 PM.
 
Old 02-09-2021, 03:16 PM   #2
Daedra
Senior Member
 
Registered: Dec 2005
Location: Springfield, MO
Distribution: Slackware64-15.0
Posts: 2,683

Rep: Reputation: 1375Reputation: 1375Reputation: 1375Reputation: 1375Reputation: 1375Reputation: 1375Reputation: 1375Reputation: 1375Reputation: 1375Reputation: 1375
I recently bought a laptop with basically the same specs and did the exact same thing. I used the slackwiki to set up prime_render_offload but couldn't find a guide for setting the NVIDIA GPU as primary all the time. I ended up using information from arch and debian. It was a piece of cake but I noticed when using the NVIDIA GPU as primary all the time I was getting awful stuttering and tearing. Turns out I needed to enable prime synchronization. Once I did that it was smooth as butter and didn't have to use offload anymore. But I have since setup separate configs in /etc/X11/xorg.conf.d, one for nvidia only and one for prime_offload, and also also separate .xinitrc configs. This way if I am traveling and will have to be on battery power I can quicky switch back to prime_offload.

And as far as I know you are correct. The only real benefit of prime_offload is to save battery power. But anyone feel free to correct me if I am wrong.

Last edited by Daedra; 02-09-2021 at 03:22 PM.
 
Old 02-09-2021, 03:26 PM   #3
pr0xibus
Member
 
Registered: Apr 2004
Location: Scotland
Distribution: Slackware
Posts: 215

Original Poster
Rep: Reputation: 44
Thanks for the reply Daedra

Yes Between Slackware/Arch/Fedora wikis it worked a charm.

Yes I noticed some tearing, I also noticed the enable prime sync, will get onto that soon.

I wasnt really sure if I would keep it this way, but I suppose its no different from the folks on a normal PC having a dedicated card etc
 
Old 02-09-2021, 03:36 PM   #4
Daedra
Senior Member
 
Registered: Dec 2005
Location: Springfield, MO
Distribution: Slackware64-15.0
Posts: 2,683

Rep: Reputation: 1375Reputation: 1375Reputation: 1375Reputation: 1375Reputation: 1375Reputation: 1375Reputation: 1375Reputation: 1375Reputation: 1375Reputation: 1375
Quote:
Originally Posted by pr0xibus View Post
Thanks for the reply Daedra

Yes Between Slackware/Arch/Fedora wikis it worked a charm.

Yes I noticed some tearing, I also noticed the enable prime sync, will get onto that soon.

I wasnt really sure if I would keep it this way, but I suppose its no different from the folks on a normal PC having a dedicated card etc
To enable prime synchronization I used Arch wiki
https://wiki.archlinux.org/index.php...ynchronization

Be sure to do the steps mentioned in the box..
Code:
Note: A pre-requisite for PRIME sync with the NVidia driver is to enable modesetting.
After you are done and rebooted open NVIDIA X Server Settings and check the X Server Display Configuration tab and it will tell you if Prime Synchronization is enabled.
 
Old 02-09-2021, 03:44 PM   #5
pr0xibus
Member
 
Registered: Apr 2004
Location: Scotland
Distribution: Slackware
Posts: 215

Original Poster
Rep: Reputation: 44
Yeah thats the link I got,

Code:
root@darkstar:~# xrandr --prop | grep Synchronization
        PRIME Synchronization: 1 
        PRIME Synchronization: 1
worked a treat and no tearing.

Well I suppose ill just keep it as is, not hurting anything and now no need for the iGPU except as output really
 
Old 02-09-2021, 03:45 PM   #6
Daedra
Senior Member
 
Registered: Dec 2005
Location: Springfield, MO
Distribution: Slackware64-15.0
Posts: 2,683

Rep: Reputation: 1375Reputation: 1375Reputation: 1375Reputation: 1375Reputation: 1375Reputation: 1375Reputation: 1375Reputation: 1375Reputation: 1375Reputation: 1375
Quote:
Originally Posted by pr0xibus View Post
Yeah thats the link I got,

Code:
root@darkstar:~# xrandr --prop | grep Synchronization
        PRIME Synchronization: 1 
        PRIME Synchronization: 1
worked a treat and no tearing.

Well I suppose ill just keep it as is, not hurting anything and now no need for the iGPU except as output really
Yeah I am in the same boat. Because of covid I don't leave the house much, but when I start traveling again I will probably go back to prime_offload, but since I am always near an outlet, might as well just get max performance.
 
Old 02-10-2021, 03:34 PM   #7
pr0xibus
Member
 
Registered: Apr 2004
Location: Scotland
Distribution: Slackware
Posts: 215

Original Poster
Rep: Reputation: 44
Ill just put the full instructions here just incase anyone else needs the always on nvidia. Unsure if someone else with Optimus wants to try and update the slack wiki

1. You will need to have installed the NVIDIA Kernel & NVIDIA Driver from Slackbuilds
2. You will need to follow the instructions for prime Here


once the above is installed and running correctly follow below


edit /etc/X11/xorg.conf.d/xorg.conf and overwrite as per below
Code:
Section "OutputClass"
    Identifier "intel"
    MatchDriver "i915"
    Driver "modesetting"
EndSection

Section "OutputClass"
    Identifier "nvidia"
    MatchDriver "nvidia-drm"
    Driver "nvidia"
    Option "AllowEmptyInitialConfiguration"
    Option "PrimaryGPU" "yes"
    ModulePath "/usr/lib/nvidia/xorg"
    ModulePath "/usr/lib/xorg/modules"
EndSection
I am using elilo so I added nvidia-drm.modeset=1 to the end of append

Code:
root@darkstar:~# cat /boot/efi/EFI/Slackware/elilo.conf
chooser=simple
delay=1
timeout=1
#
image=vmlinuz-generic-5.10.14
        label=vmlinuz
        initrd=initrd.gz
        read-only
        append="root=/dev/slackware_vg/lv_root vga=normal ro nvidia-drm.modeset=1"
I created ~/.xinitrc and added to the start the NVIDIA-0 is the name, you can find this out at xrandr --listproviders
Code:
xrandr --setprovideroutputsource modesetting NVIDIA-0
xrandr --auto
reboot.

You can now restart the computer

startx ... Once it is up and running you can check the 2 commands below to see if they roughly match

Code:
glxinfo | egrep "OpenGL vendor|OpenGL renderer"
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: GeForce GTX 1050/PCIe/SSE2
run

xrandr --prop and look under the connected display, it should say PRIME Synchronization: 1

Some more information from Arch
Here
 
1 members found this post helpful.
Old 03-22-2021, 05:04 PM   #8
folkenfanel
Member
 
Registered: Sep 2004
Location: formerly Fanelia and Zaibach
Distribution: Slackware-current !
Posts: 342

Rep: Reputation: 59
Talking For anyone using the 390.xx driver

Hello.

I tried to follow that method with the "legacy" 390.141 driver and it does not work. Instead, what works with this legacy driver is, (provided you already have a working Nvidia driver installed, plus the kernel modules, plus bbswitch), a file (might be called 10-nvidia.conf) in /etc/X11/xorg.conf.d with the following options:

Code:
Section "Device"
    Identifier "intel"
    Driver "modesetting" #must be modesetting and NOT intel
    BusID "PCI:0:2:0" #must be specified
EndSection

Section "Device"
    Identifier "nvidia"
    Driver "nvidia"
    BusID "PCI:1:0:0" #must be specified
EndSection

Section "Screen"
    Identifier "nvidia"
    Device "nvidia"
EndSection

Section "ServerLayout"
    Identifier "layout"
    Screen 0 "nvidia"
    Inactive "intel" #must be inactive
EndSection
It seems to be necessary to add Inactive "intel", as told by Xorg.0.log:
Code:
[ 18034.287] (==) ServerLayout "layout"
[ 18034.287] (**) |-->Screen "nvidia" (0)
[ 18034.287] (**) |   |-->Monitor "eDP1"
[ 18034.287] (**) |   |-->Device "nvidia"
[ 18034.287] (**) |   |-->GPUDevice "nvidia"
[ 18034.287] (**) |-->Inactive Device "intel"
It is also necessary to edit your .xinitrc adding these lines:

Code:
xrandr --setprovideroutputsource modesetting NVIDIA-0
xrandr --auto
Preferrably near the top, and you might want to add "xrandr --dpi 96" too.

nvidia-settings shows a nice layout with PRIME: eDP-1-1 on it.

I don't know (haven't tested) if the more current driver works with SDDM or any login manager, but the legacy driver does not fully work, it gives me a black screen on logout and Xorg.0.log shows an error with the modesetting. Might want to try with CDM instead, or manually starting X from runlevel 3.

By the way, I have enabled modesetting with /etc/modprobe.d/nvidia.conf :
Code:
options nvidia-drm modeset=1
Made a tiny script to enable the card at boot with bbswitch (might be called nvidia-start and run from /etc/rc.d/rc.local) :
Code:
#!/bin/bash
modprobe nvidia-drm
modprobe nvidia-modeset
modprobe nvidia
tee /proc/acpi/bbswitch <<<ON
It works good so far except for mostly logging on runlevel 3 and using startx. Will try CDM for fun, and will most probably go back to just using the Intel card for everything and activating the Nvidia on demand XD.
 
Old 03-22-2021, 05:18 PM   #9
folkenfanel
Member
 
Registered: Sep 2004
Location: formerly Fanelia and Zaibach
Distribution: Slackware-current !
Posts: 342

Rep: Reputation: 59
By the way, to find your PCI IDs

Forgot to put this useful thing to find your PCI IDs:

Code:
lspci | grep -i 'vga\|3d'
That will show both your Intel and Nvidia cards with their PCI IDs.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Slackware Current kernel 3.14.16 and Nvidia Optimus abstradelic Slackware 38 12-31-2014 04:38 PM
NVIDIA Optimus + Bumblebee -> Nvidia X Server setting? cooltoad Linux - Hardware 4 02-05-2014 07:01 PM
[SOLVED] Turning off Nvidia GPU on Asus N53SV laptop. Nvidia Optimus. Installed Bumblebee Lop3 Linux - Laptop and Netbook 7 10-22-2013 07:11 AM
My laptop is Asus n43sl which use optimus card, How I know both of my vga card work? FredyD Ubuntu 7 10-02-2012 02:53 PM
NVIDIA GeForce GT 540M graphics & NVIDIA Optimus Technology rabizadeh_ehsan Linux - Hardware 5 10-21-2011 07:39 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 10:50 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration