Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 9 Oct 2021 18:28:34 -0400
From:      Creatxr <creatxr@gmail.com>
To:        freebsd-x11@freebsd.org
Subject:   Fwd: freebsd nvidia driver hybrid setting to startx (or startxfce4)
Message-ID:  <CAExmzsJuELZWRwk8pEJ0fG_2oyaWp=Bq-mFSMCyppMVe-CQocg@mail.gmail.com>
In-Reply-To: <CAExmzsLWTMLOCZC1jd1bL9ZnJ8SF5fvLDi4wekf2cqRD-yKy-g@mail.gmail.com>
References:  <CAExmzsLWTMLOCZC1jd1bL9ZnJ8SF5fvLDi4wekf2cqRD-yKy-g@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
--0000000000008e1e4f05cdefaadf
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

hi,

it's a new install of freebsd 13.


$ pciconf -lv | grep -A 4 vgapci

vgapci1@pci0:0:2:0: class=3D0x030000 rev=3D0x06 hdr=3D0x00 vendor=3D0x8086
device=3D0x0416 subvendor=3D0x1043 subdevice=3D0x178d
    vendor     =3D 'Intel Corporation'
    device     =3D '4th Gen Core Processor Integrated Graphics Controller'
    class      =3D display
    subclass   =3D VGA
--
vgapci0@pci0:1:0:0: class=3D0x030200 rev=3D0xa2 hdr=3D0x00 vendor=3D0x10de
device=3D0x1391 subvendor=3D0x1043 subdevice=3D0x178d
    vendor     =3D 'NVIDIA Corporation'
    device     =3D 'GM107M [GeForce GTX 850M]'
    class      =3D display
    subclass   =3D 3D



pkg install X11/nvidia-hybrid-graphics

# sysrc nvidia_xorg_enable=3DYES
# service nvidia_xorg start


### intel Processor Graphics is Intel=C2=AE HD Graphics 4600

pkg install xf86-video-intel
pkg install libva-intel-driver
pkg install libva-intel-hybrid-driver


# sysrc kld_list+=3Di915kms



/etc/rc.conf

hostname=3D""
ifconfig_re0=3D"DHCP"
ifconfig_re0_ipv6=3D"inet6 accept_rtadv"
sshd_enable=3D"YES"
powerd_enable=3D"YES"
# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
dumpdev=3D"AUTO"
dbus_enable=3D"yes"
hald_enable=3D"yes"
slim_enable=3D"yes"
sound_load=3D"yes"
snd_hda_load=3D"yes"
linux_enable=3D"yes"
# not work with: kld_list=3D"linux nvidia i915kms"
kld_list=3D"linux nvidia-modeset i915kms"
nvidia_xorg_enable=3D"yes"
fusefs_enable=3D"yes"




$ kldstat
Id Refs Address                Size Name
 1   89 0xffffffff80200000  1f11f28 kernel
 2    3 0xffffffff82718000    388f8 linux.ko
 3    4 0xffffffff82751000     db70 linux_common.ko
 4    1 0xffffffff8275f000   10c310 nvidia-modeset.ko
 5    1 0xffffffff82a00000  1e8a5a8 nvidia.ko
 6    1 0xffffffff8286c000   158458 i915kms.ko
 7    1 0xffffffff8488b000    7f4c8 drm.ko
 8    2 0xffffffff829c5000     cbc8 linuxkpi_gplv2.ko
 9    2 0xffffffff829d2000     2328 lindebugfs.ko
10    1 0xffffffff829d5000     3378 acpi_wmi.ko
11    1 0xffffffff829d9000     3250 ichsmb.ko
12    1 0xffffffff829dd000     2180 smbus.ko
13    1 0xffffffff829e0000     2340 uhid.ko
14    1 0xffffffff829e3000     4350 ums.ko
15    1 0xffffffff829e8000     3380 usbhid.ko
16    1 0xffffffff829ec000     31f8 hidbus.ko
17    1 0xffffffff829f0000     3320 wmt.ko
18    1 0xffffffff829f4000     4b60 ng_ubt.ko
19    6 0xffffffff8490b000     aac8 netgraph.ko
20    2 0xffffffff84916000     a238 ng_hci.ko
21    3 0xffffffff829f9000     25a8 ng_bluetooth.ko
22    1 0xffffffff84921000     e250 ng_l2cap.ko
23    1 0xffffffff84930000    1ce48 ng_btsocket.ko
24    1 0xffffffff829fc000     3980 ng_socket.ko
25    1 0xffffffff8494d000    30ac8 linux64.ko
26    1 0xffffffff8497e000     2260 pty.ko



pkg install mesa-demos


