How to use two monitors at the same time while I'm using FreeBSD

Hello to everyone.

Actually I have two monitors,but usually I use only one of them. The monitor I use everyday with FreeBSD is attached to the HDMI port of the “VGA compatible controller: Intel Corporation CoffeeLake-S GT2 [UHD Graphics 630] (rev 02)” graphic chipset. And it works well. Sometimes,when I want to virtualize Linux,I attach the second screen to the HDMI port of the second GPU I have,the Nvidia Geforce RTX 2080 ti and in this way I can use even the second one. It could be useful even when I want to make some 3d modelling using Blender on the first one and using the second one to watch some tutorial. Can someone give me some suggestions about how to do that ? I tried to figure it out how to configure everything but it didn’t work. The monitor attached to the nvidia card remained black.

I tried with this xorg.conf :

Section "Device"
Identifier  "Card0"
Driver      "intel"
BusID       "PCI:0:2:0"
EndSection

Section "Device"
Identifier  "Card1"
Driver      "nvidia"
BusID       "PCI:2:0:0"
EndSection

Monitor 1 is attached to the HDMI port of the intel gpu and the monitor 2 is attached to the HDMI port of the nvidia GPU. Does it seems correct ? on FreeBSD I have installed these packages for the gpus :

  1. xf86-video-intel-2.99.917.916_1,1 X.Org legacy driver for Intel integrated graphics chipsets

  2. nvidia-driver-510.60.02 NVidia graphics card binary drivers for hardware OpenGL rendering

  3. nvidia-settings

my /etc/rc.conf looks like this :

kld_list="nvidia-modeset"

my /boot/loader.conf like this :

nvidia_load="YES"

This is what happens after the rebooting :

# kldstat | grep nvidia

 3    2 0xffffffff826b6000  2c4e1c0 nvidia.ko
19    1 0xffffffff86031000    fd310 nvidia-modeset.ko

# xrandr --listproviders

Providers: number : 1
Provider 0: id: 0x43 cap: 0xb, Source Output, Sink Output, Sink Offload crtcs: 3 outputs: 1 associated providers: 0 name:Intel

the nvidia card is not detected. But,the utility nvidia-settings shows that the driver detects two screens and that the 2 monitor is attached to the nvidia card. I’ve captured some screenshots and I’ve attached them,hoping that they can be useful to understand what’s wrong.



Monitor 2 is turned on and I can see the mouse pointer that can go over it,BUT there is nothing inside of it,it is totally black.

I tried also with this xorg.conf :

Section "Device"
Identifier  "Card0"
Driver      "intel"
BusID       "PCI:0:2:0"
EndSection

Section "Device"
Identifier  "Card1"
Driver      "modesetting"
BusID       "PCI:2:0:0"
EndSection

Using modesetting the monitor does not turn on at all. I forgot to say that on my BIOS I have configured the intel graphic chipset as primary.

xorg.conf :

Section "Device"
    Identifier  "Card0"
    Driver      "intel"
    BusID       "PCI:0:2:0"
EndSection

Section "Device"
    Identifier  "Card1"
    Driver      "nvidia"
    BusID       "PCI:2:0:0" #nvidia gtx 1060
EndSection

# dmesg | grep drm

