1
0
forked from ports/opt

prime-run: initial import

This commit is contained in:
Matt Housh 2023-04-03 23:14:48 -05:00
parent 5c2ee4f5de
commit 75e5d387a2
5 changed files with 72 additions and 0 deletions

3
prime-run/.footprint Normal file
View File

@ -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

5
prime-run/.signature Normal file
View File

@ -0,0 +1,5 @@
untrusted comment: verify with /etc/ports/opt.pub
RWSE3ohX2g5d/encmxFU7oERpQHsqxguJrYQ8KXhDKpcphfNzMDFHo2vWFMqxRUOtHg0CZiBqOCWOnkWtIQ4heiVL1fEsVxI3g4=
SHA256 (Pkgfile) = 9f975a8ee0fe6cde31c67d832fcdf077fc354861c2ca5a6872da5c3f0b2d90e7
SHA256 (.footprint) = ae71aa656f85a80c1b898faba07cbf514108da539a015958a8968cec85cf1d52
SHA256 (prime-run) = 78f8655fb5c0fc6c93dd50bdbe04c1f6dfe0cde5a01e25d97373b1188a9a5e72

12
prime-run/Pkgfile Normal file
View File

@ -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
}

43
prime-run/README Normal file
View File

@ -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

9
prime-run/prime-run Normal file
View File

@ -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 \
"$@"