# Can't configure Nvidia Optimus [SOLVED]

## neyuru

First things first. I don't have a laptop but a desktop with an intel xeon E3-1285v4 with P6300 integrated graphics and a nvidia Quadro RTX 4000 gpu. Can I configure optimus? If so, I am having this problem:

I set in BIOS the default graphics adapter as the onboard (intel iris P6300). Have installed:

```
media-libs/mesa-20.1.0

x11-drivers/nvidia-drivers-440.82-r3

(what other packages are relevant?) 
```

USE flags: cuda gallium nvenc vaapi vdpau

VIDEO_CARDS="nvidia i965 iris"

Followed the instructions in the gentoo wiki:

1) Made sure kernel settings are correct

2) The service "systemd-modules-load.service" is running

3) Used this conf file (making sure the  BUS ID is correct)

4) Configured the EDID and passed the lib as a kernel parameter at boot

5) Configured GDM (I am using GNOME) to execute the xrandr commands

The result: black screen on boot.  This is the xorg log file:

```
[     4.642] (--) Log file renamed from "/var/log/Xorg.pid-477.log" to "/var/log/Xorg.0.log"

[     4.642] 

X.Org X Server 1.20.7

X Protocol Version 11, Revision 0

[     4.642] Build Operating System: Linux 5.4.38-gentoo x86_64 Gentoo

[     4.642] Current Operating System: Linux localhost 5.4.38-gentoo #26 SMP PREEMPT Thu Jun 11 02:31:18 CDT 2020 x86_64

[     4.642] Kernel command line: root=PARTUUID=f26f5994-62dd-4a90-8c9b-fa316b3cf2b9 ro drm_kms_helper.edid_firmware=edid/monitor1.bin

[     4.642] Build Date: 11 June 2020  08:35:24AM

[     4.642]  

[     4.642] Current version of pixman: 0.38.4

[     4.642]    Before reporting problems, check http://wiki.x.org

   to make sure that you have the latest version.

[     4.642] Markers: (--) probed, (**) from config file, (==) default setting,

   (++) from command line, (!!) notice, (II) informational,

   (WW) warning, (EE) error, (NI) not implemented, (??) unknown.

[     4.642] (==) Log file: "/var/log/Xorg.0.log", Time: Thu Jun 11 16:47:41 2020

[     4.649] (==) Using config directory: "/etc/X11/xorg.conf.d"

[     4.649] (==) Using system config directory "/usr/share/X11/xorg.conf.d"

[     4.651] (==) ServerLayout "layout"

[     4.651] (**) |-->Screen "nvidia" (0)

[     4.651] (**) |   |-->Monitor "<default monitor>"

[     4.651] (**) |   |-->Device "nvidia"

[     4.651] (**) |   |-->GPUDevice "intel"

[     4.651] (==) No monitor specified for screen "nvidia".

   Using a default monitor configuration.

[     4.652] (**) |-->Inactive Device "intel"

[     4.652] (==) Automatically adding devices

[     4.652] (==) Automatically enabling devices

[     4.652] (==) Automatically adding GPU devices

[     4.652] (==) Max clients allowed: 256, resource mask: 0x1fffff

[     4.652] (WW) The directory "/usr/share/fonts/misc/" does not exist.

[     4.652]    Entry deleted from font path.

[     4.652] (WW) The directory "/usr/share/fonts/TTF/" does not exist.

[     4.652]    Entry deleted from font path.

[     4.652] (WW) The directory "/usr/share/fonts/OTF/" does not exist.

[     4.652]    Entry deleted from font path.

[     4.652] (WW) The directory "/usr/share/fonts/Type1/" does not exist.

[     4.652]    Entry deleted from font path.

[     4.652] (WW) The directory "/usr/share/fonts/100dpi/" does not exist.

[     4.652]    Entry deleted from font path.

[     4.652] (WW) The directory "/usr/share/fonts/75dpi/" does not exist.

[     4.652]    Entry deleted from font path.

[     4.652] (==) FontPath set to:

   

[     4.652] (==) ModulePath set to "/usr/lib64/xorg/modules"

[     4.652] (II) The server relies on udev to provide the list of input devices.

   If no devices become available, reconfigure udev or disable AutoAddDevices.

[     4.652] (II) Loader magic: 0x564993620d20

[     4.652] (II) Module ABI versions:

[     4.652]    X.Org ANSI C Emulation: 0.4

[     4.652]    X.Org Video Driver: 24.1

[     4.652]    X.Org XInput driver : 24.1

[     4.652]    X.Org Server Extension : 10.0

[     4.653] (++) using VT number 1

[     4.655] (II) systemd-logind: took control of session /org/freedesktop/login1/session/c1

[     4.656] (II) xfree86: Adding drm device (/dev/dri/card1)

[     4.657] (II) systemd-logind: got fd for /dev/dri/card1 226:1 fd 11 paused 0

[     4.657] (II) xfree86: Adding drm device (/dev/dri/card0)

[     4.658] (II) systemd-logind: got fd for /dev/dri/card0 226:0 fd 12 paused 0

[     4.661] (--) PCI:*(0@0:2:0) 8086:162a:1849:162a rev 10, Mem @ 0xed000000/16777216, 0xc0000000/268435456, I/O @ 0x0000f000/64, BIOS @ 0x????????/131072

[     4.661] (--) PCI: (1@0:0:0) 10de:1eb1:10de:12a0 rev 161, Mem @ 0xee000000/16777216, 0xd0000000/268435456, 0xe0000000/33554432, I/O @ 0x0000e000/128, BIOS @ 0x????????/524288

[     4.661] (II) LoadModule: "glx"

[     4.662] (II) Loading /usr/lib64/xorg/modules/extensions/libglx.so

[     4.668] (II) Module glx: vendor="X.Org Foundation"

[     4.668]    compiled for 1.20.7, module version = 1.0.0

[     4.668]    ABI class: X.Org Server Extension, version 10.0

[     4.668] (II) LoadModule: "nvidia"

[     4.669] (II) Loading /usr/lib64/xorg/modules/drivers/nvidia_drv.so

[     4.673] (II) Module nvidia: vendor="NVIDIA Corporation"

[     4.673]    compiled for 1.6.99.901, module version = 1.0.0

[     4.673]    Module class: X.Org Video Driver

[     4.673] (II) LoadModule: "modesetting"

[     4.674] (II) Loading /usr/lib64/xorg/modules/drivers/modesetting_drv.so

[     4.674] (II) Module modesetting: vendor="X.Org Foundation"

[     4.674]    compiled for 1.20.7, module version = 1.20.7

[     4.674]    Module class: X.Org Video Driver

[     4.674]    ABI class: X.Org Video Driver, version 24.1

[     4.675] (II) NVIDIA dlloader X Driver  440.82  Wed Apr  1 19:50:17 UTC 2020

[     4.675] (II) NVIDIA Unified Driver for all Supported NVIDIA GPUs

[     4.675] (II) modesetting: Driver for Modesetting Kernel Drivers: kms

[     4.675] (II) modeset(G0): using drv /dev/dri/card0

[     4.675] (WW) Falling back to old probe method for modesetting

[     4.675] (II) systemd-logind: releasing fd for 226:1

[     4.705] (II) Loading sub module "fb"

[     4.706] (II) LoadModule: "fb"

[     4.706] (II) Loading /usr/lib64/xorg/modules/libfb.so

[     4.707] (II) Module fb: vendor="X.Org Foundation"

[     4.707]    compiled for 1.20.7, module version = 1.0.0

[     4.707]    ABI class: X.Org ANSI C Emulation, version 0.4

[     4.707] (II) Loading sub module "wfb"

[     4.707] (II) LoadModule: "wfb"

[     4.707] (II) Loading /usr/lib64/xorg/modules/libwfb.so

[     4.708] (II) Module wfb: vendor="X.Org Foundation"

[     4.708]    compiled for 1.20.7, module version = 1.0.0

[     4.708]    ABI class: X.Org ANSI C Emulation, version 0.4

[     4.708] (II) Loading sub module "ramdac"

[     4.708] (II) LoadModule: "ramdac"

[     4.708] (II) Module "ramdac" already built-in

[     4.709] (EE) No devices detected.

[     4.709] (EE) 

Fatal server error:

[     4.709] (EE) no screens found(EE) 

[     4.709] (EE) 

Please consult the The X.Org Foundation support 

    at http://wiki.x.org

 for help. 

[     4.709] (EE) Please also check the log file at "/var/log/Xorg.0.log" for additional information.

[     4.709] (EE) 

[     4.729] (EE) Server terminated with error (1). Closing log file.
```

To enter a graphical session I have to remove the xorg.conf file (/etc/X11/xorg.conf.d/10-nvidia.conf). After entering this is the xorg log file:

external pastebin link

Before installing the intel graphics my desktop was configured to use the nvidia card. But now, I can only start a graphical session with the intel card. the nvidia card is not showing;

```
xrandr --listproviders

Providers: number : 1

Provider 0: id: 0x47 cap: 0xf, Source Output, Sink Output, Source Offload, Sink Offload crtcs: 3 outputs: 5 associated providers: 0 name:modesetting
```

And the nvidia settings, do not run anymore:

```

nvidia-settings

ERROR: Unable to load info from any available system
```

Help?Last edited by neyuru on Wed Jun 17, 2020 12:50 am; edited 1 time in total

----------

## alamahant

Hi here is mine xorg.conf

```

Section "ServerLayout"

   Identifier "layout"

   Screen 0 "nvidia"

   Inactive "intel"

EndSection

Section "Device"

   Identifier "nvidia"

   Driver "nvidia"

   BusID "PCI:1:0:0"

   Option "Coolbits" "28"

EndSection

Section "Screen"

   Identifier "nvidia"

   Device "nvidia"

   Option "AllowEmptyInitialConfiguration"

EndSection

Section "Device"

   Identifier "intel"

   Driver "modesetting"

   BusID "PCI:0:2:0"

EndSection

Section "Screen"

   Identifier "intel"

   Device "intel"

EndSection

```

