Skip to content

Instantly share code, notes, and snippets.

@therontarigo
Created July 1, 2017 15:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save therontarigo/37d7cffc23801f130150e1760ba967e3 to your computer and use it in GitHub Desktop.
Save therontarigo/37d7cffc23801f130150e1760ba967e3 to your computer and use it in GitHub Desktop.
Install script and xorg.conf to enable Xorg on Nvidia on FreeBSD
#!/bin/csh
# nvidia-driver uses libmap to divert libgl; do not allow this
rm /usr/local/etc/libmap.d/nvidia.conf
# copy xorg modules with nvidia drivers and glx to new dir
rm -r /usr/local/lib/xorg/modules_nvidia/
cp -r /usr/local/lib/xorg/modules{,_nvidia}
# nvidia-driver moves mesa's libglx, put it back
cp /usr/local/lib/xorg/modules/extensions/{.xorg/,}libglx.so
rm -rf /usr/local/lib/nvidia
mkdir /usr/local/lib/nvidia
cp /usr/local/lib/libGL-NVIDIA.so.1 /usr/local/lib/nvidia/libGL.so.1
ln -s /usr/local/lib/nvidia/libGL.so{.1,}
cp /usr/local/lib/libGLESv2-NVIDIA.so.2 /usr/local/lib/nvidia/libGLESv2.so.2
ln -s /usr/local/lib/nvidia/libGLESv2.so{.2,}
cp /usr/local/lib/libEGL-NVIDIA.so.1 /usr/local/lib/nvidia/libEGL.so.1
ln -s /usr/local/lib/nvidia/libEGL.so{.1,}
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
@tdm4
Copy link

tdm4 commented Feb 24, 2019

Hey, is it possible to get this working on FreeBSD 12? Some of the paths look like they've changed since you put the scripts up.

@therontarigo
Copy link
Author

Hey, is it possible to get this working on FreeBSD 12? Some of the paths look like they've changed since you put the scripts up.

I am working on this again, as a proper port rather than a fixup script, see https://github.com/therontarigo/freebsd-gpu-headless/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment