Building and Running Samples
To build and run the samples, you must be logged on the target system.
Building the Samples
The samples are provided with source code and a Makefile.
To build the samples
1. Make a copy of the default binaries.
2. On the host system, execute these commands:
cd $<top>/drive-t186ref-linux/samples/opengles2/<sample>
make clean
Where <sample> is the name of the sample you wish to build. For example, gears.
3. Rerun the copytarget script, passing in the path to the targetfs to ensure that the new binary is copied o to the target:
<top>/drive-t186ref-linux/utils/scripts/copytarget-samples <targetfs_dir>
If the copytarget script is invoked without specifying a <targetfs_dir>, the script corrupts the host system files.
Running the DriveWorks Samples
Before attempting to run the DriveWorks samples, consult the procedures provided in Configuring the Host System to Run DriveWorks Samples.
Using NV_WINSYS when Building Graphics Samples
The platform includes a default windowing system, however additional window systems are also supported. Each of the graphics samples may be built for all the supported window systems for a given platform.
To switch to a different windowing system
Export NV_WINSYS with one of these values:
wayland (For Linux only)
x11 (For Linux only)
direct-to-display (For Vulkan samples only)
screen (For QNX only)
Binaries are saved in separate subdirectories depending upon the window system with the same name, so you can maintain the output for multiple windowing systems.
To see the default and list of supported values, run make without setting NV_WINSYS. The following shows examples:
../../../make/ Defaulting NV_WINSYS to egldevice, other values are wayland.
If NV_WINSYS is set to a value that is not supported for your platform, you will get an error when you run make, for example:
../../../make/ *** Invalid NV_WINSYS value: wayland. Stop.
Use export NV_WINSYS=<value> to set the value permanently in your shell. If you want to set NV_WINSYS temporarily, use the env command:
env NV_WINSYS=<value> make
For Vulkan samples, the direct-to-display windowing system value must be used.
Running OpenGL ES 2.0 Samples
All of the graphics samples are present in:
There are three 3D graphics sample applications in the PDK called ctree, bubble, gears-cube and gears, and one 2D text rendering application called drawfont. Along with these, eglstreamcube which is a cross-process eglstream application and eglcrosspart is a cross partition eglstream application. There are several utility libraries used by the graphics samples. nvgldemo is a general EGL and OpenGL ES framework to simplify common functionality such as the EGL initialization sequence for any particular windowing system, creation of an OpenGL ES context, OpenGL ES shader usage, and EGLStream setup.  All of the graphics samples use nvgldemogears-lib contains OpenGL ES rendering code common to the multiple graphics samples that show the classic 3D spinning gears. nvtexfont is a small library to draw text using OpenGL ES textures and is used by several of the graphics samples.
Applications that use the PDK can run on any connected display output device and at any resolution. The sample applications provide command line options to adjust the display settings.
Resolution Selection
Applications can set the resolution of the application's output with the following flag:
-windowsize <xres> <yres>
This is the window size of the application.
Set the screen resolution with:
-screensize <xres> <yres>
This option is used to set the screen size when there is no windowing system running, as is the case for egldevice.  When a windowing system like X11 or Weston or QNX Screen is running, the screen size has already been set and this option is ignored.
For specifying a desktop offset, use the flag:
-windowoffset <xoffset> <yoffset>
Layer Selection
Applications can select the overlay where you want to direct the sample output. Three overlays are supported so you can run up to three applications simultaneously.
-layer <depth>
Valid values are platform-dependent.
For T194, valid values are 0, 1,2 for dispno 0, 1 and 0,1 for dispno 2,3
Here, dispno is the display number which is assigned serially from 0 through 3 for the four displays on a DRIVE AGX SoC.
Antialiasing Specification
Multi-sample antialiasing (MSAA) can be specified with:
-msaa <numsamples>
The numsamples specified are platform-dependent.
For Xavier SoC, valid values are 2, 4, or 8.
Running Samples
By default, if no command line arguments are supplied, the sample applications run at a native resolution for the connected display.
These procedures are specific to the EGLDevice windowing system. To run the samples on other windowing systems, the compositor for the windowing system must be run before the applications can be run on top of it.
To run gears
For an EGL device platform execute the command:
cd /home/nvidia/drive-t186ref-linux/samples/opengles2/gears/egldevice
./gears -res <x-res> <y-res> <runtime or -1 to run forever>
To display the help options for running these demonstration graphics applications, execute the help command as follows:
./gears -h
To run the graphics samples on a specific windowing system
1. Ensure the compositor is running.
2. Select the desired graphics sample to run on top of the chosen windowing system.
Additional supported backends include:
X11 for Linux
QNX screen for running these graphics samples on QNX
For screen as the backend, run screen as described in the QNX screen graphic subsystem documentation, then run any of the graphics samples.
Program Binary Selection
Applications can use this option to load the pre-compiled program binary from its current execution path. The program binaries are generated for all supported architectures when the ‘make’ command is run. These binaries are generated into separate directories, each with the supported architecture name. The correct directory name needs to be specified when running the sample app.
If the program binaries are not present, the application will create the program binary from shader source and save the created program binary in the current execution path. The application can then use these saved program binaries on the next run. The flag to control use of program binary is:
-useprogbin <boolean>
Where <boolean> is either 0 or 1.
Running Vulkan Samples
The direct to display WSI backend is supported.
To run Vulkan samples, other windowing systems must be temporarily disabled. For example, with X11 installations, execute these commands:
sudo service lightdm stop
<run sample>
sudo service lightdm start
There are two Vulkan sample applications in the SDK called vkfish and vkcube that can be found under:
Vkfish is a modified version of the NVIDIA threaded rendering Vulkan sample available at:
It has been modified to use the direct to display WSI platform with the interface stripped for simplification.
To run vkfish with direct to display:
1. Disable other windowing systems.
2. Execute the command:
cd /home/nvidia/drive-t186ref-linux/samples/vulkan/vkfish/direct-to-display
3. Restart windowing systems, if necessary.
Vkfish does not support command line arguments and runs forever by default.
Vkcube is a modified version of the LunarG Vulkan cube demonstration available at:
It has been modified to use the direct to display WSI platform.
To run vkcube with direct to display:
1. Disable other windowing systems.
2. Execute the command:
cd /home/nvidia/drive-t186ref-linux/samples/vulkan/vkcube/direct-to-display
3. Restart windowing systems, if necessary.
The sample may be run with --c <framecount> to render a certain number of frames, but will otherwise run forever.