Nvidia Optimus

Theron theron.tarigo at gmail.com
Sat Jul 1 04:35:12 UTC 2017


On 06/30/17 16:03, Mylan Connolly via freebsd-x11 wrote:
> Hello all,
> I was working on getting FreeBSD to work on my laptop which has Optimus (Intel Kaby Lake GPU and Nvidia GTX1060) and currently have the Intel GPU working well enough using the freebsd-base-graphics CURRENT branch on Github, however I would like to get my Nvidia GPU working (without it, I cannot use external monitors, that's the biggest reason I have for getting it to work, although better GPU performance would be nice, too).
> It looks like there's a new port bug request athttps://bugs.freebsd.org/bugzilla/show_bug.cgi?id=192617  but it's been about 3 years now, so I'm not sure it's going anywhere.
> Is there currently a way of getting the Nvidia GPU working on FreeBSD? If not, I might be willing to try and get my hands dirty, but I don't really know what I'm doing at this point.
> Thanks!
>
> Mylan
> Sent with [ProtonMail](https://protonmail.com) Secure Email.
> _______________________________________________
> freebsd-x11 at freebsd.org  mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-x11
> To unsubscribe, send any mail to"freebsd-x11-unsubscribe at freebsd.org"

Is your laptop's display port wired directly to the Nvidia?

My laptop is configured with all displays hard-wired to the Intel, so my 
Nvidia is a headless device, but I do have headless Xorg running on it 
with working GL.  Perhaps this same configuration would be able to 
output an image to external monitor on your system?  This would be a 
separate Xorg instance, but if you do not intend to use both displays 
simultaneously this might be acceptable.  I haven't tried connecting to 
both devices from one Xorg and I have no idea how GLX would be expected 
to function in this situation.

As root
kldload linux64
pkg install nvidia-driver
./nvidia_installfix.sh
kldload nvidia-modeset
Xorg :1 -config nvidia_xorg.conf

As user
env DISPLAY=:1 LD_LIBRARY_PATH=/usr/local/lib/nvidia glxinfo -B

The install script and Xorg conf were working for me in the past, but 
now something seems to be wrong between the latest freebsd-base-graphics 
(or with my build thereof) and the binary nvidia-driver which prevents 
me from loading it:

     KLD nvidia-modeset.ko: depends on kernel - not available or version 
mismatch
     linker_load_file: /boot/modules/nvidia-modeset.ko - unsupported 
file type

Kernel is
     12.0-CURRENT FreeBSD 12.0-CURRENT #27 bc5430c5451(drm-next)

If it is indeed "version mismatch" rather than missing components then 
it is very likely bogus.  I am not sure where it has checked this, since 
it now refuses to work with an older kernel that I know it to have 
previously worked with.  It may be looking in /usr/src, which I left 
checked out to the latest version.
-------------- next part --------------
Section "ServerLayout"
	Identifier     "nvidia"
	Screen      0  "Screen0" 0 0
	Option "AutoAddDevices" "false"
	InputDevice    "fake" "CorePointer"
EndSection

Section "Files"
	ModulePath   "/usr/local/lib/xorg/modules_nvidia"
EndSection

Section "Module"
	Load        "dri3"
	Disable     "efifb"
EndSection

Section "InputDevice"
	Identifier  "fake"
	Driver      ""
EndSection

Section "Monitor"
	Identifier   "Monitor0"
	VendorName   "Monitor Vendor"
	ModelName    "Monitor Model"
EndSection

Section "Device"
        ### Available Driver options are:-
        ### Values: <i>: integer, <f>: float, <bool>: "True"/"False",
        ### <string>: "String", <freq>: "<f> Hz/kHz/MHz",
        ### <percent>: "<f>%"
        ### [arg]: arg optional
        #Option     "ShadowFB"           	# [<bool>]
        #Option     "DefaultRefresh"     	# [<bool>]
        #Option     "ModeSetClearScreen" 	# [<bool>]

	Identifier  "Card0"
	Driver      "nvidia"
	Option      "DRI" "3"
	VendorName "NVIDIA Corporation"
	BusID       "PCI:1:0:0"
	Option "NoLogo" "true"
	Option "UseEDID" "false"
	Option "ConnectedMonitor" "DFP"
EndSection

Section "Screen"
	Identifier "Screen0"
	Device     "Card0"
	Monitor    "Monitor0"
	SubSection "Display"
		Viewport   0 0
		Depth     1
	EndSubSection
	SubSection "Display"
		Viewport   0 0
		Depth     4
	EndSubSection
	SubSection "Display"
		Viewport   0 0
		Depth     8
	EndSubSection
	SubSection "Display"
		Viewport   0 0
		Depth     15
	EndSubSection
	SubSection "Display"
		Viewport   0 0
		Depth     16
	EndSubSection
	SubSection "Display"
		Viewport   0 0
		Depth     24
	EndSubSection
EndSection



More information about the freebsd-x11 mailing list