Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Nvidia Optimus: XrandR missing NVIDIA-0 provider
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
Arthanis
Apprentice
Apprentice


Joined: 21 Mar 2008
Posts: 161

PostPosted: Mon Feb 25, 2019 12:34 am    Post subject: Nvidia Optimus: XrandR missing NVIDIA-0 provider Reply with quote

I have a MSI GS65 laptop, and I have successfully setup my desktop environment with 3D acceleration on intel with modesetting by following: https://wiki.gentoo.org/wiki/Intel

That being said, using Intel, I do not have a /etc/X11/xorg.conf file, only /etc/X11/xorg.conf.d/20-modesetting.conf file containing the following snippet:

Code:

 cat /etc/X11/xorg.conf.d/20-modesetting.conf
Section "Device"
    Identifier  "Intel Graphics"
    Driver      "modesetting"
    Option      "AccelMethod"    "glamor"
    Option      "DRI"            "3"
    Option   "TearFree"   "true"
EndSection




When I start X by running
Code:
startxfce4
(as I avoid login managers), everything works fine with direct rendering on glxinfo and whatnot:

Code:

glxinfo |grep -i direct
direct rendering: Yes
    GL_ARB_derivative_control, GL_ARB_direct_state_access,
    GL_ARB_draw_elements_base_vertex, GL_ARB_draw_indirect,
    GL_ARB_half_float_vertex, GL_ARB_indirect_parameters,
    GL_ARB_multi_draw_indirect, GL_ARB_occlusion_query2,
    GL_ARB_draw_elements_base_vertex, GL_ARB_draw_indirect,
    GL_ARB_indirect_parameters, GL_ARB_instanced_arrays,
    GL_ARB_map_buffer_range, GL_ARB_multi_bind, GL_ARB_multi_draw_indirect,


Also, this is the output of my cat /var/log/Xorg.0.log: https://pastebin.com/2DjkmQN6

Here is my current /etc/portage/make.conf

Code:


# These settings were set by the catalyst build script that automatically
# built this stage.
# Please consult /usr/share/portage/config/make.conf.example for a more
# detailed example.

COMMON_FLAGS="-O2 -pipe -march=native"
CFLAGS="${COMMON_FLAGS}"
CXXFLAGS="${COMMON_FLAGS}"
FCFLAGS="${COMMON_FLAGS}"
FFLAGS="${COMMON_FLAGS}"
MAKEOPTS="-j13"
GRUB_PLATFORMS="efi-64 efi-32 multiboot"

# NOTE: This stage was built with the bindist Use flag enabled
PORTDIR="/usr/portage"
DISTDIR="/usr/portage/distfiles"
PKGDIR="/usr/portage/packages"

# This sets the language of build output to English.
# Please keep this setting intact when reporting bugs.
LC_MESSAGES=C

# EMERGE_DEFAULT_OPTS is set automatically by livecd-tools autoconfig during first live boot.
# This should be equal to number of processors, see "man emerge" for details.
#EMERGE_DEFAULT_OPTS="${EMERGE_DEFAULT_OPTS} --jobs=12 --load-average=12 --quiet-build=n"
EMERGE_DEFAULT_OPTS="${EMERGE_DEFAULT_OPTS} --jobs=1 --quiet-build=n"

VIDEO_CARDS="intel i965"

INPUT_DEVICES="synaptics libinput"

USE="acpi alsa bluetooth cryptsetup jpeg gtk libkms pdf png pulseaudio upower xfce samba -gnome -kde -sendmail"

GENTOO_MIRRORS="ftp://mirror.csclub.uwaterloo.ca/gentoo-distfiles/ https://mirror.csclub.uwaterloo.ca/gentoo-distfiles/ http://mirror.csclub.uwaterloo.ca/gentoo-distfiles/"
L10N="en"



Also, I'm running
Code:
Linux msi-gs65 4.19.23-gentoo #4 SMP Sun Feb 24 14:30:20 PST 2019 x86_64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz GenuineIntel GNU/Linux
and running the following modules:

Code:

lsmod
Module                  Size  Used by
rfcomm                 32768  12
fuse                  110592  3
dm_crypt               40960  1
algif_skcipher         16384  0
btusb                  49152  0
btrtl                  16384  1 btusb
btbcm                  16384  1 btusb
btintel                20480  1 btusb
bluetooth             417792  38 btrtl,btintel,btbcm,btusb,rfcomm
ecdh_generic           24576  2 bluetooth
iwlmvm                327680  0
dm_mod                126976  3 dm_crypt
mac80211              675840  1 iwlmvm
wmi_bmof               16384  0
intel_rapl             24576  0
mxm_wmi                16384  0
msi_wmi                16384  0
i915                 1626112  9
x86_pkg_temp_thermal    16384  0
intel_powerclamp       16384  0
i2c_algo_bit           16384  1 i915
iwlwifi               294912  1 iwlmvm
drm_kms_helper        159744  1 i915
syscopyarea            16384  1 drm_kms_helper
sysfillrect            16384  1 drm_kms_helper
aesni_intel           200704  10
alx                    45056  0
sysimgblt              16384  1 drm_kms_helper
aes_x86_64             20480  1 aesni_intel
fb_sys_fops            16384  1 drm_kms_helper
crypto_simd            16384  1 aesni_intel
cryptd                 20480  3 crypto_simd,aesni_intel
mdio                   16384  1 alx
glue_helper            16384  1 aesni_intel
drm                   397312  7 drm_kms_helper,i915
joydev                 24576  0
intel_gtt              24576  1 i915
xhci_pci               16384  0
i2c_i801               24576  0
cfg80211              651264  3 iwlmvm,iwlwifi,mac80211
agpgart                36864  2 intel_gtt,drm
rfkill                 24576  6 bluetooth,cfg80211
xhci_hcd              208896  1 xhci_pci
intel_pch_thermal      16384  0
wmi                    24576  3 wmi_bmof,msi_wmi,mxm_wmi
coretemp               16384  0
efivarfs               16384  1





However, since my laptop also contains a GTX 1070, I tried to follow https://wiki.gentoo.org/wiki/NVIDIA/Optimus to set it up, as I'm trying to avoid bumblebee as much as I can.

So, changed
Code:
VIDEO_CARDS="intel i965"
to
Code:
VIDEO_CARDS="intel i965 nvidia"
, which pulls a rebuild of xorg-drivers.

Code:

[I] x11-base/xorg-drivers
     Available versions:  1.20 **9999 {INPUT_DEVICES="elographics evdev joystick keyboard libinput mouse synaptics vmmouse void wacom" VIDEO_CARDS="amdgpu ast dummy fbdev freedreno geode glint i915 i965 intel mga nouveau nv nvidia omap qxl r128 radeon radeonsi siliconmotion tdfx tegra vc4 vesa via virtualbox vmware voodoo"}
     Installed versions:  1.20(03:42:33 PM 02/24/2019)(INPUT_DEVICES="libinput synaptics -elographics -evdev -joystick -keyboard -mouse -vmmouse -void -wacom" VIDEO_CARDS="i965 intel nvidia -amdgpu -ast -dummy -fbdev -freedreno -geode -glint -i915 -mga -nouveau -nv -omap -qxl -r128 -radeon -radeonsi -siliconmotion -tdfx -tegra -vc4 -vesa -via -virtualbox -vmware -voodoo")
     Homepage:            https://www.gentoo.org/
     Description:         Meta package containing deps on all xorg drivers



Then I proceeded to follow the wiki.

Emerge the following version and use flags for nvidia-drivers:

Code:

emerge -av nvidia-drivers

 * IMPORTANT: 2 news items need reading for repository 'gentoo'.
 * Use eselect news read to view new items.


