You are not logged in.

#1 2017-07-24 22:42:05

LinG
Member
Registered: 2017-07-23
Posts: 35

[SOLVED] Confused with Nvidia Optimus drivers

Since I have a laptop with both an intel gpu and nvidia 940mx I am trying to follow this guide

First step

 lspci | grep -E "VGA|3D" 

is fine and it shows me 01:00.0 just as in the guide.

I checked my xorg version with

 Xorg -version 

and it returns 1.19.3, so far so good.

but I don't have the /etc/X11/xorg.conf file? So I should just make one and put the information in as the guide suggests?

and I also don't have an .xinitrc in my home directory do I also need to make that and put in the information as the guide suggests? The guide says "add the following two lines to the beginning of ..." but I don't even have that file in the first place... that kind of worries me, that I did something wrong along the way to not have that file...

Last edited by LinG (2017-07-27 17:02:05)

Offline

#2 2017-07-24 23:21:47

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: [SOLVED] Confused with Nvidia Optimus drivers

By default you won't have an xorg.conf, you'll need to create it (or better still create a drop-in snippet in the /etc/X11/xorg.conf.d directory).

You will only have an ~/.xinitrc if you use startx to start your desktop, if you use a display manager instead then keep reading the wiki page - especially the section 'Display Managers'.


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#3 2017-07-26 10:39:27

LinG
Member
Registered: 2017-07-23
Posts: 35

Re: [SOLVED] Confused with Nvidia Optimus drivers

I would like to ask a follow-up question to this, referring to your comment between the braces.

1. So to do that I would have to create a xx-name.conf with the content that I was going to put into the xorg.conf file, for example, a file called 10-nvidiaoptimus.conf.
2. I suppose any name of my liking would work for this? (Such as nvidiaoptimus in this case)
3. The wiki mentions that the number in front of the dash is used to prioritize which conf files are loaded first and it also mentions that xorg is normally loaded after that so in order to load the information that I would normally load in xorg.conf last inside the xorg.conf.d directory I would give it the number 99? To make sure it is loaded last? (So 99-nvidiaoptimus.conf would be the correct way to go?)

Offline

#4 2017-07-26 11:40:31

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 78,877

Re: [SOLVED] Confused with Nvidia Optimus drivers

Yes, though GPU configs tend to be on 20, ie 20-nvidia.conf

Before you're off track: Do you understand that there different HW setups and different approaches to use this hardware?
You cannot just follow the wiki from top to bottom, but must first figure

a) whether this is a dual or hybrid graphics stack (check lspci, the dfference between "VGA" and "3D controller" is important
b) whether you want to use only one of the GPUs (if possible) and which or whether you'd like to invoke the stronger one conditionally (eg. for games) to save battery

Offline

#5 2017-07-26 12:04:42

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: [SOLVED] Confused with Nvidia Optimus drivers

If you only have the one .conf file in /etc/X11/xorg.conf.d/ then it doesn't matter what number you give it - as it's the only file sourced.
The numbering only matters when you have more than one .conf file, to determine in which order they are parsed.

I'd go with 10-nvidiaoptimus.conf for now, If you end up adding more .conf files later then you would probably want them to be after the nvidia driver has been set up so this gives you everything >10 still available.


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#6 2017-07-26 13:53:20

LinG
Member
Registered: 2017-07-23
Posts: 35

Re: [SOLVED] Confused with Nvidia Optimus drivers

seth wrote:

Before you're off track: Do you understand that there different HW setups and different approaches to use this hardware?

I thought I did...

When I was using ubuntu, I could switch between my intel and nvidia graphics using the nvidia-settings GUI in a section called "prime profiles" manually.

Now back to Arch, when I wanted to install the nvidia drivers the wiki page referred me to the optimus page as my laptop has both an intel and a nvidia gpu. The problem is that the option that would be most similar to when I was using ubuntu is not listed on that page and the closest thing was the second option which was the official nvidia optimus. Wikipedia nvidia optimus technology tells me that "depending on the resource load generated by client software applications, will seamlessly switch between two graphics adapters within a computer system in order to provide either maximum performance or minimum power draw from the system's graphics rendering hardware".

So I was like, sweet, now I don't have to do it manually. So I followed the steps under "Using Nvidia" on this page with your recommendation of using the 20-nvidia.conf, specifically:

 lspci | grep -E "VGA|3D" 
 /etc/X11/xorg.conf.d/20-nvidia.conf