### with kld_list=3D"linux nvidia i915kms"
$ glxgears
14848 frames in 5.0 seconds =3D 2969.571 FPS
15135 frames in 5.0 seconds =3D 3026.891 FPS
15166 frames in 5.0 seconds =3D 3033.079 FPS
15007 frames in 5.0 seconds =3D 3001.273 FPS
15161 frames in 5.0 seconds =3D 3032.155 FPS
X connection to unix:0.0 broken (explicit kill or server shutdown).
$ nvrun-vgl glxgears
11616 frames in 5.0 seconds =3D 2323.029 FPS
11831 frames in 5.0 seconds =3D 2366.183 FPS
11816 frames in 5.0 seconds =3D 2363.154 FPS
11844 frames in 5.0 seconds =3D 2368.772 FPS
11836 frames in 5.0 seconds =3D 2367.154 FPS
[VGL] ERROR: in readback--
[VGL]    259: Window has been deleted by window manager
$



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


### not work with "nvidia" driver which setted in /etc/rc.conf
### kld_list=3D"linux nvidia i915kms"
Section "Device"
    Identifier "Card0"
    Driver "modesetting"
    BusID "PCI:1:0:0"
EndSection

Section "Device"
    Identifier "Card1"
    Option "DPMS"
#    Driver "intel"
    Driver "scfb"
    BusID "PCI:0:2:0"
EndSection

Section "Screen"
    Identifier "Screen0"
    Device "Card0"
EndSection

#Section "Screen"
#    Identifier "Screen1"
#    Device "Card0"
#EndSection









### with kld_list=3D"linux nvidia-modeset i915kms"


## with set "scfb" driver and login xorg with "Card1"

$ glxgears
8536 frames in 5.0 seconds =3D 1707.060 FPS
11991 frames in 5.0 seconds =3D 2398.080 FPS
14404 frames in 5.0 seconds =3D 2880.625 FPS
14389 frames in 5.0 seconds =3D 2877.635 FPS
13999 frames in 5.0 seconds =3D 2799.666 FPS
X connection to unix:0.0 broken (explicit kill or server shutdown).

$ nvrun-vgl glxgears
18492 frames in 5.0 seconds =3D 3698.362 FPS
15476 frames in 5.0 seconds =3D 3095.081 FPS
14770 frames in 5.0 seconds =3D 2953.820 FPS
14932 frames in 5.0 seconds =3D 2986.189 FPS
14917 frames in 5.0 seconds =3D 2983.276 FPS
[VGL] ERROR: in readback--
[VGL]    259: Window has been deleted by window manager
$


## with set "modesetting" driver and login xorg with "Card0"

$ glxgears
Running synchronized to the vertical refresh.  The framerate should be
approximately the same as the monitor refresh rate.
334 frames in 5.0 seconds =3D 66.714 FPS
301 frames in 5.0 seconds =3D 60.005 FPS
301 frames in 5.0 seconds =3D 60.006 FPS
301 frames in 5.0 seconds =3D 60.006 FPS
301 frames in 5.0 seconds =3D 60.006 FPS
X connection to unix:0.0 broken (explicit kill or server shutdown).

$ nvrun-vgl glxgears
15623 frames in 5.0 seconds =3D 3124.435 FPS
13787 frames in 5.0 seconds =3D 2757.238 FPS
13137 frames in 5.0 seconds =3D 2627.389 FPS
13735 frames in 5.0 seconds =3D 2746.879 FPS
13774 frames in 5.0 seconds =3D 2754.665 FPS
[VGL] ERROR: in readback--
[VGL]    259: Window has been deleted by window manager
$

### I thinks that it means that it's the right setting by set driver to
"modesetting" to economy power.

### but the fans still works hard, it's better switch to intel's integrated
video card, but the driver "drm" or "intel" cannot work.




in /var/log/messages

