Scripts and ports under development to support secondary Nvidia GPU (Optimus)
Theron
theron.tarigo at gmail.com
Mon Mar 5 16:34:43 UTC 2018
Hi All,
I have put together a preliminary release of work I have done to enable
use of the Nvidia GPU on a dual Intel/Nvidia laptop. My hope is that
this may be useful to others with this system configuration, and that,
at the appropriate time, it can be moved to the ports tree and serve as
a base for proper Optimus support.
Sources and documentation are here:
https://github.com/therontarigo/freebsd-gpu-headless
The work I have done is already "ported" and need only be copied into a
working copy of the ports tree to build, but I will hold off on
proposing the ports until I can provide some better documentation and
receive feedback on the approaches I have taken to getting this to work.
The work consists of three parts:
Changes to x11/nvidia-driver to allow it to be used as a slave port with
hooks for changing some of the file locations
New port x11/nvidia-headless-driver, which is just x11/nvidia-driver but
installs without breaking an existing OpenGL implementation
New port x11/nvidia-headless-utils, which provides wrapper scripts for
nvidia-xconfig, for xorg, and for running applications
The work builds off of the information in
https://wiki.freebsd.org/OptimusVideoSupport
However, x11/nvidia-driver-headless is developed independently from the
x11/nvidia-driver-optimus which has never made it into ports. Perhaps I
have wasted some time in doing this, although if my changes to
x11/nvidia-driver are considered less invasive, maybe it will be easier
to get them accepted. The x11/nvidia-driver-headless is meant to be not
specific to Optimus, so ideally useful anywhere Nvidia isn't the only
OpenGL vendor present on the system.
With the new directory $PREFIX/lib/xorg/modules-nvidia-headless I have
worked around the need to fiddle with extension files to run Xorg
successfully (see $PREFIX/etc/X11/xorg-nvidia-headless-template.conf).
If you have the time, please take a look into this and let me know if it
works as intended (I have tested only on 12.0-CURRENT) as well as any
changes that might be needed before I should propose the new ports.
I am considering splitting x11/nvidia-headless-utils into yet another
port containing only the VirtualGL bits so it can be a proper
dependency, but involving the creation of yet another port for such a
small part may not be the best thing.
Feedback welcomed,
Theron Tarigo
More information about the freebsd-x11
mailing list