Section "Module"
    Load "modesetting"
EndSection

Section "Device"
    Identifier "nvidia"
    Driver "nvidia"
    BusID "1:0:0"
    Option "AllowEmptyInitialConfiguration"
EndSection

and then because I use SDDM:

 /usr/share/sddm/scripts/Xsetup
xrandr --setprovideroutputsource modesetting NVIDIA-0
xrandr --auto
xrandr --dpi 96

But I'm still kind of confused with the wiki, as wikipedia states that optimus technology is made to automatically switch while the arch wiki says that it does not allow switching...

Offline

#7 2017-07-26 13:58:58

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 78,877

Re: [SOLVED] Confused with Nvidia Optimus drivers

Yes it does, but you want to use bumblebee.

Offline

#8 2017-07-26 14:23:13

LinG
Member
Registered: 2017-07-23
Posts: 35

Re: [SOLVED] Confused with Nvidia Optimus drivers

seth wrote:

Yes it does, but you want to use bumblebee.

I installed bumblebee and it seems to be working

 optirun glxgears -info 

gives me a window with gears but now nvidia settings doesn't work with the message "you do not appear to be using the NVIDIA X driver. Please edit blablabla"

Last edited by LinG (2017-07-26 14:23:37)

Offline

#9 2017-07-26 14:26:14

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 78,877

Re: [SOLVED] Confused with Nvidia Optimus drivers

tried to optirun nvidia-settings?

Offline

#10 2017-07-26 14:30:45

LinG
Member
Registered: 2017-07-23
Posts: 35

Re: [SOLVED] Confused with Nvidia Optimus drivers

seth wrote:

tried to optirun nvidia-settings?

yes and that gives the same error but this works

 optirun -b none nvidia-settings -c :8 

however, the information inside the settings is a bit weird, especially the X screen 0 dimensions which it lists as 640x480 while I have a 1080p screen

So my understanding is now this, please correct me if I'm wrong.

By using bumblebee in its default state, I am running everything on my computer using the integrated graphics and only if I specifically run things with optirun, it will perform this using the nvidia graphics card?

Last edited by LinG (2017-07-26 14:56:37)

Offline

#11 2017-07-26 15:07:14

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 78,877

Re: [SOLVED] Confused with Nvidia Optimus drivers

That's correct and the explanation for the synthetic resolution - the nvidia driver does not see a "real" screen.
Depending on your hardware, you'll have to use it as output provider, ultimately running everything on the nvidia chip unless you can turn the intel chip into an output provider.

Also we're very much back to "what you want to do".
The Ubuntu addition is basically an addition to nvidia-settings that conditionally restarts the X11 server. In that case you've basically two configs, one for the intel chip *only* and one for the nvidia chip *only*.
The restart however also implies being logged out.

Bumblebee works fundamentally different and more like the optimus was designed to be.

please state what you'd most like to do and dump the output of

lspci
xrandr -q
xrandr --listproviders

for a hardware overview.

Offline

#12 2017-07-26 18:43:08

LinG
Member
Registered: 2017-07-23
Posts: 35

Re: [SOLVED] Confused with Nvidia Optimus drivers

I wonder... I still have the /usr/share/sddm/scripts/Xsetup file that I made earlier, doesn't that mean that my desktop environment is still running using the nvidia gpu because of the NVIDIA-0 argument? Or is the zero a boolean for false, as in don't use nvidia?

Here is the output

00:00.0 Host bridge: Intel Corporation Skylake Host Bridge/DRAM Registers (rev 08)
00:02.0 VGA compatible controller: Intel Corporation HD Graphics 520 (rev 07)
00:14.0 USB controller: Intel Corporation Sunrise Point-LP USB 3.0 xHCI Controller (rev 21)
00:16.0 Communication controller: Intel Corporation Sunrise Point-LP CSME HECI #1 (rev 21)
00:17.0 SATA controller: Intel Corporation Sunrise Point-LP SATA Controller [AHCI mode] (rev 21)
00:1c.0 PCI bridge: Intel Corporation Device 9d10 (rev f1)
00:1c.4 PCI bridge: Intel Corporation Sunrise Point-LP PCI Express Root Port #5 (rev f1)
00:1d.0 PCI bridge: Intel Corporation Sunrise Point-LP PCI Express Root Port #9 (rev f1)
00:1f.0 ISA bridge: Intel Corporation Sunrise Point-LP LPC Controller (rev 21)
00:1f.2 Memory controller: Intel Corporation Sunrise Point-LP PMC (rev 21)
00:1f.3 Audio device: Intel Corporation Sunrise Point-LP HD Audio (rev 21)
00:1f.4 SMBus: Intel Corporation Sunrise Point-LP SMBus (rev 21)
01:00.0 3D controller: NVIDIA Corporation GM108M [GeForce 940MX] (rev a2)
02:00.0 Network controller: Intel Corporation Wireless 8260 (rev 3a)
03:00.0 Non-Volatile memory controller: Samsung Electronics Co Ltd NVMe SSD Controller SM951/PM951 (rev 01)

Screen 0: minimum 320 x 200, current 1920 x 1080, maximum 8192 x 8192
eDP-1 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 294mm x 165mm
   1920x1080     59.93*+
   1400x1050     59.98  
   1280x1024     60.02  
   1280x960      60.00  
   1024x768      60.04    60.00  
   960x720       60.00  
   928x696       60.05  
   896x672       60.01  
   800x600       60.00    60.32    56.25  
   700x525       59.98  
   640x512       60.02  
   640x480       60.00    59.94  
   512x384       60.00  
   400x300       60.32    56.34  
   320x240       60.05  
DP-1 disconnected (normal left inverted right x axis y axis)
HDMI-1 disconnected (normal left inverted right x axis y axis)
HDMI-2 disconnected (normal left inverted right x axis y axis)

Providers: number : 1
Provider 0: id: 0x46 cap: 0xf, Source Output, Sink Output, Source Offload, Sink Offload crtcs: 3 outputs: 4 associated providers: 0 name:modesetting
seth wrote:

please state what you'd most like to do

Come to think of it, I think the intended implementation of bumblebee is much more elegant than a switch that requires a re-login.

For default, I would like to run everything on my integrated graphics.
Additionally, programs that I think require graphical acceleration will always be run by the GPU.

Can I still use the nvidia-settings with the intel integrated graphics to detect the correct screen?

Maybe programs such as kdenlive could benefit from the GPU or if I plug in more monitors the integrated graphics becomes too slow and I want my desktop environment to run on the GPU

(A wild guess to achieve the first scenario: change the exec=kdenlive in the .desktop file to exec=optirun kdenlive?)

Last edited by LinG (2017-07-26 18:44:11)

Offline

#13 2017-07-26 19:06:52

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,435

Re: [SOLVED] Confused with Nvidia Optimus drivers

For that first sentence, potentially (in general if you intend to use bumblebee, it would be better to remove that so that it doesn't interfere), what is the output of a simple

glxinfo | grep renderer

?

The intel card is what drives your display, the nvidia card simply renders the image, so it's normal that you don't see your "screen" in nvidia-settings. The nvidia card doesn't see a screen it simply renders all OpenGL calls and passes the finished image to the intel card which then knows on which display to show said image. As for your wild guess, yes that's what you would have to do. The multi-monitor case might be a bit more complicated and dependent on which port you actually plug in your monitor and/or the hardware wiring (what's your laptop model exactly?) (case in point, on my laptop Acer Aspire V 5 all the outputs are wired to the intel card, so it doesn't matter which setup option I choose, the intel card will define where which image goes to)

Offline

#14 2017-07-26 19:20:53

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 78,877

Re: [SOLVED] Confused with Nvidia Optimus drivers

If you "only" want to use nvidia-settings to configure your outputs, that's not gonna work. KDE should come with it's own randr GUI (which is GPU agnostic) and you can also use "arandr" as desktop-agnostic GUI.
From my personal experience however I will say this: "man xrandr" and use that to configure your screens for deterministic results ;-)

As for the multiscreen performance, this is mostly a matter of compositing.
Run and dump (on the intel chip)

glxinfo -l | grep -E '(MAX_TEXTURE_SIZE|MAX_VIEWPORT_DIMS)'

If your desired global output dimensions outsize the smallest value of GL_MAX_TEXTURE_SIZE, things will be slow.
If they outsize the smallest GL_MAX_VIEWPORT_DIMS, that's not gonna work with the GL compositor at all.

