diff --git a/prime-run/.footprint b/prime-run/.footprint new file mode 100644 index 000000000..0e772ad68 --- /dev/null +++ b/prime-run/.footprint @@ -0,0 +1,3 @@ +drwxr-xr-x root/root usr/ +drwxr-xr-x root/root usr/bin/ +-rwxr-xr-x root/root usr/bin/prime-run diff --git a/prime-run/.signature b/prime-run/.signature new file mode 100644 index 000000000..b71acf11b --- /dev/null +++ b/prime-run/.signature @@ -0,0 +1,5 @@ +untrusted comment: verify with /etc/ports/opt.pub +RWSE3ohX2g5d/encmxFU7oERpQHsqxguJrYQ8KXhDKpcphfNzMDFHo2vWFMqxRUOtHg0CZiBqOCWOnkWtIQ4heiVL1fEsVxI3g4= +SHA256 (Pkgfile) = 9f975a8ee0fe6cde31c67d832fcdf077fc354861c2ca5a6872da5c3f0b2d90e7 +SHA256 (.footprint) = ae71aa656f85a80c1b898faba07cbf514108da539a015958a8968cec85cf1d52 +SHA256 (prime-run) = 78f8655fb5c0fc6c93dd50bdbe04c1f6dfe0cde5a01e25d97373b1188a9a5e72 diff --git a/prime-run/Pkgfile b/prime-run/Pkgfile new file mode 100644 index 000000000..08e0258b5 --- /dev/null +++ b/prime-run/Pkgfile @@ -0,0 +1,12 @@ +# Description: A wrapper script for NVIDIA PRIME Render Offload +# URL: https://www.nvidia.com/en-us/drivers/unix/ +# Maintainer: Matt Housh, jaeger at crux dot ninja + +name=prime-run +version=1.0 +release=1 +source=($name) + +build() { + install -D -m 0755 $SRC/$name $PKG/usr/bin/$name +} diff --git a/prime-run/README b/prime-run/README new file mode 100644 index 000000000..ec8fd5d15 --- /dev/null +++ b/prime-run/README @@ -0,0 +1,43 @@ +# +# README for prime-run +# + +This script replaces bbswitch/bumblebee/primus. Details can be found in the +NVIDIA documentation, see: +http://us.download.nvidia.com/XFree86/Linux-x86_64/525.105.17/README/primerenderoffload.html. + +It is intended to be used with the nvidia closed-source drivers. Either nvidia +or nvidia-fb should work. + +Use it by calling it before a program, for example: + + $ prime-run glxinfo + +It may be necessary to load nvidia kernel modules before starting the X +server, for example like so in /etc/rc.modules: + + /sbin/modprobe nvidia + /sbin/modprobe nvidia-drm + /sbin/modprobe nvidia-modeset + /sbin/modprobe nvidia-uvm + +If modules are loaded and devices detected correctly, you should be able to +see multiple xrandr providers like so: + + $ xrandr --listproviders + Providers: number : 2 + Provider 0: id: 0x45 cap: 0xf, Source Output, Sink Output, Source Offload, Sink Offload crtcs: 3 outputs: 4 associated providers: 0 name:modesetting + Provider 1: id: 0x240 cap: 0x0 crtcs: 0 outputs: 0 associated providers: 0 name:NVIDIA-G0 + +Example lspci output: + + $ lspci | grep -E 'VGA|3D' + 00:02.0 VGA compatible controller: Intel Corporation UHD Graphics 620 (rev 07) + 01:00.0 3D controller: NVIDIA Corporation GP108M [GeForce MX150] (rev a1) + +Example prime-run usage test: + + $ glxinfo | grep 'OpenGL renderer' + OpenGL renderer string: Mesa Intel(R) UHD Graphics 620 (KBL GT2) + $ prime-run glxinfo | grep 'OpenGL renderer' + OpenGL renderer string: NVIDIA GeForce MX150/PCIe/SSE2 diff --git a/prime-run/prime-run b/prime-run/prime-run new file mode 100644 index 000000000..7d37bd943 --- /dev/null +++ b/prime-run/prime-run @@ -0,0 +1,9 @@ +#!/bin/bash + +# See http://us.download.nvidia.com/XFree86/Linux-x86_64/525.105.17/README/primerenderoffload.html +# for details for the below variables. + +__GLX_VENDOR_LIBRARY_NAME=nvidia \ +__NV_PRIME_RENDER_OFFLOAD=1 \ +__VK_LAYER_NV_optimus=NVIDIA_only \ +"$@"