drmn2: <drmn> on vgapci2
vgapci2: child drmn2 requested pci_enable_io
vgapci2: child drmn2 requested pci_enable_io
[drm] Unable to create a private tmpfs mount, hugepage support will be disabled(-19).
[drm] Got stolen memory base 0x3b800000, size 0x4000000
[drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[drm] Driver supports precise vblank timestamp query.
[drm] Connector eDP-1: get mode from tunables:
[drm]   - kern.vt.fb.modes.eDP-1
[drm]   - kern.vt.fb.default_mode
drmn2: successfully loaded firmware image 'i915/kbl_dmc_ver1_04.bin'
[drm] Finished loading DMC firmware i915/kbl_dmc_ver1_04.bin (v1.4)
[drm] failed to retrieve link info, disabling eDP
[drm] Connector HDMI-A-1: get mode from tunables:
[drm]   - kern.vt.fb.modes.HDMI-A-1
[drm]   - kern.vt.fb.default_mode
drmn2: Failed to program MOCS registers; expect performance issues.
[drm] Initialized i915 1.6.0 20190822 for drmn2 on minor 0
name=drmn2 flags=0x0 stride=7680 bpp=32
drmn2: fb0: i915drmfb frame buffer device

# ls -l /dev/dri

total 0
lrwxr-xr-x  1 root  wheel   8 Jul 23 22:24 card0 -> ../drm/0
lrwxr-xr-x  1 root  wheel  10 Jul 23 22:24 renderD128 -> ../drm/128

# pkg which /usr/local/lib/xorg/modules/drivers/modesetting_drv.so
/usr/local/lib/xorg/modules/drivers/modesetting_drv.so was installed by package xorg-server-1.20.14,1

# pkg which /usr/local/lib/xorg/modules/drivers/intel_drv.so
/usr/local/lib/xorg/modules/drivers/intel_drv.so was installed by package xf86-video-intel-2.99.917.916_1,1

# pkg info | grep video

emby-server-4.7.5.0            Media server to organize, play & stream audio/video to various devices
ffmpeg-4.4.2_5,1               Realtime audio/video encoder/converter and streaming server
ffmpegthumbnailer-2.2.2        Lightweight video thumbnailer that can be used by file managers
frei0r-1.8.0                   Minimalistic plugin API for video effects
gavl-1.4.0_4                   Library for handling uncompressed video and audio data
gstreamer1-libav-1.16.2        GStreamer plug-in with many audio/video decoders/encoders
gstreamer1-plugins-core-1.16   Core set of typical audio and video GStreamer plugins
intel-media-sdk-22.4.3         Hardware video decoding/encoding/filtering on Intel GPUs
kdemultimedia-ffmpegthumbs-22.04.3 FFmpeg-based thumbnail generator for video files
libde265-1.0.8                 Open source h.265 video codec
libtheora-1.1.1_7              Theora video codec for the Ogg multimedia streaming system
movit-1.6.3                    High-performance video filters for the GPU
qt5-multimedia-5.15.5p1        Qt audio, video, radio and camera support module (KDE patched)
simplescreenrecorder-0.4.4     Screen video recorder
vmaf-2.3.1                     Perceptual video quality assessment based on multi-method fusion
xf86-video-intel-2.99.917.916_1,1 X.Org legacy driver for Intel integrated graphics chipsets
xf86-video-vmware-13.3.0_6     X.Org vmware display driver

# pkg info | grep nvidia

linux-nvidia-libs-510.60.02    NVidia graphics libraries and programs (Linux version)
nvidia-driver-510.60.02        NVidia graphics card binary drivers for hardware OpenGL rendering
nvidia-settings-470.86         Display Control Panel for X NVidia driver

# getent group video
video:*:44:marietto

# kldstat

Id Refs Address                Size Name
 1  137 0xffffffff80200000  1f30590 kernel
 2    2 0xffffffff82131000     82b0 bridgestp.ko
 3    1 0xffffffff8213a000     40f8 nmdm.ko
 4    1 0xffffffff8213f000    29d28 fusefs.ko
 5    3 0xffffffff82169000    929d8 vboxdrv.ko
 6    1 0xffffffff821fc000     feb0 if_bridge.ko
 7    1 0xffffffff8220c000   5ec1d8 zfs.ko
 9    1 0xffffffff8280f000   5848b8 vmm.ko
10    1 0xffffffff82d94000     af68 cryptodev.ko
11    1 0xffffffff83210000     639c linprocfs.ko
12    6 0xffffffff83217000    10ab0 linux_common.ko
13    1 0xffffffff83228000     3284 linsysfs.ko
14    1 0xffffffff8322c000     9ea0 tmpfs.ko
15    1 0xffffffff83236000     3530 fdescfs.ko
16    2 0xffffffff8323a000     4240 vboxnetflt.ko
17    2 0xffffffff8323f000     aac8 netgraph.ko
18    1 0xffffffff8324a000     31c8 ng_ether.ko
19    1 0xffffffff8324e000     55e0 vboxnetadp.ko
20    1 0xffffffff83254000     2220 cpuctl.ko
21    1 0xffffffff83257000    fd310 nvidia-modeset.ko
22    1 0xffffffff83400000  2354ab8 nvidia.ko
23    2 0xffffffff83355000    38070 linux.ko
24    1 0xffffffff8338e000     3378 acpi_wmi.ko
25    1 0xffffffff83392000     3250 ichsmb.ko
26    1 0xffffffff83396000     2180 smbus.ko
27    1 0xffffffff83399000     2110 pchtherm.ko
28    1 0xffffffff8339c000     e538 snd_uaudio.ko
29    1 0xffffffff833ab000     2340 uhid.ko
30    1 0xffffffff833ae000     3380 usbhid.ko
31    1 0xffffffff833b2000     31f8 hidbus.ko
32    1 0xffffffff833b6000     3320 wmt.ko
33    1 0xffffffff833ba000     4350 ums.ko
34    1 0xffffffff833bf000    32208 linux64.ko
35    1 0xffffffff833f2000     2260 pty.ko
36    1 0xffffffff833f5000     4700 nullfs.ko
37    1 0xffffffff833fa000     2a08 mac_ntpd.ko
38    1 0xffffffff85755000   158438 i915kms.ko
39    1 0xffffffff858ae000    7f020 drm.ko
40    2 0xffffffff8592e000     cbc8 linuxkpi_gplv2.ko

# xrandr -q

Screen 0: minimum 320 x 200, current 1920 x 1080, maximum 16384 x 16384
HDMI-1 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 598mm x 336mm
   1920x1080     60.00*+  50.00    59.94  
   1920x1080i    60.00    50.00    59.94  
   1680x1050     59.88  
   1280x1024     75.02    60.02  
   1440x900      59.90  
   1280x960      60.00  
   1280x720      60.00    50.00    59.94  
   1024x768      75.03    70.07    60.00  
   832x624       74.55  
   800x600       72.19    75.00    60.32    56.25  
   720x576       50.00  
   720x480       60.00    59.94  
   640x480       75.00    72.81    66.67    60.00    59.94

# xrandr --listmonitors

Monitors: 1
0: +HDMI-1 1920/598x1080/336+0+0  HDMI-1