DRIVE 5.0 Linux Open Source Software

Development Guide Release

Building and Running Samples
Building the Samples
Using NV_WINSYS when Building Graphics Samples
Running OpenGL ES Samples
Resolution Selection
Layer Selection
Antialiasing Specification
Running Samples
Program Binary Selection
Running Vulkan Samples
The procedures in this chapter enable you to build and run the samples included in your NVIDIA® Tegra® product.
You have logged into the target.
Building the Samples
The samples all come with source code and a Makefile.
To build any of the samples
1. Make a copy of the default binaries.
2. On the host PC, simply enter:
cd $SDK_TOP/drive-t186ref-linux/samples/opengles2/<sample>
make clean
Where <sample> is the sample name, for example gears.
3. Rerun the copytarget script, passing in the path to the targetfs to ensure that the new binary is copied over to the target:
<top>/drive-t186ref-linux/utils/scripts/copytarget <targetfs_dir>
Caution: If the copytarget script is invoked without specifying a <targetfs_dir>, the script will corrupt the host system files.
Using NV_WINSYS when Building Graphics Samples
Every platform has a default windowing system. Most samples are set up to compile on 5 different windowing systems, depending on the platform. To switch to a different windowing system than the one you default to, export NV_WINSYS with 1 of these values:
vulkan-d2d (vulkan only)
Binaries are saved in separate subdirectories with the same name, so you can maintain the output for multiple windowing systems. To see what is supported on your platform, use the du command within a sample directory:
$ du
56 ./wayland
64 ./egldevice
456 .
In the example above, wayland and egldevice are supported. If du returns no subdirectories, then your sample has not been converted.
To see the default and list of supported values, run make without setting NV_WINSYS. The following shows examples:
../../../make/nvdefs.mk:108: 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/nvdefs.mk:123: *** Invalid NV_WINSYS value: wayland. Stop.
Use export NV_WINSYS=<value> to set the value permanently. If you want to set NV_WINSYS temporarily, use the env command:
env NV_WINSYS=<value> make
For Vulkan samples, the vulkan-d2d windsys must be used.
Running OpenGL ES Samples
There are four 3D graphics samples called bubble, ctree, gears, and gear-cube, two EGLStream demos called eglcrosspart and eglstreamcube, and one 2D text rendering application called drawfront.
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>
Set the screen resolution with (only supported for EGLDevice):
-screensize <xres> <yres>
Set them all at once by using the following shortcut flag:
-res <xres> <yres>
Setting the screen resolution from multiple apps simultaneously can lead to undesired results. Only one app should control the screen resolution.
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 of layer options are: 0, 1, 2.
Antialiasing Specification
Multisample antialiasing (MSAA) can be specified with:
-msaa <numsamples>
The numsamples specified must be 2, 4, or 8.
Running Samples
By default, if no command line arguments are supplied, the sample applications run at a resolution of 800 x 480.
To run gears for EGLDevice
cd /home/nvidia/ drive-t186ref-linux/samples/opengles2/gears/egldevice
./gears -res <x-res> <y-res> <runtime, -1 to run forever>
To run gears for X11
export DISPLAY=:0
cd /home/nvidia/drive-t186ref-linux/samples/opengles2/gears/x11
./gears -res <x-res> <y-res> <runtime, -1 to run forever>
Program Binary Selection
Applications can use this option to load the pre-compiled program binary from its current execution path. 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
Currently, only the direct to display WSI backend is supported for Vulkan samples. To run Vulkan samples, other windowing systems must be temporarily disabled. For example, with X, this can be done by following the directions under the Manually Starting X Server section under Configuring the X11 Window Manager.
There are two Vulkan sample applications in the SDK called vkfish and vkcube that can be found under:
Vkfish is a modified version of NVIDIA’s threaded rendering Vulkan sample found here:
It has been modified to use the direct to display WSI platform with its UI stripped for simplification.
To run vkfish with direct to display:
1. Disable other windowing systems.
2. Run:
cd /home/nvidia/drive-t186ref-linux/samples/vulkan/vkfish/vulkan-d2d
3. Restart windowing systems, if necessary.
Vkfish currently does not support command line arguments and runs forever by default.
Vkcube is a modified version of LunarG’s Vulkan cube demo found here:
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. Run:
cd /home/nvidia/drive-t186ref-linux/samples/vulkan/vkcube/vulkan-d2d
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.