I also couldnt get it working with the stock one.

Also 

if you "lsmod | grep nvidia" do you get correct output

Is your 

"eselect opengl set nvidia"

working?

Do you need all the EDID stuf?

 :Smile: 

----------

## Jaglover

Desktop computer with Optimus graphics? Never heard about such a computer before. Can you provide a link to the user manual?

----------

## neyuru

Hello alamahant!

 *alamahant wrote:*   

> 
> 
> if you "lsmod | grep nvidia" do you get correct output

 

```
lsmod

Module                  Size  Used by

nvidia_drm             45056  0

nvidia_modeset       1077248  1 nvidia_drm

nvidia              19980288  4 nvidia_modeset
```

(all other modules are not shown because I have built them into the kernel, including the intel drivers)

 *alamahant wrote:*   

> 
> 
> Is your 
> 
> "eselect opengl set nvidia"
> ...

 

No. And if I try to install app-eselect/eselect-opengl I get the error:

```
 * Error: The above package list contains packages which cannot be

 * installed at the same time on the same system.

  (app-eselect/eselect-opengl-1.3.1-r4:0/0::gentoo, ebuild scheduled for merge) pulled in by

    eselect-opengl

  (x11-base/xorg-server-1.20.7:0/1.20.7::gentoo, installed) pulled in by

    x11-base/xorg-server required by @selected 

```

 *alamahant wrote:*   

> 
> 
> Do you need all the EDID stuf?
> 
> 

 

I don't know   :Laughing: Last edited by neyuru on Mon Jun 15, 2020 6:18 pm; edited 1 time in total

----------

## neyuru

Hi Jaglover!

 *Jaglover wrote:*   

> Desktop computer with Optimus graphics? Never heard about such a computer before. Can you provide a link to the user manual?

 

That's what I am asking to see if it is possible to do. I built the desktop but, the relevant specs are the following;

Motherboard: AsrockRack C226M WS

Processor: Intel Xeon E3 1285v4 with integrated iris P6300 graphics

Discrete graphics: Nvidia Quadro RTX 4000

----------

## Jaglover

neyuru,

Optimus is certain kind of hybrid graphics, it is a hardware design, not software.

----------

## neyuru

 *Jaglover wrote:*   

> neyuru,
> 
> Optimus is certain kind of hybrid graphics, it is a hardware design, not software.

 

Long ago I bought a laptop (DELL E6440) that initially came configured with integrated graphics but no discrete card. I specifically bought this model because it had an external Gen 2 pcie express  that I intended to use with an eGPU (external GPU). At first, it didn't work but maybe 2 years later (2015 or so) new Nvidia drivers enabled optimus in my laptop with the eGPU (an enclosure + a desktop graphics card). I had it working with windows. Probably, as you said, the laptop already had some kind of hardware that permitted it to use optimus because, if I remember correctly, this model also had the option to configure it with a dGPU. It is entirelly posible that the motherboard had this feature, just turns out that the discrete card was not factory installed. But then again, it worked with an external GPU!