These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild  N     ] dev-libs/jansson-2.11::gentoo  USE="-doc -static-libs" ABI_X86="(64) -32 (-x32)" 0 KiB
[ebuild  N     ] app-eselect/eselect-opencl-1.1.0-r4::gentoo  0 KiB
[ebuild  N     ] virtual/linux-sources-3::gentoo  USE="-firmware" 0 KiB
[ebuild  N     ] x11-libs/libvdpau-1.1.1::gentoo  USE="dri -doc -test" ABI_X86="32 (64) (-x32)" 0 KiB
[ebuild  N     ] sys-power/acpid-2.0.31::gentoo  USE="(-selinux)" 0 KiB
[ebuild  N     ] x11-drivers/nvidia-drivers-415.27:0/415::gentoo  USE="X acpi driver kms multilib tools -compat -gtk3 -static-libs -uvm -wayland" ABI_X86="32 (64) (-x32)" 0 KiB

Total: 6 packages (6 new), Size of downloads: 0 KiB




So, now I have nvidia drivers properly installed and loaded modules:

Code:

lsmod |grep nvidia
nvidia_drm             40960  1
nvidia_modeset       1003520  1 nvidia_drm
nvidia              16752640  1 nvidia_modeset
ipmi_msghandler        49152  1 nvidia
drm_kms_helper        159744  2 nvidia_drm,i915
drm                   397312  11 drm_kms_helper,nvidia_drm,i915


Also, nvidia card seems to be properly detected:

Code:

 dmesg |grep -i nvidia
[    2.168914] nvidia: loading out-of-tree module taints kernel.
[    2.169470] nvidia: module license 'NVIDIA' taints kernel.
[    2.185599] nvidia-nvlink: Nvlink Core is being initialized, major device number 246
[    2.185771] nvidia 0000:01:00.0: enabling device (0006 -> 0007)
[    2.185850] nvidia 0000:01:00.0: vgaarb: changed VGA decodes: olddecodes=io+mem,decodes=none:owns=none
[    2.397942] NVRM: loading NVIDIA UNIX x86_64 Kernel Module  415.27  Thu Dec 20 17:25:03 CST 2018 (using threaded interrupts)
[    4.722003] nvidia-modeset: Loading NVIDIA Kernel Mode Setting Driver for UNIX platforms  415.27  Thu Dec 20 17:06:08 CST 2018
[    4.728618] [drm] [nvidia-drm] [GPU ID 0x00000100] Loading driver
[    4.731113] [drm] Initialized nvidia-drm 0.0.0 20160202 for 0000:01:00.0 on minor 1
[    4.760436] nvidia-smi (2227) used greatest stack depth: 12504 bytes left


Code:

nvidia-smi
Sun Feb 24 15:58:09 2019       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 415.27       Driver Version: 415.27       CUDA Version: 10.0     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce GTX 107...  Off  | 00000000:01:00.0 Off |                  N/A |
| N/A   53C    P0    29W /  N/A |      0MiB /  8119MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+



So I now proceed to remove /etc/X11/xorg.conf.d/20-modesetting.conf and use nvidia-xconfig to generate the following /etc/X11/xorg.conf file:

Code:

# nvidia-xconfig: X configuration file generated by nvidia-xconfig
# nvidia-xconfig:  version 415.27

Section "ServerLayout"
    Identifier     "Layout0"
    Screen      0  "Screen0"
    Inactive       "Device1"
EndSection

Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    BusID          "PCI:1:0:0"
EndSection

Section "Device"
    Identifier     "Device1"
    Driver         "modesetting"
    VendorName     "Unknown"
EndSection

Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    DefaultDepth    24
    Option         "AllowEmptyInitialConfiguration" "True"
    SubSection     "Display"
        Depth       24
    EndSubSection
EndSection

Section "Screen"
    Identifier "Screen1"
    Device "Device1"
EndSection


As per documentation, the following commands are crucial for making it work before running startxfce4 or else you get a black screen:
Code:

xrandr --setprovideroutputsource modesetting NVIDIA-0
xrandr --auto


But when I run this, I get an error:
Code:

xrandr --setprovideroutputsource modesetting NVIDIA-0
Could not find provider with name NVIDIA-0


