Nvidia Optimus Crash When Starting Xorg

From: Pete Wright <pete_at_nomadlogic.org>
Date: Sat, 04 Jun 2022 23:15:25 UTC
hello,
I've noticed recently that the I am getting a segfault when trying to
start the secondary Nvidia Headless Xorg binary on my Optimus system.  I
have verified that I am loading the nvidia.ko (but get same results with
the nvidia-modeset.ko as well).  Here's a snippet from my Xorg.8.log
when i run "/usr/local/bin/Xorg-nvidia-headless":

[  4660.516] (II) Loading sub module "glxserver_nvidia"
[  4660.516] (II) LoadModule: "glxserver_nvidia"
[  4660.516] (II) Loading /usr/local/lib/xorg/modules/extensions/libglxserver_nvidia.so
[  4660.518] (II) Module glxserver_nvidia: vendor="NVIDIA Corporation"
[  4660.518] 	compiled for 1.6.99.901, module version = 1.0.0
[  4660.518] 	Module class: X.Org Server Extension
[  4660.518] (II) NVIDIA GLX Module  510.60.02  Wed Mar 16 11:05:18 UTC 2022
[  4660.518] (II) NVIDIA: The X server supports PRIME Render Offload.
[  4660.705] (EE)
[  4660.705] (EE) Backtrace:
[  4660.705] (EE) 0: /usr/local/bin/Xorg (?+0x0) [0x41853a]
[  4660.706] (EE) unw_get_proc_name failed: no unwind info found [-10]
[  4660.706] (EE) 1: /lib/libthr.so.3 (?+0x0) [0x8293f59de]
[  4660.706] (EE) unw_get_proc_name failed: no unwind info found [-10]
[  4660.706] (EE) 2: /lib/libthr.so.3 (?+0x0) [0x8293f4f8f]
[  4660.706] (EE) 3: ? (?+0x0) [0x7ffffffff8a3]
[  4660.707] (EE) 4: ? (?+0x0) [0x0]
[  4660.707] (EE) 5: /usr/local/lib/xorg/modules/drivers/nvidia_drv.so (?+0x0) [0x83eea750f]
[  4660.707] (EE) 6: ? (?+0x0) [0x5a5a5a5a5a5a5a5a]
[  4660.707] (EE) unw_step failed: unspecified (general) error [-1]
[  4660.707] (EE)
[  4660.707] (EE) Segmentation fault at address 0x0
[  4660.707] (EE)
Fatal server error:
[  4660.707] (EE) Caught signal 11 (Segmentation fault). Server aborting
[  4660.707] (EE)
[  4660.707] (EE)

was curious if others have seen this issue before i create a bug report
and attempt to build a debug binary.  Here's my pkg info:
nvidia-hybrid-graphics-0.5
nvidia-secondary-driver-510.60.02_1

$ uname -ar
FreeBSD colony 14.0-CURRENT FreeBSD 14.0-CURRENT #14 main-n255678-386b1a033c4: Tue May 17 12:54:16 PDT 2022

cheers,
-pete

-- 
Pete Wright
pete@nomadlogic.org
@nomadlogicLA