Oct  9 15:46:44  kernel: nvidia0: <GeForce GTX 850M> on vgapci0
Oct  9 15:46:44  kernel: vgapci0: child nvidia0 requested pci_enable_io
Oct  9 15:46:44  syslogd: last message repeated 1 times
Oct  9 15:46:44  kernel: nvidia-modeset: Loading NVIDIA Kernel Mode Setting
Driver for UNIX platforms  460.84  Wed May 26 19:58:14 UTC 2021
Oct  9 15:46:44  kernel: drmn1: <drmn> on vgapci1
Oct  9 15:46:44  kernel: vgapci1: child drmn1 requested pci_enable_io
Oct  9 15:46:44  syslogd: last message repeated 1 times
Oct  9 15:46:44  kernel: [drm] Unable to create a private tmpfs mount,
hugepage support will be disabled(-19).
Oct  9 15:46:44  kernel: Failed to add WC MTRR for [0xd0000000-0xdfffffff]:
-22; performance may suffer
Oct  9 15:46:44  kernel: [drm] Got stolen memory base 0xafe00000, size
0x20000000
Oct  9 15:46:44  kernel: [drm] Supports vblank timestamp caching Rev 2
(21.10.2013).
Oct  9 15:46:44  kernel: [drm] Driver supports precise vblank timestamp
query.
Oct  9 15:46:44  kernel: [drm] Connector VGA-1: get mode from tunables:
Oct  9 15:46:44  kernel: [drm]   - kern.vt.fb.modes.VGA-1
Oct  9 15:46:44  kernel: [drm]   - kern.vt.fb.default_mode
Oct  9 15:46:44  kernel: [drm] Connector eDP-1: get mode from tunables:
Oct  9 15:46:44  kernel: [drm]   - kern.vt.fb.modes.eDP-1
Oct  9 15:46:44  kernel: [drm]   - kern.vt.fb.default_mode
Oct  9 15:46:44  kernel: [drm] Connector HDMI-A-1: get mode from tunables:
Oct  9 15:46:44  kernel: [drm]   - kern.vt.fb.modes.HDMI-A-1
Oct  9 15:46:44  kernel: [drm]   - kern.vt.fb.default_mode
Oct  9 15:46:44  kernel: sysctl_warn_reuse: can't re-use a leaf
(hw.dri.debug)!
Oct  9 15:46:44  kernel: [drm] Initialized i915 1.6.0 20190822 for drmn1 on
minor 0




$ pkg info | grep -E 'nvidia|intel'
libva-intel-driver-2.4.1       VAAPI legacy driver for Intel GMA 4500
(Gen4) to UHD 630 (Gen9.5)
nvidia-hybrid-graphics-0.5     NVIDIA secondary GPU configuration - Optimus
Technology support
nvidia-secondary-driver-460.84_1 NVidia graphics card binary drivers for
hardware OpenGL rendering on secondary device
nvidia-settings-460.73.01_2    Display Control Panel for X NVidia driver
nvidia-xconfig-460.73.01       Tool to manipulate X configuration files for
the NVidia driver
$


$ pkg info -D nvidia*
nvidia-hybrid-graphics-0.5:
On install:
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=3DYES
# 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.

nvidia-secondary-driver-460.84_1:
On install:
To use these drivers, make sure that you have loaded the NVidia kernel
module, by running

# kldload nvidia (or nvidia-modeset, see below)

on the command line, or by putting ``nvidia'' (or ``nvidia-modeset'',
see below again) on ``kld_list'' variable in /etc/rc.conf, either manually
or by running

# sysrc kld_list+=3Dnvidia (or nvidia-modeset, see below)

If you build this port with FreeBSD AGP GART driver, make sure you have
agp.ko kernel module installed and loaded, since nvidia.ko will depend
on it, or have your kernel compiled with "device agp".  Otherwise, the
NVidia kernel module will not load.  Also, please set correct value for
``Option "NvAGP"'' in ``Device'' section of your X11 configuration file.

When building with Linux compatibility support, make sure that linux.ko
module is available as well (or have it compiled in kernel).  It can be
loaded via /boot/loader.conf, or later in the boot process if you add

linux_enable=3D"YES"

to your /etc/rc.conf.

If X.org cannot start and reports

(EE) NVIDIA(0): Failed to obtain a shared memory identifier.

in /var/log/Xorg.0.log while actually you have ``options SYSVSHM''
enabled in kernel, the sysctl ``kern.ipc.shmall'' should be increased.

Starting with version 358.09, some important functionality of the driver
has been broken out into a separate kernel module, nvidia-modeset.ko.
Users that experience hangs when starting X11 server, or observe

(II) NVIDIA(0): Validated MetaModes:
(II) NVIDIA(0):     "NULL"

in /var/log/Xorg.0.log should replace ``nvidia'' with ``nvidia-modeset''
in their /boot/loader.conf or /etc/rc.conf configuration files, depending
on how they prefer to load NVidia driver kernel module.

See /usr/local/share/doc/NVIDIA_GLX-1.0/README for more information.

nvidia-settings-460.73.01_2:
nvidia-xconfig-460.73.01:
$



without /usr/local/etc/X11/xorg.conf.d/driver-nvidia.conf , it cannot start
xwindow.

the driver must set to "modesetting". with in /etc/rc.conf set
kld_list=3D"linux nvidia-modeset i915kms" ("Card0")

the driver cannot set to "intel" or "drm" or "i915kms". otherwise it cannot
startx (startxfce4) or xwindow is blank. (if set Device to "Card1", it does
not work)
or maybe there is no driver for intel processor integrated graphics card HD
4600 ?

what's missing or error in my config ? thanks.

--0000000000008e1e4f05cdefaadf--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAExmzsJuELZWRwk8pEJ0fG_2oyaWp=Bq-mFSMCyppMVe-CQocg>