Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Getting started with NVIDIA
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
lars_the_bear
Guru
Guru


Joined: 05 Jun 2024
Posts: 520

PostPosted: Mon Sep 02, 2024 8:44 am    Post subject: Getting started with NVIDIA Reply with quote

Hi folks

I have a laptop with hybrid Intel/NVIDIA graphics. To the best of my knowledge, the NVIDIA part has never been used. I have no NVIDIA-specific drivers or tools.

I've heard that Darktable might work better if I can bring the NVIDIA part into play somehow although, to be honest, I have no idea how. There's plenty of documentation -- for Gentoo and elsewhere -- but it's all written for people who have a clue. I come across terms like 'switcheroo', 'bumblebee', 'opencl', and so on, and I don't have the faintest idea what these things mean.

I'm looking for "NVIDIA for dummies" or something like that. Is there a good starting point for somebody who is familiar with Linux, but knows absolutely nothing about graphics?

BR, Lars.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54577
Location: 56N 3W

PostPosted: Mon Sep 02, 2024 12:51 pm    Post subject: Reply with quote

You have an Optimus graphics system.
In reality, it's one and a half Graphics systems.
Only the Intel part is connected to the display, so it must always be in use or you will only get a black screen.

The two GPUs share a pixel buffer, so either can render the image to be displayed.
you need the Optimus Gentoo Wiki page.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
lars_the_bear
Guru
Guru


Joined: 05 Jun 2024
Posts: 520

PostPosted: Mon Sep 02, 2024 1:28 pm    Post subject: Reply with quote

NeddySeagoon wrote:

you need the Optimus Gentoo Wiki page.


Thanks. But... this looks really complicated. And, more to the point, it looks like the kind of thing that, if it goes wrong, would leave me with an unusable computer. Do you (or anybody) know what the critical step is? That is, is there some specific change I could revert, using a Live USB boot, to set everything back the way it was?

I don't think I can experiment with this in a virtual machine, because it's hardware-dependent.

BR, Lars.
Back to top
View user's profile Send private message
Banana
Moderator
Moderator


Joined: 21 May 2004
Posts: 1727
Location: Germany

PostPosted: Mon Sep 02, 2024 1:34 pm    Post subject: Reply with quote

I don't use it but the wiki suggest using this: https://wiki.gentoo.org/wiki/Hybrid_graphics

And there should nothing in it which results in an unuseable computer. Document everything you change along the way and you can revert.
_________________
Forum Guidelines

PFL - Portage file list - find which package a file or command belongs to.
My delta-labs.org snippets do expire
Back to top
View user's profile Send private message
lars_the_bear
Guru
Guru


Joined: 05 Jun 2024
Posts: 520

PostPosted: Mon Sep 02, 2024 2:05 pm    Post subject: Reply with quote

Banana wrote:
Document everything you change along the way and you can revert.


Um... yeah. I'm not sure I'm brave enough. Not with a computer that I actually use every day.

The problem is that there's an entire vocabulary here, that I'm completely unfamiliar with. What are CUDA, Vulkan, Bumblebee, OpenCL? These terms appear all over the place, without much explanation. I understand that there are both proprietary and open-source X11 drivers for NVIDIA devices. Which should I use, in which circumstances?

I'm not asking anybody to answer these questions -- I just hoped there would be some numpty documentation somewhere. All the documentation seems to be written for people who don't actually need it.

BR, Lars.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54577
Location: 56N 3W

PostPosted: Mon Sep 02, 2024 3:47 pm    Post subject: Reply with quote

lars_the_bear,

In the course of the setup, you will write an xorg.conf.d fragment.
Deleting this will restore abnormality. :)

If you start Xorg from the command line, with startx (requires some configuration), the you can do startx:sleep 60 && killall X
to let Xorg run for 60 sec then get killed, regardless of it working or not.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
lars_the_bear
Guru
Guru


Joined: 05 Jun 2024
Posts: 520

PostPosted: Tue Sep 03, 2024 7:07 am    Post subject: Reply with quote

NeddySeagoon wrote:

If you start Xorg from the command line, with startx (requires some configuration), the you can do startx:sleep 60 && killall X
to let Xorg run for 60 sec then get killed, regardless of it working or not.


OK. Thanks. I wil try this, when the time comes.

BR, Lars.
Back to top
View user's profile Send private message
spica
Guru
Guru


Joined: 04 Jun 2021
Posts: 330

PostPosted: Tue Sep 03, 2024 11:05 am    Post subject: Re: Getting started with NVIDIA Reply with quote

lars_the_bear wrote:
I come across terms like 'switcheroo', 'bumblebee', 'opencl', and so on, and I don't have the faintest idea what these things mean


If I want to run a game on NVIDIA card then I set two additional env variables, and libglvnd does the rest of magic:
Code:
__NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia mygame


If you want to check if the approach with env vars works for you, check what card is written in glxinfo output:
Code:
__NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia glxinfo



I never used swicheroo or bumblebe. I think they are not needed nowadays.
Back to top
View user's profile Send private message
lars_the_bear
Guru
Guru


Joined: 05 Jun 2024
Posts: 520

PostPosted: Tue Sep 03, 2024 1:15 pm    Post subject: Re: Getting started with NVIDIA Reply with quote

spica wrote:

If I want to run a game on NVIDIA card then I set two additional env variables, and libglvnd does the rest of magic:


