From owner-dev-commits-ports-all@freebsd.org Tue Jun 15 19:31:12 2021 Return-Path: Delivered-To: dev-commits-ports-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6D6836519A7; Tue, 15 Jun 2021 19:31:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4G4JMh26nnz4v8N; Tue, 15 Jun 2021 19:31:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 14C235FF9; Tue, 15 Jun 2021 19:31:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 15FJVCbL034755; Tue, 15 Jun 2021 19:31:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15FJVCcN034754; Tue, 15 Jun 2021 19:31:12 GMT (envelope-from git) Date: Tue, 15 Jun 2021 19:31:12 GMT Message-Id: <202106151931.15FJVCcN034754@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Kevin Bowling Subject: git: 2ee6acf85a98 - main - x11/nvidia-hybrid-graphics: Optimus Technology MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2ee6acf85a98de36269d3a727b4c45675b0eb9c3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-ports-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the ports repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Jun 2021 19:31:12 -0000 The branch main has been updated by kbowling: URL: https://cgit.FreeBSD.org/ports/commit/?id=2ee6acf85a98de36269d3a727b4c45675b0eb9c3 commit 2ee6acf85a98de36269d3a727b4c45675b0eb9c3 Author: Theron Tarigo AuthorDate: 2021-06-15 19:27:11 +0000 Commit: Kevin Bowling CommitDate: 2021-06-15 19:30:22 +0000 x11/nvidia-hybrid-graphics: Optimus Technology PR: 192617 Reported by: David Mackay Reviewed by: many Tested by: many Approved by: portmgr (maintainer timeout: 15 days) Differential Revision: https://reviews.freebsd.org/D22521 --- x11/nvidia-driver/Makefile | 50 ++++++++++++-- x11/nvidia-driver/pkg-plist | 9 ++- x11/nvidia-hybrid-graphics/Makefile | 78 ++++++++++++++++++++++ x11/nvidia-hybrid-graphics/files/nvidia_xorg.in | 48 +++++++++++++ x11/nvidia-hybrid-graphics/files/pkg-message.in | 24 +++++++ .../files/src/bin/Xorg-nvidia-headless.in | 17 +++++ .../files/src/bin/nvidia-headless-xconfig.in | 9 +++ .../files/src/bin/nvrun-vgl.in | 8 +++ x11/nvidia-hybrid-graphics/files/src/bin/nvrun.in | 7 ++ .../etc/X11/xorg-nvidia-headless-template.conf.in | 39 +++++++++++ .../files/src/etc/nvidia-headless.conf.in | 1 + .../files/src/etc/nvidia-hybrid.conf.in | 1 + .../src/libexec/nvidia-headless-utils/readconf.in | 5 ++ .../files/src/libexec/nvidia-settings-hybrid.in | 4 ++ x11/nvidia-hybrid-graphics/pkg-descr | 8 +++ x11/nvidia-hybrid-graphics/pkg-plist | 11 +++ x11/nvidia-secondary-driver-390/Makefile | 6 ++ x11/nvidia-secondary-driver/Makefile | 20 ++++++ x11/nvidia-secondary-driver/pkg-message | 4 ++ x11/nvidia-settings/Makefile | 7 ++ x11/nvidia-settings/files/nvidia-settings.in | 3 + 21 files changed, 352 insertions(+), 7 deletions(-) diff --git a/x11/nvidia-driver/Makefile b/x11/nvidia-driver/Makefile index d95c30595ade..daa727149404 100644 --- a/x11/nvidia-driver/Makefile +++ b/x11/nvidia-driver/Makefile @@ -13,7 +13,7 @@ # the port aims to support building against arbitrary DISTVERSION, i.e. # ``make DISTVERSION=xxx.yy.zz -DNO_CHECKSUM'' should typically work. -PORTNAME= nvidia-driver +PORTNAME?= nvidia-driver DISTVERSION?= 460.80 # Always try to set PORTREVISION as it can be overridden by the slave ports PORTREVISION?= 0 @@ -22,8 +22,8 @@ MASTER_SITES= NVIDIA/XFree86/FreeBSD-${ARCH_SUFX}/${DISTVERSION} DISTNAME= NVIDIA-FreeBSD-${ARCH_SUFX}-${DISTVERSION} DISTFILES= ${DISTNAME}${EXTRACT_SUFX} -MAINTAINER= danfe@FreeBSD.org -COMMENT= NVidia graphics card binary drivers for hardware OpenGL rendering +MAINTAINER?= danfe@FreeBSD.org +COMMENT?= NVidia graphics card binary drivers for hardware OpenGL rendering LICENSE_FILE= ${WRKSRC}/doc/license.txt .include "${.CURDIR}/../nvidia-driver/Makefile.common" @@ -43,7 +43,10 @@ WAYLAND_JSON_PATH= ${PREFIX}/share/egl/egl_external_platform.d MAKE_ENV= DEBUG_FLAGS=${DEBUG_FLAGS} \ EGL_GLVND_JSON_PATH=${STAGEDIR}${GLVND_JSON_PATH} \ EGL_WAYLAND_JSON_PATH=${STAGEDIR}${WAYLAND_JSON_PATH} -SUB_FILES= pkg-message nvidia.conf +SUB_FILES= pkg-message +.if !defined(LIBGLDIR) +SUB_FILES+= nvidia.conf +.endif .if ${NVVERSION} < 410.057 SUB_FILES+= pkg-deinstall pkg-install .endif @@ -54,6 +57,7 @@ SUB_PATCHES= extra-patch-src-Makefile \ extra-patch-src-nvidia_pci.c DOCSDIR= ${PREFIX}/share/doc/NVIDIA_GLX-1.0 MODULESDIR= lib/xorg/modules +EXTENSIONSDIR?= ${MODULESDIR}/extensions/.nvidia PORTDOCS= * .if ${NVVERSION} >= 331.013 @@ -96,6 +100,20 @@ FREEBSD_AGP_DESC= Use FreeBSD AGP GART driver .endif PLIST_SUB+= MODULESDIR=${MODULESDIR} +.if ${NVVERSION} < 410.057 +PLIST_SUB+= EXTENSIONSDIR=${EXTENSIONSDIR} +.else +PLIST_SUB+= EXTENSIONSDIR="@comment " +.endif +.if defined(LIBGLDIR) +PLIST_SUB+= LIBGLDIR=${LIBGLDIR} LIBGLMAP="@comment " +.else +PLIST_SUB+= LIBGLDIR="@comment " LIBGLMAP="" +.endif + +.if ${PORTNAME} != nvidia-secondary-driver +CONFLICTS_INSTALL+= nvidia-secondary-driver +.endif .include @@ -284,8 +302,32 @@ post-install: .SILENT ${STAGEDIR}${PREFIX}/lib/libGLESv2-NVIDIA.so.2 ${RM} ${STAGEDIR}${PREFIX}/lib/libGLESv2.so .endif +# Configuration of Nvidia as secondary GPU requires preserving Mesa libraries +# as default implementation; a libmap must not override in this case. +.if !defined(LIBGLDIR) @${MKDIR} ${STAGEDIR}${PREFIX}/etc/libmap.d/ ${INSTALL_DATA} ${WRKDIR}/nvidia.conf \ ${STAGEDIR}${PREFIX}/etc/libmap.d/ +.else +# libgl proxies require a library path containing unrenamed lib*GL*.so + ${MKDIR} ${STAGEDIR}${PREFIX}/${LIBGLDIR} + ${RLN} ${STAGEDIR}${PREFIX}/lib/libGL-NVIDIA.so.1 \ + ${STAGEDIR}${PREFIX}/${LIBGLDIR}/libGL.so.1 + ${RLN} ${STAGEDIR}${PREFIX}/lib/libEGL-NVIDIA.so.1 \ + ${STAGEDIR}${PREFIX}/${LIBGLDIR}/libEGL.so.1 + ${RLN} ${STAGEDIR}${PREFIX}/lib/libGLESv2-NVIDIA.so.2 \ + ${STAGEDIR}${PREFIX}/${LIBGLDIR}/libGLESv2.so.2 +.endif +# Configuration of Nvidia as secondary GPU requires preserving xorg-server's +# libglx.so and moving Nvidia's glx to where it can be found by a secondary +# Xorg instance. +# Not needed since 410.057: Nvidia driver finds libglxserver_nvidia.so instead. +.if ${NVVERSION} < 410.057 +.if ${EXTENSIONSDIR} != ${MODULESDIR}/extensions/.nvidia + ${MKDIR} ${STAGEDIR}${PREFIX}/${EXTENSIONSDIR} + ${MV} ${STAGEDIR}${PREFIX}/${MODULESDIR}/extensions/.nvidia/* \ + ${STAGEDIR}${PREFIX}/${EXTENSIONSDIR}/ +.endif +.endif .include diff --git a/x11/nvidia-driver/pkg-plist b/x11/nvidia-driver/pkg-plist index 9ae1e8fa5261..85156cdb6eff 100644 --- a/x11/nvidia-driver/pkg-plist +++ b/x11/nvidia-driver/pkg-plist @@ -1,7 +1,10 @@ bin/nvidia-bug-report.sh bin/nvidia-debugdump bin/nvidia-smi -etc/libmap.d/nvidia.conf +%%LIBGLMAP%%etc/libmap.d/nvidia.conf +%%LIBGLDIR%%/libGL.so.1 +%%LIBGLDIR%%/libEGL.so.1 +%%LIBGLDIR%%/libGLESv2.so.2 lib/libEGL-NVIDIA.so lib/libEGL-NVIDIA.so.1 lib/libEGL_nvidia.so @@ -86,8 +89,8 @@ share/glvnd/egl_vendor.d/10_nvidia.json share/vulkan/icd.d/nvidia_icd.json share/vulkan/implicit_layer.d/nvidia_layers.json %%MODULESDIR%%/drivers/nvidia_drv.so -%%MODULESDIR%%/extensions/.nvidia/libglx.so -%%MODULESDIR%%/extensions/.nvidia/libglx.so.1 +%%EXTENSIONSDIR%%/libglx.so +%%EXTENSIONSDIR%%/libglx.so.1 %%MODULESDIR%%/extensions/libglxserver_nvidia.so %%MODULESDIR%%/extensions/libglxserver_nvidia.so.1 /%%KMODDIR%%/nvidia.ko diff --git a/x11/nvidia-hybrid-graphics/Makefile b/x11/nvidia-hybrid-graphics/Makefile new file mode 100644 index 000000000000..0e99e9c99e1d --- /dev/null +++ b/x11/nvidia-hybrid-graphics/Makefile @@ -0,0 +1,78 @@ +# Created by: Theron Tarigo + +PORTNAME= nvidia-hybrid-graphics +PORTVERSION= 0.5 +CATEGORIES= x11 +MASTER_SITES= # none +DISTFILES= # none + +MAINTAINER= theron.tarigo@gmail.com +COMMENT= NVIDIA secondary GPU configuration - Optimus Technology support + +LICENSE= BSD2CLAUSE + +RUN_DEPENDS= nvidia-xconfig:x11/nvidia-xconfig \ + ${LOCALBASE}/bin/Xorg:x11-servers/xorg-server + +FLAVORS= default 390 + +NO_ARCH= yes +NO_BUILD= yes +WRKSRC= ${WRKDIR}/src + +default_RUN_DEPENDS= \ + nvidia-secondary-driver>=440.64:x11/nvidia-secondary-driver +390_RUN_DEPENDS= \ + nvidia-secondary-driver-390>=390.87:x11/nvidia-secondary-driver-390 + +VIRTUALGL_RUN_DEPENDS= ${LOCALBASE}/VirtualGL/bin/vglrun:x11/virtualgl + +390_PKGNAMESUFFIX= -390 + +OPTIONS_DEFINE= VIRTUALGL OPTIRUN +OPTIONS_DEFAULT= VIRTUALGL OPTIRUN +OPTIONS_SUB= OPTIRUN +VIRTUALGL_DESC= Use VirtualGL for OpenGL redirection support +OPTIRUN_DESC= Install "optirun" alias for nvrun-vgl +OPTIRUN_IMPLIES= VIRTUALGL + +scripts= \ + bin/Xorg-nvidia-headless \ + bin/nvidia-headless-xconfig \ + bin/nvrun \ + bin/nvrun-vgl \ + libexec/nvidia-headless-utils/readconf \ + libexec/nvidia-settings-hybrid +configs= \ + etc/X11/xorg-nvidia-headless-template.conf \ + etc/nvidia-headless.conf \ + etc/nvidia-hybrid.conf \ + +SUB_FILES= pkg-message ${scripts:%=src/%} ${configs:%=src/%} +SUB_LIST+= VGLRUN=${LOCALBASE}/VirtualGL/bin/vglrun + +USE_RC_SUBR= nvidia_xorg + +do-extract: +.for f in ${SUB_FILES} + ${MKDIR} ${WRKDIR}/${f:H} +.endfor + +do-install: +.for f in ${scripts} + @${MKDIR} ${STAGEDIR}${PREFIX}/${f:H} + ${INSTALL_SCRIPT} ${WRKSRC}/${f} ${STAGEDIR}${PREFIX}/${f} +.endfor +.for f in ${configs} + @${MKDIR} ${STAGEDIR}${PREFIX}/${f:H} + ${INSTALL_DATA} ${WRKSRC}/${f} ${STAGEDIR}${PREFIX}/${f}.sample +.endfor + +post-install: + @${MKDIR} ${STAGEDIR}${PREFIX}/etc/X11/xorg-nvidia-headless.conf.d + +post-install-OPTIRUN-on: + @${RLN} ${STAGEDIR}${PREFIX}/bin/nvrun-vgl \ + ${STAGEDIR}${PREFIX}/bin/optirun + +.include diff --git a/x11/nvidia-hybrid-graphics/files/nvidia_xorg.in b/x11/nvidia-hybrid-graphics/files/nvidia_xorg.in new file mode 100644 index 000000000000..34e3e0a5f95b --- /dev/null +++ b/x11/nvidia-hybrid-graphics/files/nvidia_xorg.in @@ -0,0 +1,48 @@ +#!/bin/sh +# +# $FreeBSD$ +# +# PROVIDE: nvidia_xorg +# REQUIRE: LOGIN +# KEYWORD: shutdown + +. /etc/rc.subr + +name=nvidia_xorg +rcvar=nvidia_xorg_enable +desc="Nvidia GPU Dedicated Xorg" + +load_rc_config $name + +: ${nvidia_xorg_enable:=NO} +: ${nvidia_modeset:=NO} +: ${nvidia_manage_kld:=YES} + +command=/usr/sbin/daemon +pidfile=/var/run/${name}.pid +procname="%%LOCALBASE%%/bin/Xorg" +command_args="-p ${pidfile} -f %%PREFIX%%/bin/Xorg-nvidia-headless" +start_precmd="${name}_prestart" +stop_postcmd="${name}_poststop" + +if checkyesno nvidia_modeset; then + kmod=nvidia-modeset +else + kmod=nvidia +fi + +nvidia_xorg_prestart() +{ + if checkyesno nvidia_manage_kld; then + kldload -n ${kmod} || return 1 + fi +} + +nvidia_xorg_poststop() +{ + if checkyesno nvidia_manage_kld; then + kldunload -f ${kmod} || return 1 + fi +} + +run_rc_command "$1" diff --git a/x11/nvidia-hybrid-graphics/files/pkg-message.in b/x11/nvidia-hybrid-graphics/files/pkg-message.in new file mode 100644 index 000000000000..2e3b6e2c2904 --- /dev/null +++ b/x11/nvidia-hybrid-graphics/files/pkg-message.in @@ -0,0 +1,24 @@ +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=YES +# service nvidia_xorg start + +The Xorg instance uses separate configuration files from the defaults for Xorg: + + %%PREFIX%%/etc/X11/xorg-nvidia-headless.conf.d/ + + %%PREFIX%%/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. + + %%PREFIX%%/etc/X11/xorg-nvidia-headless.conf + Created by manually invoking %%PREFIX%%/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. diff --git a/x11/nvidia-hybrid-graphics/files/src/bin/Xorg-nvidia-headless.in b/x11/nvidia-hybrid-graphics/files/src/bin/Xorg-nvidia-headless.in new file mode 100644 index 000000000000..b89819168842 --- /dev/null +++ b/x11/nvidia-hybrid-graphics/files/src/bin/Xorg-nvidia-headless.in @@ -0,0 +1,17 @@ +#!/bin/sh +conf=%%PREFIX%%/etc/nvidia-headless.conf +. %%PREFIX%%/libexec/nvidia-headless-utils/readconf +if [ -z "$NVDISPLAY" ]; then printf %s\\n "NVDISPLAY required in environment or in $conf" >&2 ; exit 1; fi +xconfig=%%LOCALBASE%%/etc/X11/xorg-nvidia-headless.conf +xconfarg=xorg-nvidia-headless.conf +if [ ! -e "$xconfig" ]; then +if [ "$(id -u)" != 0 ]; then +printf %s\\n "nvidia-headless must be configured by superuser" >&2 +exit 1 +fi +xconfig=/var/cache/nvidia-headless/xorg.conf +mkdir -p /var/cache/nvidia-headless +xconfarg="$xconfig" +%%PREFIX%%/bin/nvidia-headless-xconfig -o "$xconfig" +fi +exec %%LOCALBASE%%/bin/Xorg -sharevts -novtswitch -noreset -config "$xconfarg" -configdir "xorg-nvidia-headless.conf.d" "$NVDISPLAY" "$@" diff --git a/x11/nvidia-hybrid-graphics/files/src/bin/nvidia-headless-xconfig.in b/x11/nvidia-hybrid-graphics/files/src/bin/nvidia-headless-xconfig.in new file mode 100644 index 000000000000..29f06a2c4dd8 --- /dev/null +++ b/x11/nvidia-hybrid-graphics/files/src/bin/nvidia-headless-xconfig.in @@ -0,0 +1,9 @@ +#!/bin/sh +exec %%LOCALBASE%%/bin/nvidia-xconfig \ + --enable-all-gpus \ + --preserve-busid \ + --allow-empty-initial-configuration \ + --connected-monitor=DFP \ + --no-use-edid \ + -c %%PREFIX%%/etc/X11/xorg-nvidia-headless-template.conf \ + -o %%LOCALBASE%%/etc/X11/xorg-nvidia-headless.conf "$@" diff --git a/x11/nvidia-hybrid-graphics/files/src/bin/nvrun-vgl.in b/x11/nvidia-hybrid-graphics/files/src/bin/nvrun-vgl.in new file mode 100644 index 000000000000..ecb5b256005f --- /dev/null +++ b/x11/nvidia-hybrid-graphics/files/src/bin/nvrun-vgl.in @@ -0,0 +1,8 @@ +#!/bin/sh +conf=%%PREFIX%%/etc/nvidia-headless.conf +. %%PREFIX%%/libexec/nvidia-headless-utils/readconf +conf=%%PREFIX%%/etc/nvidia-hybrid.conf +. %%PREFIX%%/libexec/nvidia-headless-utils/readconf +if [ -z "$NVDISPLAY" ]; then printf %s\\n "NVDISPLAY required in environment or in $conf" >&2 ; exit 1; fi +if [ -z "$VGLRUN" ]; then printf %s\\n "VGLRUN required in environment or in $conf" >&2 ; exit 1; fi +exec "$VGLRUN" -ld "%%LOCALBASE%%/lib/libGL-NVIDIA" -d "$NVDISPLAY" "$@" diff --git a/x11/nvidia-hybrid-graphics/files/src/bin/nvrun.in b/x11/nvidia-hybrid-graphics/files/src/bin/nvrun.in new file mode 100644 index 000000000000..9f214ca9c523 --- /dev/null +++ b/x11/nvidia-hybrid-graphics/files/src/bin/nvrun.in @@ -0,0 +1,7 @@ +#!/bin/sh +conf=%%PREFIX%%/etc/nvidia-headless.conf +. %%PREFIX%%/libexec/nvidia-headless-utils/readconf +if [ -z "$NVDISPLAY" ]; then printf %s\\n "NVDISPLAY required in environment or in $conf" >&2 ; exit 1; fi +export DISPLAY="$NVDISPLAY" +export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:%%LOCALBASE%%/lib/libGL-NVIDIA" +exec "$@" diff --git a/x11/nvidia-hybrid-graphics/files/src/etc/X11/xorg-nvidia-headless-template.conf.in b/x11/nvidia-hybrid-graphics/files/src/etc/X11/xorg-nvidia-headless-template.conf.in new file mode 100644 index 000000000000..96fce627063e --- /dev/null +++ b/x11/nvidia-hybrid-graphics/files/src/etc/X11/xorg-nvidia-headless-template.conf.in @@ -0,0 +1,39 @@ + +Section "ServerLayout" + Identifier "nvidia" + Screen 0 "Screen0" + InputDevice "fake" "CorePointer" "CoreKeyboard" + Option "AutoAddDevices" "false" +EndSection + +Section "Files" + ModulePath "%%LOCALBASE%%/lib/xorg/modules-NVIDIA" + ModulePath "%%LOCALBASE%%/lib/xorg/modules" +EndSection + +Section "Module" + Load "dri3" + Load "glx" + Disable "efifb" +EndSection + +Section "InputDevice" + Identifier "fake" + Driver "" +EndSection + +Section "Monitor" + Identifier "Monitor0" +EndSection + +Section "Device" + Identifier "Device0" + Driver "nvidia" +EndSection + +Section "Screen" + Identifier "Screen0" + Device "Device0" + Monitor "Monitor0" +EndSection + diff --git a/x11/nvidia-hybrid-graphics/files/src/etc/nvidia-headless.conf.in b/x11/nvidia-hybrid-graphics/files/src/etc/nvidia-headless.conf.in new file mode 100644 index 000000000000..0b1bfdb982a3 --- /dev/null +++ b/x11/nvidia-hybrid-graphics/files/src/etc/nvidia-headless.conf.in @@ -0,0 +1 @@ +NVDISPLAY=:8 diff --git a/x11/nvidia-hybrid-graphics/files/src/etc/nvidia-hybrid.conf.in b/x11/nvidia-hybrid-graphics/files/src/etc/nvidia-hybrid.conf.in new file mode 100644 index 000000000000..6b578c8d1b40 --- /dev/null +++ b/x11/nvidia-hybrid-graphics/files/src/etc/nvidia-hybrid.conf.in @@ -0,0 +1 @@ +VGLRUN=%%VGLRUN%% diff --git a/x11/nvidia-hybrid-graphics/files/src/libexec/nvidia-headless-utils/readconf.in b/x11/nvidia-hybrid-graphics/files/src/libexec/nvidia-headless-utils/readconf.in new file mode 100644 index 000000000000..620a9b8efcbd --- /dev/null +++ b/x11/nvidia-hybrid-graphics/files/src/libexec/nvidia-headless-utils/readconf.in @@ -0,0 +1,5 @@ +while IFS== read -r _var _val ; do + expr "$_var" : '[a-zA-Z][a-zA-Z0-9_]*$' >&- && \ + eval [ -z \${$_var+UNSET} ] '&&' $_var="\$_val" '||' true || \ + printf %s\\n "$conf: $_var: bad variable name" >&2 +done < "$conf" ; unset _var _val diff --git a/x11/nvidia-hybrid-graphics/files/src/libexec/nvidia-settings-hybrid.in b/x11/nvidia-hybrid-graphics/files/src/libexec/nvidia-settings-hybrid.in new file mode 100644 index 000000000000..d4740ff05484 --- /dev/null +++ b/x11/nvidia-hybrid-graphics/files/src/libexec/nvidia-settings-hybrid.in @@ -0,0 +1,4 @@ +#!/bin/sh +conf=%%PREFIX%%/etc/nvidia-headless.conf +. %%PREFIX%%/libexec/nvidia-headless-utils/readconf +exec nvrun-vgl %%LOCALBASE%%/libexec/nvidia-settings -c "$NVDISPLAY" "$@" diff --git a/x11/nvidia-hybrid-graphics/pkg-descr b/x11/nvidia-hybrid-graphics/pkg-descr new file mode 100644 index 000000000000..560f9e8a04ae --- /dev/null +++ b/x11/nvidia-hybrid-graphics/pkg-descr @@ -0,0 +1,8 @@ +This port integrates the Nvidia graphics driver and supporting utilities with +VirtualGL, enabling use of Nvidia acceleration on a system with hybrid graphics +hardware configuration, aka "Optimus". + +Applications to be run with Nvidia acceleration should be started using +`nvrun-vgl`. + +WWW: https://github.com/therontarigo/freebsd-gpu-headless diff --git a/x11/nvidia-hybrid-graphics/pkg-plist b/x11/nvidia-hybrid-graphics/pkg-plist new file mode 100644 index 000000000000..be2a1fb8d97f --- /dev/null +++ b/x11/nvidia-hybrid-graphics/pkg-plist @@ -0,0 +1,11 @@ +bin/Xorg-nvidia-headless +bin/nvidia-headless-xconfig +bin/nvrun +libexec/nvidia-headless-utils/readconf +%%VIRTUALGL%%bin/nvrun-vgl +%%OPTIRUN%%bin/optirun +libexec/nvidia-settings-hybrid +@sample etc/X11/xorg-nvidia-headless-template.conf.sample +@sample etc/nvidia-headless.conf.sample +@sample etc/nvidia-hybrid.conf.sample +@dir etc/X11/xorg-nvidia-headless.conf.d diff --git a/x11/nvidia-secondary-driver-390/Makefile b/x11/nvidia-secondary-driver-390/Makefile new file mode 100644 index 000000000000..3b4e0f3337dd --- /dev/null +++ b/x11/nvidia-secondary-driver-390/Makefile @@ -0,0 +1,6 @@ +# Created by: Theron Tarigo + +MASTERDIR= ${.CURDIR}/../nvidia-driver-390 +NVSDR_MASTERDIR= ${.CURDIR}/../nvidia-secondary-driver + +.include "${NVSDR_MASTERDIR}/Makefile" diff --git a/x11/nvidia-secondary-driver/Makefile b/x11/nvidia-secondary-driver/Makefile new file mode 100644 index 000000000000..707ebfb8b36d --- /dev/null +++ b/x11/nvidia-secondary-driver/Makefile @@ -0,0 +1,20 @@ +# Created by: Theron Tarigo + +PORTNAME= nvidia-secondary-driver +# Explicitly set PORTREVISION as it can be overridden by the master port +PORTREVISION= 0 + +MASTERDIR?= ${.CURDIR}/../nvidia-driver + +MAINTAINER= theron.tarigo@gmail.com +COMMENT= NVidia graphics card binary drivers for hardware OpenGL rendering on secondary device + +CONFLICTS_INSTALL= nvidia-driver + +EXTENSIONSDIR= lib/xorg/modules-NVIDIA/extensions + +LIBGLDIR= lib/libGL-NVIDIA + +SUB_FILES= pkg-message + +.include "${MASTERDIR}/Makefile" diff --git a/x11/nvidia-secondary-driver/pkg-message b/x11/nvidia-secondary-driver/pkg-message new file mode 100644 index 000000000000..b1d7f346e9ff --- /dev/null +++ b/x11/nvidia-secondary-driver/pkg-message @@ -0,0 +1,4 @@ +Utilization of this driver for GLX acceleration requires special configuration +of an Xorg server instance. + +x11/nvidia-hybrid-graphics is provided to handle this configuration. diff --git a/x11/nvidia-settings/Makefile b/x11/nvidia-settings/Makefile index ab36182de32b..7380136ed74d 100644 --- a/x11/nvidia-settings/Makefile +++ b/x11/nvidia-settings/Makefile @@ -27,11 +27,14 @@ USE_GITHUB= yes GH_ACCOUNT= NVIDIA PLIST_FILES= bin/nvidia-settings \ + libexec/nvidia-settings \ man/man1/nvidia-settings.1.gz \ lib/libnvidia-gtk2.so.${PORTVERSION} \ share/applications/nvidia-settings.desktop \ share/pixmaps/nvidia-settings.png +SUB_FILES= nvidia-settings + LDFLAGS+= -pthread LLD_UNSAFE= yes MAKE_ENV= NV_USE_BUNDLED_LIBJANSSON=0 \ @@ -56,5 +59,9 @@ post-install: .SILENT ${STAGEDIR}/${DESKTOPDIR} ${INSTALL_DATA} ${WRKSRC}/doc/nvidia-settings.png \ ${STAGEDIR}/${PREFIX}/share/pixmaps + ${MV} ${STAGEDIR}${PREFIX}/bin/nvidia-settings \ + ${STAGEDIR}${PREFIX}/libexec/nvidia-settings + ${INSTALL} ${WRKDIR}/nvidia-settings \ + ${STAGEDIR}${PREFIX}/bin/nvidia-settings .include diff --git a/x11/nvidia-settings/files/nvidia-settings.in b/x11/nvidia-settings/files/nvidia-settings.in new file mode 100644 index 000000000000..240c4fb5f56c --- /dev/null +++ b/x11/nvidia-settings/files/nvidia-settings.in @@ -0,0 +1,3 @@ +#!/bin/sh +[ -e "%%LOCALBASE%%/libexec/nvidia-settings-hybrid" ] && exec %%LOCALBASE%%/libexec/nvidia-settings-hybrid "$@" +exec %%PREFIX%%/libexec/nvidia-settings "$@"