And, unsurprisingly, there is no NVIDIA-0 provider:

Code:

xrandr --listproviders
Providers: number : 1
Provider 0: id: 0x45 cap: 0xf, Source Output, Sink Output, Source Offload, Sink Offload crtcs: 3 outputs: 3 associated providers: 0 name:modesetting


XrandR version:
Code:

[I] x11-apps/xrandr
     Available versions:  1.4.3 1.5.0
     Installed versions:  1.5.0(03:54:29 AM 02/18/2019)
     Homepage:            https://www.x.org/wiki/ https://cgit.freedesktop.org/
     Description:         primitive command line interface to RandR extension


If I ignore this and run startxfce4 regardless, I get the dreaded black screen, but Xorg seems to work with nvidia, but without actual screen output. According to logs: https://pastebin.com/LGeTbqt2


Given all the above, I believe that the only thing missing is the XRandR output redirection. Does anyone have any idea on why the NVIDIA-0 provider isn't listed, and how to fix this? Thanks in advance.
Back to top
View user's profile Send private message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 7198

PostPosted: Mon Feb 25, 2019 10:02 am    Post subject: Reply with quote

I think it's the lack of informations about your monitor.
I never totally get optimus right, but if i'm not wrong, i think the monitor is attach to the intel card, and the nvidia drivers are unable to "see" the monitor themselves because none is attach to the nvidia card.
As the drivers see no monitor, they cannot compute any valid mode to use, resulting in black screen and no mode validate.

To me, you have just forgotten the https://wiki.gentoo.org/wiki/NVIDIA/Optimus#Using_a_specific_monitor_via_EDID step, and doing it should solve your issue.
If i could suggest, i find the provided xorg.conf example https://wiki.gentoo.org/wiki/NVIDIA/Optimus#Example_xorg.conf_for_EDID pretty good at showing how your xorg.conf should look like (specially look at the device section where you see the nvidia card)
Back to top
View user's profile Send private message
Arthanis
Apprentice
Apprentice


Joined: 21 Mar 2008
Posts: 161

PostPosted: Mon Feb 25, 2019 4:14 pm    Post subject: Reply with quote

First of all, thank you so much for your response. I forgot to mention that I had tried the edid firmware before and thought I had it loaded, however, I just realized this:

Code:

dmesg |grep -i edid
[    0.000000] Command line: BOOT_IMAGE=/vmlinuz-4.19.23-gentoo root=/dev/nvme0n1p6 ro drm_kms_helper.edid_firmware=edid/monitor.bin
[    0.290430] Kernel command line: BOOT_IMAGE=/vmlinuz-4.19.23-gentoo root=/dev/nvme0n1p6 ro drm_kms_helper.edid_firmware=edid/monitor.bin
[    2.136694] drm_kms_helper: unknown parameter 'edid_firmware' ignored



I'm gonna fix this and do some more testing and update here.
Back to top
View user's profile Send private message
Arthanis
Apprentice
Apprentice


Joined: 21 Mar 2008
Posts: 161

PostPosted: Mon Feb 25, 2019 8:12 pm    Post subject: Reply with quote

I fixed the kernel options to load the EDID, however the kernel now complains that the specified EDID is 256 bytes in size, and it expected 128 bytes.

I didn't have much luck googling for this. The only relevant information I found was this, from wikipedia:

EDID structure versions range from v1.0 to v1.4; all these define upwards-compatible 128-byte structures. Version 2.0 defined a new 256-byte structure but it has been deprecated and replaced by v1.3 which supports multiple extension blocks.[citation needed] HDMI versions 1.0–1.3c use EDID structure v1.3.[1]

So I'm not sure on how to proceed here, or if maybe this should be its own topic. Any advise is appreciated.
Back to top
View user's profile Send private message
hhfeuer
Apprentice
Apprentice


Joined: 28 Jul 2005
Posts: 184

PostPosted: Mon Feb 25, 2019 9:10 pm    Post subject: Reply with quote

Try adding
Code:
    Option         "AccelMethod" "none"
    BusID          "PCI:0:2:0"

to the intel device section.
Back to top
View user's profile Send private message
Arthanis
Apprentice
Apprentice


Joined: 21 Mar 2008
Posts: 161

PostPosted: Tue Feb 26, 2019 6:35 am    Post subject: Reply with quote

This is how I got the edid:

Code:

 get-edid > /lib/firmware/edid/monitor.bin
This is read-edid version 3.0.2. Prepare for some fun.
Attempting to use i2c interface
No EDID on bus 1
No EDID on bus 2
No EDID on bus 3
No EDID on bus 4
No EDID on bus 6
No byte reading on this bus...
Problem requesting slave address: Bad file descriptor
No byte reading on this bus...
Problem requesting slave address: Bad file descriptor
No byte reading on this bus...
Problem requesting slave address: Bad file descriptor
No byte reading on this bus...
Problem requesting slave address: Bad file descriptor
2 potential busses found: 0 5
Will scan through until the first EDID is found.
Pass a bus number as an option to this program to go only for that one.
Bus 0 doesn't really have an EDID...
256-byte EDID successfully retrieved from i2c bus 5
Looks like i2c was successful. Have a good day.



Parsing the edid :

Code:

parse-edid < /lib/firmware/edid/monitor.bin
Checksum Correct

Section "Monitor"
   Identifier "m�"
   ModelName "m�"
   VendorName "AUO"
   # Monitor Manufactured week 16 of 2017
   # EDID version 1.4
   # Digital Display
   DisplaySize 340 190
   Gamma 2.20
   Option "DPMS" "false"
EndSection




I still get an error during kernel bootup:

Code:

 dmesg |grep -i edid
[    0.000000] Command line: BOOT_IMAGE=/vmlinuz-4.19.23-gentoo root=/dev/nvme0n1p6 ro drm.edid_firmware=edid/monitor.bin
[    0.286276] Kernel command line: BOOT_IMAGE=/vmlinuz-4.19.23-gentoo root=/dev/nvme0n1p6 ro drm.edid_firmware=edid/monitor.bin
[    2.173390] [drm:drm_load_edid_firmware [drm]] *ERROR* Size of EDID firmware "edid/monitor.bin" is invalid (expected 128, got 256

Back to top
View user's profile Send private message
Vaernil
n00b
n00b


Joined: 06 Jun 2017
Posts: 2
Location: Poland

PostPosted: Tue Nov 19, 2019 3:22 am    Post subject: Reply with quote

I'm sorry if I'm digging up a dead topic, but I have exactly the same problem with my laptop Clevo N850HK, and this is the only google result that has similar issue.
I've been trying to make the hybrid graphics work for months and I'm at my wit's end.
Code:
dmesg | grep -i edid                                                                                                                                                                                                                                             
[    0.000000] Command line: \kernel-genkernel-x86_64-5.3.11-gentoo root=/dev/nvme0n1p7 rootfstype=ext4 drm.edid_firmware=edid/1920x1080_Clevo_N850HK.bin initrd=\initramfs-genkernel-x86_64-5.3.11-gentoo
[    0.143425] Kernel command line: \kernel-genkernel-x86_64-5.3.11-gentoo root=/dev/nvme0n1p7 rootfstype=ext4 drm.edid_firmware=edid/1920x1080_Clevo_N850HK.bin initrd=\initramfs-genkernel-x86_64-5.3.11-gentoo
[    8.640349] [drm:edid_load] *ERROR* Size of EDID firmware "edid/1920x1080_Clevo_N850HK.bin" is invalid (expected 128, got 256


Code:
xrandr --listproviders                                                                                                                                                                                                                                                 
Providers: number : 1
Provider 0: id: 0x46 cap: 0x2, Sink Output crtcs: 3 outputs: 4 associated providers: 0 name:modesetting


Can someone shed some light as to how to proceed?
@Arthanis, did you ever make it work?
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware 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