Anyways, Gentoo is now installed in this laptop (the current post refers to my desktop, not this laptop). Is there any way to see if it is really a hardware limitation? e.g.  if the laptop has something that my desktop doesn't have? Unfortunatelly I don't have the external enclosure to test optimus in the laptop, but can I probe it with some command? By the way, the desktop has a switch in bios which permits me to select the default graphics adapter. I also have a similar problem posted here which indicates that linux is able to switch the GPU on runtime. So I am still hopefull that it could work.

----------

## neyuru

From Bumblebee wiki:

 *Quote:*   

> Only laptops have these kind of nVidia Optimus card, so this project won't apply to desktops (for now). Cards from the 4xxM and newer series are all Optimus-enabled. The M stands for "Mobile". But having a 4xxM card isn't enough to be sure that you're having an Optimus laptop. There must also be an integrated video controller in your processor. To check that, run this command in a terminal:

 

in my desktop system:

```
lspci -vnn | grep '\''[030[02]\]'

00:02.0 VGA compatible controller [0300]: Intel Corporation Iris Pro Graphics P6300 [8086:162a] (rev 0a) (prog-if 00 [VGA controller])

01:00.0 VGA compatible controller [0300]: NVIDIA Corporation TU104GL [Quadro RTX 4000] [10de:1eb1] (rev a1) (prog-if 00 [VGA controller])
```

 *Quote:*   

> If it outputs two lines, then you're likely having an Optimus laptop. 

 

this could mean nothing but, it tested positive...

----------

## neyuru

According to gentoo's bumblebee wiki:

 *Quote:*   

> In order to allow easy enabling and disabling of the NVIDIA drivers, we need to disable the kms and uvm USE flags for the NVIDIA drivers:

 

But I do not want this as I intend to be using those cuda cores in my GPU, look at uvm USE flag:

```
equery uses nvidia-drivers

[ Legend : U - final flag setting for installation]

[        : I - package is installed with flag     ]

[ Colors : set, unset                             ]

 * Found these USE flags for x11-drivers/nvidia-drivers-440.82-r3:

 U I

 + + X           : Install the X.org driver, OpenGL libraries, XvMC libraries, and VDPAU libraries

 + + abi_x86_32  : 32-bit (x86) libraries

 - - compat      : Install non-GLVND libGL for backwards compatibility

 + + driver      : Install the kernel driver module

 - - gtk3        : Install nvidia-settings with support for GTK+ 3

 + + kms         : Enable support for kernel mode setting (KMS)

 + + libglvnd    : Use media-libs/libglvnd for dispatch

 + + multilib    : On 64bit systems, if you want to be able to compile 32bit and 64bit binaries

 - - static-libs : Build static versions of dynamic libraries as well

 + + tools       : Install additional tools such as nvidia-settings

 + + uvm         : Install the Unified Memory kernel module (nvidia-uvm) for sharing memory between CPU and GPU in CUDA programs

 - - wayland     : Enable dev-libs/wayland backend
```

so Bumblebee is probably outright discarded. But optimus???

----------

## neyuru

So, I managed to install windows on a spare drive. After installing drivers for both the iGPU and dGPU, the Nvidia control panel didn't show the option to switch graphics via Optimus. So that almost definitively says it all. However, the system did manage to handle monitors with each graphics card- I attached one monitor to each card and effectively each card managed to drive it, separately. 

What is this feature called? (the ability to use the two GPUs at once) Hybrid Graphics?

thanks!

EDIT: #### THE SETUP NOW WORKS UNDER GENTOO #### (SEE BELOW)Last edited by neyuru on Thu Jun 18, 2020 12:13 am; edited 2 times in total

----------

## Jaglover

 *neyuru wrote:*   

> What is this feature called? (the ability to use the two GPUs at once) Hybrid Graphics?

 

No. It is called one computer with two graphics cards. The idea of hybrid graphics is to use one video output via two different graphics chipsets, one chipset allows for power saving and the other one is used when more GPU processing power is needed. It was developed for laptops to prolong the run on battery.

----------

## neyuru

Thread solved!

EDIT: I thought that because "Optimus" didn't worked in Windows that was an indication that the hardware wasn't capable. But it is. I now have a working PRIME setup in my desktop. For details I refer anyone interested to the solution I found in nvidia forums

----------

## neyuru

I am happy to announce that PRIME is now working   :Very Happy: 

----------