KWin should also warn you in this case.

Offline

#15 2017-07-26 22:53:42

LinG
Member
Registered: 2017-07-23
Posts: 35

Re: [SOLVED] Confused with Nvidia Optimus drivers

V1del wrote:

  what's your laptop model exactly?

xiaomi air 13.3

V1del wrote:

what is the output of a simple

glxinfo | grep renderer

?

GLX_MESA_multithread_makecurrent, GLX_MESA_query_renderer, 
GLX_MESA_multithread_makecurrent, GLX_MESA_query_renderer, 
Extended renderer info (GLX_MESA_query_renderer):
OpenGL renderer string: Mesa DRI Intel(R) HD Graphics 520 (Skylake GT2) 
seth wrote:

Run and dump (on the intel chip)

 glxinfo -l | grep -E '(MAX_TEXTURE_SIZE|MAX_VIEWPORT_DIMS)' 
GL_MAX_TEXTURE_SIZE = 16384
GL_MAX_VIEWPORT_DIMS = 32768, 32768
GL_MAX_TEXTURE_SIZE = 16384
GL_MAX_VIEWPORT_DIMS = 32768, 32768
seth wrote:

From my personal experience however I will say this: "man xrandr" and use that to configure your screens for deterministic results ;-)

I like the sound of "deterministic results" I remember that when I was still using Ubuntu and I plugged in an external display I would get weird DPI settings and fonts that became super tiny...

seth wrote:

If your desired global output dimensions outsize the smallest value of GL_MAX_TEXTURE_SIZE, things will be slow. If they outsize the smallest GL_MAX_VIEWPORT_DIMS, that's not gonna work with the GL compositor at all

So let's say I wanted to use an external display of 1080p (1920×1080), and my laptop screen itself is also 1080p then that would be 3840x2160 < 32768x32768 and thus okay... I don't get what you mean with the other comment though, specifically "global output dimension" which dimension are you referring to?

V1del wrote:

case in point, on my laptop Acer Aspire V 5 all the outputs are wired to the intel card, so it doesn't matter which setup option I choose, the intel card will define where which image goes to

Wait... so for my understanding... if everything goes either through the intel (integrated) or nvidia (dedicated) gpu and in order for the nvidia driver to know the screen it has to go through the nvidia gpu, does that mean that, these are/were my situations:

1. When I installed just NVIDIA OPTIMUS, all my signals went through the nvidia driver but that behind the scenes the intel integrated graphics was used sometimes to render less demanding tasks?
2. Now that I installed bumblebee instead, it goes through the intel one instead, making the nvidia driver blind to the output screen since it doesn't go through it anymore, but tasks can still manually be rendered on the nvidia GPU and then passed to the intel integrated graphics before it is ultimately sent to the display?

Offline

#16 2017-07-27 06:33:40

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 78,877

Re: [SOLVED] Confused with Nvidia Optimus drivers

The size of the root window.
The outputs (monitor) viewports can be arbitrarily positioned (horizontally, verticall, overlapping or even disconnected, ie. with a gap inbetween)
Assuming the GL_MAX_TEXTURE_SIZE was only 2048, you could stack the outputs vertically only when overlapping 112px.
If it was 4096, you could arrange them horizontally, even with a 256px gap between them, ie. position the right monitor at a 2176px offset.

1. When I installed just NVIDIA OPTIMUS, all my signals went through the nvidia driver but that behind the scenes the intel integrated graphics was used sometimes to render less demanding tasks?

No. If you setup the system to use the nvidia chip exclusively, the intel chip just relays the output.

2. Now that I installed bumblebee instead,

Principally yes (without going into some details on why this is special with the nvidia blob and can be handled differently w/ the nouveau driver; inb4: nvidia-settings won't work when using nouveau either)

Offline

#17 2017-07-27 17:01:30

LinG
Member
Registered: 2017-07-23
Posts: 35

Re: [SOLVED] Confused with Nvidia Optimus drivers

Alright, cool, thanks for clearing up all my questions. As for my personal use case, right now I use my laptop 95% of the time next to a power plug so I'll probably stick with the Nvidia Optimus configuration but if I do desire a more portable workflow then I'll switch to bumblebee and thanks to you guys I now know how to.

Last edited by LinG (2017-07-27 17:02:46)

Offline

Board footer

Powered by FluxBB