DRIVE 5.0 Linux Open Source Software

Development Guide Release

Tegra to dGPU Communication
GPU Selection in EGL/OpenGL
This topic describes the setup and usage of dGPU versus iGPU with the DRIVE PX 2 platform.
The information in this topic is preliminary.
GPU Selection in EGL/OpenGL
This section describes how to select between dGPU and iGPU for EGL and OpenGL ES operations.
This section describes the necessary EGL operations. Stream clients such as CUDA or NvMedia may require additional operations to select the GPU.
GPU selection is determined by the choice of EGLDisplay. Each EGLDisplay available from EGL is associated with a single GPU. There are two ways an EGLDisplay can be obtained:
1. A native window system display handle can be passed to the eglGetDisplay function (available in core EGL 1.4) or the eglGetPlatformDisplayEXT function (available from the EGL_EXT_platform_base extension).
2. The list of GPUs can be enumerated with eglQueryDevicesEXT (available from the EGL_EXT_device_enumeration extension) and the selected device can be passed to the eglGetPlatformDisplayEXT function (available from the EGL_EXT_platform_base extension) using EGL_PLATFORM_DEVICE_EXT as the platform type.
Window system output is supported on the Tegra iGPU. All EGLDisplays obtained from native window system displays using the first option are associated with the iGPU. To access the dGPU, applications must use the second option. When enumerating the GPUs, the Tegra iGPU is the first EGLDevice in the list, and the dGPU is the second EGLDevice.
To perform OpenGL[ES] rendering with a particular GPU, an EGLContext must be created from an EGLDisplay corresponding to that GPU. EGLContexts created from different GPUs, and therefore EGLDisplays, cannot directly share resources such as textures and vertex buffer objects. However, they can exchange completed frames using EGLStreams.
When operating within a single GPU and a single process, a stream can consist of a single EGLStream object created from the appropriate EGLDisplay. Both producer and consumer endpoints are attached to this object.
When operating between different GPUs and/or processes, separate EGLStream objects are required for each endpoint. The producer creates an EGLStream from an EGLDisplay associated with the source GPU, and the consumer similarly creates an EGLStream from an EGLDisplay associated with the target GPU. The two objects are connected together using the methods described in either the EGL_KHR_stream_cross_process_fd or EGL_NV_stream_remote extensions.
On systems that support both a Tegra GPU and a discrete GPU, they are accessed through separate EGLDisplays. The window system, if any, is associated with the Tegra GPU. The EGLDisplay for it can be obtained either by using the generic EGLDevice implementation or using the implementation for the appropriate window system. The discrete GPU can only be accessed through EGLDevice. It will be the second one in the list of devices.
Streaming between GPUs is handled the same way as a cross-process stream:
1. The application(s) create one EGLStream object, obtain a file descriptor from it, and then create a second EGLStream object from that file descriptor.
2. One object is used for the producer, and the other for the consumer.
The only difference for cross-GPU streaming is that where normally both EGLStreams are created from the same EGLDisplay, the application(s) instead create one EGLStream from an EGLDisplay for the Tegra, and the other from an EGLDisplay for the discrete GPU.
All other stream operations proceed as normal.
The following restrictions must be observed for dGPU usage (GP106-SKU605):
NvDEC/NvENC/NvDisplay are not supported.
dGPU frequency and memory clock are set at NvGPU initialization.
dGPU core voltage is set at NvGPU initialization based on chip specific speed values.
dGPU memory voltage is set at NvGPU initialization.
Thermal management supports shutdown at 105° Celsius (C). No thermal alert is exposed, no thermal slowdown is performed.
SDRAM ECC is disabled
For EGLStreams usage, the following restrictions must be observed:
Only dGPU consumer support is provided
Producer must supply surface in pitch linear format
No support for OpenGLES on dGPU
For CUDA usage, the following restrictions must be observed:
No CUDA tools support
Limited Tegra tools support including:
No CUDA Runtime and Driver API trace
No GPU workload trace
Either iGPU or dGPU is supported per process, never both
By default dGPU is selected
To select iGPU
Set the environment variable as follows: