Solved Need help making OpenGL/GLX to work in a dual graphics setup

DanDare

Member

Reaction score: 30
Messages: 53

Hi. I'm trying to make my install run OpenGL/GLX.
It's giving me errors like "Error: couldn't find RGB GLX visual or fbconfig"
and/or
"ERROR: [Loader Message] Code 0 : loader_scanned_icd_add: Attempt to retrieve either 'vkGetInstanceProcAddr' or 'vk_icdGetInstanceProcAddr' from ICD libGLX_nvidia.so.0 failed.
error: XDG_RUNTIME_DIR not set in the environment.
ERROR at /wrkdirs/usr/ports/graphics/vulkan-tools/work/Vulkan-Tools-1.2.184/vulkaninfo/vulkaninfo.h:248:vkEnumeratePhysicalDevices failed with ERROR_INITIALIZATION_FAILED"
and/or
"Error: couldn't get an RGB, Double-buffered visual"

While trying stuff from mesa-demos or games/homura

Running FreeBSD-13.0-RELEASE
My computer is https://bsd-hardware.info/?probe=daa7e68a1f
Dual graphics UHD Graphics 620 and GM108M [GeForce MX110]

Before attempting I was running the i915 driver by kld_list="/boot/modules/i915kms.ko" what always generated the following error in boot:

Code:
drmn0: <drmn> on vgapci0
vgapci0: child drmn0 requested pci_enable_io
vgapci0: child drmn0 requested pci_enable_io
[drm] Unable to create a private tmpfs mount, hugepage support will be disabled(-19).
[drm] Unable to create a private tmpfs mount, hugepage support will be disabled(-19).
Successfully added WC MTRR for [0xd0000000-0xdfffffff]: 0;
[drm] Got stolen memory base 0xc6000000, size 0x2000000
[drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[drm] Driver supports precise vblank timestamp query.
Jul 21 16:33:02 FreeBSD-dev kernel: Successfully added WC MTRR for [0xd0000000-0xdfffffff]: 0;
[drm] Connector eDP-1: get mode from tunables:
[drm]   - kern.vt.fb.modes.eDP-1
[drm]   - kern.vt.fb.default_mode
[drm] Connector HDMI-A-1: get mode from tunables:
[drm]   - kern.vt.fb.modes.HDMI-A-1
[drm]   - kern.vt.fb.default_mode
drmn0: Failed to program MOCS registers; expect performance issues.
sysctl_warn_reuse: can't re-use a leaf (hw.dri.debug)!
[drm] Initialized i915 1.6.0 20190822 for drmn0 on minor 0
WARNING: Device "fb" is Giant locked and may be deleted before FreeBSD 14.0.
VT: Replacing driver "efifb" with new "fb".
drmn0: successfully loaded firmware image 'i915/kbl_dmc_ver1_04.bin'
[drm] Finished loading DMC firmware i915/kbl_dmc_ver1_04.bin (v1.4)
start FB_INFO:
type=11 height=768 width=1366 depth=32
cmsize=16 size=4227072
pbase=0xd0200000 vbase=0xfffff800d0200000
name=drmn0 flags=0x0 stride=5504 bpp=32
cmap[0]=0 cmap[1]=7f0000 cmap[2]=7f00 cmap[3]=c4a000
end FB_INFO
drmn0: fb0: i915drmfb frame buffer device

Then installed "nvidia-hybrid-graphics-0.5 NVIDIA secondary GPU configuration - Optimus Technology support" this package also installed nvidia-secondary-driver-460 and other nvivia related packages.

The package message is

Code:
Message from nvidia-hybrid-graphics-0.5:

--
Running Xorg-nvidia-headless at startup is recommended especially on mobile
systems since leaving Nvidia GPU powered on with no Xorg may consume
significantly more power.

# sysrc nvidia_xorg_enable=YES
# service nvidia_xorg start

The Xorg instance uses separate configuration files from the defaults for Xorg:

    /usr/local/etc/X11/xorg-nvidia-headless.conf.d/

    /usr/local/etc/X11/xorg-nvidia-headless-template.conf
        Only used if xorg-nvidia-headless.conf does not exist.
    This file is passed through nvidia-xconfig, which does not preserve
    all options.

    /usr/local/etc/X11/xorg-nvidia-headless.conf
        Created by manually invoking /usr/local/bin/nvidia-headless-xconfig.
        Once created, this configuration is not passed through nvidia-xconfig.

Configuration is not normally needed for typical OpenGL acceleration usage.

A properly configured xorg-nvidia-headless.conf will allow Xorg-nvidia-headless
to be started by non-superuser if Xorg has been installed setuid.


Then I added 'kld_list="nvidia-modeset"' and 'nvidia_xorg_enable=YES' to rc.conf rebooted and executed /usr/local/bin/nvidia-headless-xconfig what generated the config file. Rebooted again. Now I can see in dmesg:

Code:
vgapci0: <VGA-compatible display> port 0xf000-0xf03f mem 0xf5000000-0xf5ffffff,0xd0000000-0xdfffffff at device 2.0 on pci0
vgapci1: <VGA-compatible display> port 0xe000-0xe07f mem 0xf6000000-0xf6ffffff,0xe0000000-0xefffffff,0xf0000000-0xf1ffffff at device 0.0 on pci1
nvidia1: <GeForce MX110> on vgapci1
vgapci1: child nvidia1 requested pci_enable_io
vgapci1: child nvidia1 requested pci_enable_io
nvidia-modeset: Loading NVIDIA Kernel Mode Setting Driver for UNIX platforms  460.84  Wed May 26 19:58:14 UTC 2021
Starting nvidia_xorg.

drmn0: <drmn> on vgapci0
vgapci0: child drmn0 requested pci_enable_io
vgapci0: child drmn0 requested pci_enable_io
[drm] Unable to create a private tmpfs mount, hugepage support will be disabled(-19).
[drm] Unable to create a private tmpfs mount, hugepage support will be disabled(-19).
Successfully added WC MTRR for [0xd0000000-0xdfffffff]: 0; 
[drm] Got stolen memory base 0xc6000000, size 0x2000000
[drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[drm] Driver supports precise vblank timestamp query.
Jul 21 16:33:02 FreeBSD-dev kernel: Successfully added WC MTRR for [0xd0000000-0xdfffffff]: 0; 
[drm] Connector eDP-1: get mode from tunables:
[drm]   - kern.vt.fb.modes.eDP-1
[drm]   - kern.vt.fb.default_mode
[drm] Connector HDMI-A-1: get mode from tunables:
[drm]   - kern.vt.fb.modes.HDMI-A-1
[drm]   - kern.vt.fb.default_mode
drmn0: Failed to program MOCS registers; expect performance issues.
sysctl_warn_reuse: can't re-use a leaf (hw.dri.debug)!
[drm] Initialized i915 1.6.0 20190822 for drmn0 on minor 0
WARNING: Device "fb" is Giant locked and may be deleted before FreeBSD 14.0.
VT: Replacing driver "efifb" with new "fb".
drmn0: successfully loaded firmware image 'i915/kbl_dmc_ver1_04.bin'
[drm] Finished loading DMC firmware i915/kbl_dmc_ver1_04.bin (v1.4)
start FB_INFO:
type=11 height=768 width=1366 depth=32
cmsize=16 size=4227072
pbase=0xd0200000 vbase=0xfffff800d0200000
name=drmn0 flags=0x0 stride=5504 bpp=32
cmap[0]=0 cmap[1]=7f0000 cmap[2]=7f00 cmap[3]=c4a000
end FB_INFO
drmn0: fb0: i915drmfb frame buffer device

After starting XFCE4 in the usual way I can see a clear improvment in graphic speed, for example while running Ubuntu in Virtualbox. But can't make OpenGL to run.
The logs for Xorg contains an error:

Code:
"[   691.898] (EE) AIGLX error: dlopen of /usr/local/lib/dri/iris_dri.so failed (Shared object "libglapi.so.0" not found, required by "iris_dri.so")
[   691.898] (EE) AIGLX error: unable to load driver iris
[   691.898] (EE) AIGLX error: dlopen of /usr/local/lib/dri/swrast_dri.so failed (Shared object "libglapi.so.0" not found, required by "swrast_dri.so")
[   691.898] (EE) AIGLX error: unable to load driver swrast
[   691.898] (EE) GLX: could not load software renderer
[   691.898] (II) GLX: no usable GL providers found for screen 0"

Tried to find where/how to have this libglapi.so.0 installed but cannot find how to fix this.
If I run nvidia-smi:

Code:
+-----------------------------------------------------------------------------+
| NVIDIA-SMIdsf 460.84       Driver Version: 460.84       CUDA Version: N/A      |
|-------------------------------+----------------------+----------------------+
| 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 MX110       Off  | 00000000:01:00.0 Off |                  N/A |
| N/A   55C    P8    N/A /  N/A |      5MiB /  2004MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|    0   N/A  N/A      1444      G   /usr/local/bin/Xorg                 4MiB |
+-----------------------------------------------------------------------------+


If I open NVIDIA X Server Settings it looks good. Screenshots attached.


s1.jpg

s2.jpg

s3.png


I tried booting with and without kld_list="/boot/modules/i915kms.ko" besides nvidia but still same thing.

Any clues about how to glue GLX to be able to make this work? :)

Thanks!
 

Alexander88207

Aspiring Daemon

Reaction score: 355
Messages: 580

[/CODE]

After starting XFCE4 in the usual way I can see a clear improvment in graphic speed, for example while running Ubuntu in Virtualbox. But can't make OpenGL to run.
The logs for Xorg contains an error:

Code:
"[   691.898] (EE) AIGLX error: dlopen of /usr/local/lib/dri/iris_dri.so failed (Shared object "libglapi.so.0" not found, required by "iris_dri.so")
[   691.898] (EE) AIGLX error: unable to load driver iris
[   691.898] (EE) AIGLX error: dlopen of /usr/local/lib/dri/swrast_dri.so failed (Shared object "libglapi.so.0" not found, required by "swrast_dri.so")
[   691.898] (EE) AIGLX error: unable to load driver swrast
[   691.898] (EE) GLX: could not load software renderer
[   691.898] (II) GLX: no usable GL providers found for screen 0"

Tried to find where/how to have this libglapi.so.0 installed but cannot find how to fix this.

Hello,

the missing library gets provided by graphics/mesa-libs if you have that package already installed try pkg install -f mesa-libs.
 
Top