This sample demonstrates how to render video stream or UI with the NVIDIA® Tegra® Direct Rendering Manager (DRM). This sample provides rendering support on non-X11 and lightweight display systems. The DRM is implemented in user-space and is compatible with DRM 2.0.
A DRM is a subsystem of the Linux kernel that interfaces with GPUs.
The sample supports two running modes, depending on the --disable-video
option:
The sample demonstrates the supported DRM buffer allocation policies:
The sample supports these video formats:
$ cd /usr/src/jetson_multimedia_api/samples/08_video_dec_drm $ make
$ sudo sh -c 'echo 4 > /sys/class/graphics/fb1/blank' $ sudo sh -c 'echo 4 > /sys/class/graphics/fb2/blank' $ sudo sh -c 'echo 4 > /sys/class/graphics/fb0/blank' $ sudo sh -c 'echo 0x0 > /sys/class/graphics/fb1/device/win_mask' $ sudo sh -c 'echo 0x0 > /sys/class/graphics/fb2/device/win_mask' $ sudo sh -c 'echo 0x0 > /sys/class/graphics/fb0/device/win_mask' $ sudo sh -c 'echo 0x3f > /sys/class/graphics/fb0/device/win_mask' $ sudo sh -c 'echo 0 > /sys/class/graphics/fb0/blank'
$ sudo systemctl stop gdm $ sudo loginctl terminate-seat seat0
$ sudo sh -c 'echo 0 > /sys/class/graphics/fb1/blank'
$ sudo ./video_dec_drm <in-file> <in-format> [options]
$ ./video_dec_drm --help
$ sudo ./video_dec_drm --disable-video
$ sudo ./video_dec_drm ../../data/Video/sample_outdoor_car_1080p_10fps.h264 H264 --disable-ui
$ sudo ./video_dec_drm ../../data/Video/sample_outdoor_car_1080p_10fps.h264 H264
$ sudo systemctl start gdm
The following diagram shows the flow of data through the sample.
The following diagram shows the interactions between the separate threads in the sample.
If the options include --disable-video
, the sample does the following:
Otherwise:
The following tables shows the key classes and functions that this sample uses.
Class | Description |
---|---|
class NvDrmRenderer | Contains elements and functions to render frames with tegra DRM. |
class NvVideoDecoder | Contains all video decoding-related elements and functions. |
class NvVideoConverter | Contains elements and functions for video format conversion. |
Function | Description |
---|---|
ui_render_loop_fcn | Thread function to render the UI image. |
renderer_dequeue_loop_fcn | Thread function to dequeue the flipped frame from NvDrmRenderer(). |
conv0_capture_dqbuf_thread_callback | Callback function to enqueue a new frame into NvDrmRenderer. |
conv0_output_dqbuf_thread_callback | Callback function to receive a frame from decoder and process format conversion. |