233 lines
9.6 KiB
HTML
233 lines
9.6 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<html>
|
|
<head>
|
|
<meta name="generator" content=
|
|
"HTML Tidy for Linux/x86 (vers 1 September 2005), see www.w3.org">
|
|
<meta http-equiv="Content-Type" content=
|
|
"text/html; charset=us-ascii">
|
|
<title>Chapter 35. PRIME Render Offload</title>
|
|
<meta name="generator" content="DocBook XSL Stylesheets V1.68.1">
|
|
<link rel="start" href="index.html" title=
|
|
"NVIDIA Accelerated Linux Graphics Driver README and Installation Guide">
|
|
<link rel="up" href="installationandconfiguration.html" title=
|
|
"Part I. Installation and Configuration Instructions">
|
|
<link rel="prev" href="randr14.html" title=
|
|
"Chapter 34. Offloading Graphics Display with RandR 1.4">
|
|
<link rel="next" href="kms.html" title=
|
|
"Chapter 36. Direct Rendering Manager Kernel Modesetting (DRM KMS)">
|
|
</head>
|
|
<body>
|
|
<div class="navheader">
|
|
<table width="100%" summary="Navigation header">
|
|
<tr>
|
|
<th colspan="3" align="center">Chapter 35. PRIME Render
|
|
Offload</th>
|
|
</tr>
|
|
<tr>
|
|
<td width="20%" align="left"><a accesskey="p" href=
|
|
"randr14.html">Prev</a> </td>
|
|
<th width="60%" align="center">Part I. Installation and
|
|
Configuration Instructions</th>
|
|
<td width="20%" align="right"> <a accesskey="n" href=
|
|
"kms.html">Next</a></td>
|
|
</tr>
|
|
</table>
|
|
<hr></div>
|
|
<div class="chapter" lang="en">
|
|
<div class="titlepage">
|
|
<div>
|
|
<div>
|
|
<h2 class="title"><a name="primerenderoffload" id=
|
|
"primerenderoffload"></a>Chapter 35. PRIME Render
|
|
Offload</h2>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<p>PRIME render offload is the ability to have an X screen rendered
|
|
by one GPU, but choose certain applications within that X screen to
|
|
be rendered on a different GPU. This is particularly useful in
|
|
combination with dynamic power management to leave an NVIDIA GPU
|
|
powered off except when it is needed to render select
|
|
performance-sensitive applications.</p>
|
|
<p>The GPU rendering the majority of the X screen is known as the
|
|
"sink", and the GPU to which certain application rendering is
|
|
"offloaded" is known as the "source". The render offload source
|
|
produces content that is presented on the render offload sink. The
|
|
NVIDIA driver can function as a PRIME render offload source, to
|
|
offload rendering of GLX+OpenGL or Vulkan, presenting to an X
|
|
screen driven by the xf86-video-modesetting X driver.</p>
|
|
<p><a name="requirements" id="requirements"></a></p>
|
|
<h3>X Server Requirements</h3>
|
|
<p>NVIDIA's PRIME render offload support requires X.Org xserver
|
|
version 1.20.7 or newer.</p>
|
|
<p><a name="configurexscreen" id="configurexscreen"></a></p>
|
|
<h3>Configure the X Server</h3>
|
|
<p>On systems with both an integrated GPU and an NVIDIA discrete
|
|
GPU, the X.Org X server version 1.20.7 and newer will automatically
|
|
use NVIDIA's PRIME render offload support if the system BIOS is
|
|
configured to boot on the iGPU and no other explicit configuration
|
|
files are present. Note that some Linux distributions (such as
|
|
Ubuntu) may configure the X server differently. Please refer to
|
|
your distribution's documentation for details.</p>
|
|
<p>If GPU screen creation was successful, the log file <code class=
|
|
"filename">/var/log/Xorg.0.log</code> should contain lines with
|
|
"NVIDIA(G0)", and querying the RandR providers with <code class=
|
|
"computeroutput">xrandr --listproviders</code> should display a
|
|
provider named "NVIDIA-G0" (for "NVIDIA GPU screen 0"). For
|
|
example:</p>
|
|
<pre class="screen">
|
|
Providers: number : 2
|
|
Provider 0: id: 0x221 cap: 0x9, Source Output, Sink Offload crtcs: 3 outputs: 6 associated providers: 0 name:modesetting
|
|
Provider 1: id: 0x1f8 cap: 0x0 crtcs: 0 outputs: 0 associated providers: 0 name:NVIDIA-G0
|
|
</pre>
|
|
<p><a name="configureapplications" id=
|
|
"configureapplications"></a></p>
|
|
<h3>Configure Graphics Applications to Render Using the GPU
|
|
Screen</h3>
|
|
<p>To configure a graphics application to be offloaded to the
|
|
NVIDIA GPU screen, set the environment variable <code class=
|
|
"computeroutput">__NV_PRIME_RENDER_OFFLOAD</code> to <code class=
|
|
"computeroutput">1</code>. If the graphics application uses Vulkan
|
|
or EGL, that should be all that is needed. If the graphics
|
|
application uses GLX, then also set the environment variable
|
|
<code class="computeroutput">__GLX_VENDOR_LIBRARY_NAME</code> to
|
|
<code class="computeroutput">nvidia</code>, so that GLVND loads the
|
|
NVIDIA GLX driver.</p>
|
|
<p>Examples:</p>
|
|
<pre class="screen">
|
|
__NV_PRIME_RENDER_OFFLOAD=1 vkcube
|
|
__NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia glxinfo | grep vendor
|
|
</pre>
|
|
<p></p>
|
|
<p><a name="configureapplicationsvulkan" id=
|
|
"configureapplicationsvulkan"></a></p>
|
|
<h3>Finer-Grained Control of Vulkan</h3>
|
|
<p>The <code class=
|
|
"computeroutput">__NV_PRIME_RENDER_OFFLOAD</code> environment
|
|
variable causes the special Vulkan layer <code class=
|
|
"computeroutput">VK_LAYER_NV_optimus</code> to be loaded. Vulkan
|
|
applications use the Vulkan API to enumerate the GPUs in the system
|
|
and select which GPU to use; most Vulkan applications will use the
|
|
first GPU reported by Vulkan. The <code class=
|
|
"computeroutput">VK_LAYER_NV_optimus</code> layer causes the GPUs
|
|
to be sorted such that the NVIDIA GPUs are enumerated first. For
|
|
finer-grained control, the <code class=
|
|
"computeroutput">VK_LAYER_NV_optimus</code> layer looks at the
|
|
<code class="computeroutput">__VK_LAYER_NV_optimus</code>
|
|
environment variable. The value <code class=
|
|
"computeroutput">NVIDIA_only</code> causes <code class=
|
|
"computeroutput">VK_LAYER_NV_optimus</code> to only report NVIDIA
|
|
GPUs to the Vulkan application. The value <code class=
|
|
"computeroutput">non_NVIDIA_only</code> causes <code class=
|
|
"computeroutput">VK_LAYER_NV_optimus</code> to only report
|
|
non-NVIDIA GPUs to the Vulkan application.</p>
|
|
<p>Examples:</p>
|
|
<pre class="screen">
|
|
__NV_PRIME_RENDER_OFFLOAD=1 __VK_LAYER_NV_optimus=NVIDIA_only vkcube
|
|
__NV_PRIME_RENDER_OFFLOAD=1 __VK_LAYER_NV_optimus=non_NVIDIA_only vkcube
|
|
</pre>
|
|
<p></p>
|
|
<p><a name="configureapplicationsgl" id=
|
|
"configureapplicationsgl"></a></p>
|
|
<h3>Finer-Grained Control of OpenGL</h3>
|
|
<p>For OpenGL with either GLX or EGL, the environment variable
|
|
<code class=
|
|
"computeroutput">__NV_PRIME_RENDER_OFFLOAD_PROVIDER</code> provides
|
|
finer-grained control. While <code class=
|
|
"computeroutput">__NV_PRIME_RENDER_OFFLOAD=1</code> tells GLX or
|
|
EGL to use the first NVIDIA GPU screen, <code class=
|
|
"computeroutput">__NV_PRIME_RENDER_OFFLOAD_PROVIDER</code> can use
|
|
an RandR provider name to pick a specific NVIDIA GPU screen, using
|
|
the NVIDIA GPU screen names reported by <code class=
|
|
"computeroutput">`xrandr --listproviders`</code>.</p>
|
|
<p>Examples:</p>
|
|
<pre class="screen">
|
|
__NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia glxgears
|
|
__NV_PRIME_RENDER_OFFLOAD_PROVIDER=NVIDIA-G0 __GLX_VENDOR_LIBRARY_NAME=nvidia glxgears
|
|
__NV_PRIME_RENDER_OFFLOAD=1 eglinfo
|
|
__NV_PRIME_RENDER_OFFLOAD_PROVIDER=NVIDIA-G0 eglinfo
|
|
</pre>
|
|
<p></p>
|
|
<p><a name="renderoffloadtroubleshooting" id=
|
|
"renderoffloadtroubleshooting"></a></p>
|
|
<h3>Troubleshooting</h3>
|
|
<p>After starting the X server, verify that the
|
|
xf86-video-modesetting X driver is using "glamoregl". The log file
|
|
<code class="filename">/var/log/Xorg.0.log</code> should contain
|
|
something like this:</p>
|
|
<pre class="screen">
|
|
[1272173.618] (II) Loading sub module "glamoregl"
|
|
[1272173.618] (II) LoadModule: "glamoregl"
|
|
[1272173.618] (II) Loading /usr/lib/xorg/modules/libglamoregl.so
|
|
[1272173.622] (II) Module glamoregl: vendor="X.Org Foundation"
|
|
[1272173.622] compiled for 1.20.4, module version = 1.0.1
|
|
[1272173.622] ABI class: X.Org ANSI C Emulation, version 0.4
|
|
[1272173.638] (II) modeset(0): glamor X acceleration enabled on Mesa DRI Intel(R) HD Graphics 630 (Kaby Lake GT2)
|
|
[1272173.638] (II) modeset(0): glamor initialized
|
|
</pre>
|
|
<p>If glamoregl could not be loaded, the X log may report something
|
|
like:</p>
|
|
<pre class="screen">
|
|
[1271802.673] (II) Loading sub module "glamoregl"
|
|
[1271802.673] (II) LoadModule: "glamoregl"
|
|
[1271802.673] (WW) Warning, couldn't open module glamoregl
|
|
[1271802.673] (EE) modeset: Failed to load module "glamoregl" (module does not exist, 0)
|
|
[1271802.673] (EE) modeset(0): Failed to load glamor module.
|
|
</pre>
|
|
<p>in which case, consult your distribution's documentation for how
|
|
to (re-)install the package containing glamoregl.</p>
|
|
<p>If the server didn't create a GPU screen automatically, ensure
|
|
that the nvidia_drm kernel module is loaded. This should normally
|
|
happen by default, but you can confirm by running <code class=
|
|
"computeroutput">lsmod | grep nvidia_drm</code> to see if the
|
|
kernel module is loaded. Run <code class="computeroutput">modprobe
|
|
nvidia_drm</code> to load it.</p>
|
|
<p>If automatic configuration does not work, it may be necessary to
|
|
explicitly configure the iGPU and dGPU devices in xorg.conf:</p>
|
|
<pre class="screen">
|
|
Section "ServerLayout"
|
|
Identifier "layout"
|
|
Screen 0 "iGPU"
|
|
EndSection
|
|
|
|
Section "Device"
|
|
Identifier "iGPU"
|
|
Driver "modesetting"
|
|
EndSection
|
|
|
|
Section "Screen"
|
|
Identifier "iGPU"
|
|
Device "iGPU"
|
|
EndSection
|
|
|
|
Section "Device"
|
|
Identifier "dGPU"
|
|
Driver "nvidia"
|
|
EndSection
|
|
</pre></div>
|
|
<div class="navfooter">
|
|
<hr>
|
|
<table width="100%" summary="Navigation footer">
|
|
<tr>
|
|
<td width="40%" align="left"><a accesskey="p" href=
|
|
"randr14.html">Prev</a> </td>
|
|
<td width="20%" align="center"><a accesskey="u" href=
|
|
"installationandconfiguration.html">Up</a></td>
|
|
<td width="40%" align="right"> <a accesskey="n" href=
|
|
"kms.html">Next</a></td>
|
|
</tr>
|
|
<tr>
|
|
<td width="40%" align="left" valign="top">
|
|
Chapter 34. Offloading Graphics Display with RandR
|
|
1.4 </td>
|
|
<td width="20%" align="center"><a accesskey="h" href=
|
|
"index.html">Home</a></td>
|
|
<td width="40%" align="right" valign="top">
|
|
Chapter 36. Direct Rendering Manager Kernel
|
|
Modesetting (DRM KMS)</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
</body>
|
|
</html>
|