Thanks, but I guess there a ton of installation and configuration before I get to a point where I can do that, right?

BR, Lars?
Back to top
View user's profile Send private message
spica
Guru
Guru


Joined: 04 Jun 2021
Posts: 330

PostPosted: Tue Sep 03, 2024 1:23 pm    Post subject: Re: Getting started with NVIDIA Reply with quote

lars_the_bear wrote:
Thanks, but I guess there a ton of installation and configuration before I get to a point where I can do that, right?


Emerge nvidia-drivers, reboot, make sure the driver is loaded - and this is all I did for my laptop
Code:
$ __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia glxinfo | grep -i renderer\ string
OpenGL renderer string: NVIDIA GeForce 940MX/PCIe/SSE2

$ glxinfo | grep -i renderer\ string
OpenGL renderer string: Mesa Intel(R) HD Graphics 630 (KBL GT2)
Back to top
View user's profile Send private message
Fitzcarraldo
Advocate
Advocate


Joined: 30 Aug 2008
Posts: 2052
Location: United Kingdom

PostPosted: Wed Sep 04, 2024 1:51 am    Post subject: Reply with quote

I took the following steps:

Deleted the file /etc/X11/xorg.conf

Created the file /etc/X11/xorg.conf.d/01-nvidia-offload.conf containing the following:

Code:
Section "ServerLayout"
        Identifier "layout"
        Option "AllowNVIDIAGPUScreens"
    EndSection


Removed all references to the libglvnd USE flag from /etc/portage/make.conf, and the only place I declare libglvnd explicitly is in the file /etc/portage/package.use/libglvnd because I have a multilib installation:

Code:
# grep libglvnd /etc/portage/package.*/*
/etc/portage/package.use/libglvnd:>=media-libs/libglvnd-1.3.1 abi_x86_32


I have the following line in /etc/portage/make.conf:

Code:
$ grep VIDEO_CARDS /etc/portage/make.conf
VIDEO_CARDS="intel modesetting nvidia"


Re-merged the video drivers, X server and MESA library:

Code:
# emerge -1v nvidia-drivers mesa xorg-server xorg-drivers


I use the LightDM display manager, so I deleted the line 'display-setup-script=/etc/X11/Sessions/plasma' in /etc/lightdm/lightdm.conf, and deleted the script /etc/X11/Sessions/plasma as it no longer worked and the xrandr commands in it were no longer necessary in any case.

The command 'xrandr --listproviders' lists both the NVIDIA and Intel video devices:

Code:
$ xrandr --listproviders
Providers: number : 2
Provider 0: id: 0x47 cap: 0xb, Source Output, Sink Output, Sink Offload crtcs: 4 outputs: 4 associated providers: 0 name:Intel
Provider 1: id: 0x203 cap: 0x0 crtcs: 0 outputs: 0 associated providers: 0 name:NVIDIA-G0


(Notice above that the name of the NVIDIA video provider in my case is 'NVIDIA-G0')

The default is to use the Intel IGP:

Code:
$ glxinfo | grep -E 'OpenGL (vendor|renderer)'
OpenGL vendor string: Intel Open Source Technology Center
OpenGL renderer string: Mesa DRI Intel(R) HD Graphics 4600 (HSW GT2)
$ __NV_PRIME_RENDER_OFFLOAD_PROVIDER=Intel __GLX_VENDOR_LIBRARY_NAME=mesa glxinfo  | grep -E 'OpenGL (vendor|renderer)'
OpenGL vendor string: Intel Open Source Technology Center
OpenGL renderer string: Mesa DRI Intel(R) HD Graphics 4600 (HSW GT2)


unless I use environment variables explicitly to specify that the NVIDIA GPU be used for a specific application:

Code:
$ __NV_PRIME_RENDER_OFFLOAD_PROVIDER=NVIDIA-G0 __GLX_VENDOR_LIBRARY_NAME=nvidia glxinfo  | grep -E 'OpenGL (vendor|renderer)'
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: GeForce GTX 860M/PCIe/SSE2


Performance is reasonable:

Code:
$ __NV_PRIME_RENDER_OFFLOAD_PROVIDER=NVIDIA-G0 __GLX_VENDOR_LIBRARY_NAME=nvidia __GL_SYNC_TO_VBLANK=0 glxgears
36483 frames in 5.0 seconds = 7293.110 FPS
39076 frames in 5.0 seconds = 7815.150 FPS
38702 frames in 5.0 seconds = 7740.390 FPS
37127 frames in 5.0 seconds = 7425.299 FPS
44187 frames in 5.0 seconds = 8837.364 FPS
^C


To run a program such as LibreCAD using the NVIDIA GPU I can do the following:

Code:
$ __NV_PRIME_RENDER_OFFLOAD_PROVIDER=NVIDIA-G0 __GLX_VENDOR_LIBRARY_NAME=nvidia librecad

_________________
Clevo W230SS: amd64, VIDEO_CARDS="intel modesetting nvidia".
Compal NBLB2: ~amd64, xf86-video-ati. Dual boot Win 7 Pro 64-bit.
OpenRC systemd-utils[udev] elogind KDE on both.

My blog
Back to top
View user's profile Send private message
lars_the_bear
Guru
Guru


Joined: 05 Jun 2024
Posts: 520

PostPosted: Wed Sep 04, 2024 7:50 am    Post subject: Reply with quote

@Fitzcarraldo: Thank you.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum