Error running deepstream sdk

I plan to use DeepStream for running an image segmentation model on my Jetson Orin. The Orin is not connected to any display, so I SSH into it. I have a Docker container on the Orin for running other processes. I installed all the necessary libraries required for DeepStream inside this Docker container.

Versions:

JetPack: 5.0.2
TensorRT: 8.4.15
Torch: 1.12.0a0+02fb0b0f.nv22.06
DeepStream: 6.1.1

However, when I run a sample test case, I get the following error:

$ deepstream-app -c source1_usb_dec_infer_resnet_int8.txt
No EGL Display
nvbufsurftransform: Could not get EGL display connection
nvbuf_utils: ERROR getting proc addr of eglCreateImageKHR
nvbuf_utils: ERROR getting proc addr of eglDestroyImageKHR
nvdc: open: No such file or directory
nvdc: failed to open ‘/dev/tegra_dc_ctrl’.
Could not open DRM failed
** ERROR: main:716: Failed to set pipeline to PAUSED
Quitting
ERROR from sink_sub_bin_sink1: GStreamer error: state change failed and some element failed to post a proper error message with the reason for the failure.
Debug info: gstbasesink.c(5367): gst_base_sink_change_state (): /GstPipeline:pipeline/GstBin:processing_bin_0/GstBin:sink_bin/GstBin:sink_sub_bin1/GstNvDrmVideoSink:sink_sub_bin_sink1:
Failed to start
App run failed

I tried various solutions online, but none of them worked. I attempted to unset DISPLAY to fix the EGL connection error, but it didn’t resolve the issue.

Greatly appreciate any help !!!

Did you change the type of sink config in source1_usb_def_infer_resnet_int8.txt? By default it is 2 which means display on the screen, you can change it to a file or other options.

PS, please also check $DISPLAY is set or not in the shell environment, you’ll need to unset it if there is a value and if you want to run remotely via SSH.

I have unset the $DISPLAY, but the same error persists. I will check by changing the sink type.

Apart from the EGL display error, could you please guide me in resolving other errors?

You need to replace the sink plugin first, and then troubleshoot other problems.

1. I modified the sink type to save the output to a file. Please find my source file below :

[application]
enable-perf-measurement=1
perf-measurement-interval-sec=5

[tiled-display]
enable=0

[source0]
enable=1
type=2
uri=file:///opt/nvidia/deepstream/deepstream/samples/streams/sample_720p.h264
num-sources=1
gpu-id=0
cudadec-memtype=0

[sink0]
enable=0
type=3
#1=mp4 2=mkv
container=1
#1=h264 2=h265 3=mpeg4
codec=1
encoder type 0=Hardware 1=Software
enc-type=0
sync=0
bitrate=2000000
#H264 Profile - 0=Baseline 2=Main 4=High
#H265 Profile - 0=Main 1=Main10
profile=0
output-file=/home/developer/revanth/out.mp4
source-id=0

[osd]
enable=1
gpu-id=0
border-width=3
text-size=15
text-color=1;1;1;1;
text-bg-color=0.3;0.3;0.3;1.0
font=Arial
show-clock=1
clock-x-offset=800
clock-y-offset=820
clock-text-size=12
clock-color=1;0;0;1

[streammux]
live-source=0
batch-size=1
batched-push-timeout=40000
width=1280
height=720

[primary-gie]
enable=1
model-engine-file=/opt/nvidia/deepstream/deepstream/samples/models/Primary_Detector/resnet10.caffemodel_b1_gpu0_fp16.engine
batch-size=1
gpu-id=0
labelfile-path=/opt/nvidia/deepstream/deepstream/samples/models/Primary_Detector/labels.txt
config-file=/opt/nvidia/deepstream/deepstream/samples/configs/deepstream-app/config_infer_primary.txt

2. I did echo $DISPLAY and I don’t see any value, which is correct.

Here is the detailed error log

/opt/nvidia/deepstream/deepstream/samples/configs/deepstream-app$ GST_DEBUG=3 deepstream-app -c source1_usb_dec_infer_resnet_int8_trial.txt
No EGL Display
nvbufsurftransform: Could not get EGL display connection
nvbuf_utils: ERROR getting proc addr of eglCreateImageKHR
nvbuf_utils: ERROR getting proc addr of eglDestroyImageKHR
0:00:04.849562609 4102 0xaaaae553f930 INFO nvinfer gstnvinfer.cpp:646:gst_nvinfer_logger:<primary_gie> NvDsInferContext[UID 1]: Info from NvDsInferContextImpl::deserializeEngineAndBackend() <nvdsinfer_context_impl.cpp:1909> [UID = 1]: deserialized trt engine from :/opt/nvidia/deepstream/deepstream/samples/models/Primary_Detector/resnet10.caffemodel_b1_gpu0_fp16.engine
INFO: [Implicit Engine Info]: layers num: 3
0 INPUT kFLOAT input_1 3x368x640
1 OUTPUT kFLOAT conv2d_bbox 16x23x40
2 OUTPUT kFLOAT conv2d_cov/Sigmoid 4x23x40

0:00:05.008280275 4102 0xaaaae553f930 INFO nvinfer gstnvinfer.cpp:646:gst_nvinfer_logger:<primary_gie> NvDsInferContext[UID 1]: Info from NvDsInferContextImpl::generateBackendContext() <nvdsinfer_context_impl.cpp:2012> [UID = 1]: Use deserialized engine model: /opt/nvidia/deepstream/deepstream/samples/models/Primary_Detector/resnet10.caffemodel_b1_gpu0_fp16.engine
nvbufsurface: eglGetDisplay failed with error 0x300c
nvbufsurface: Can’t get EGL display
0:00:05.034670909 4102 0xaaaae553f930 ERROR nvinferallocator gstnvinfer_allocator.cpp:102:gst_nvinfer_allocator_alloc: Error: Could not map EglImage from NvBufSurface for nvinfer
0:00:05.034688669 4102 0xaaaae553f930 WARN GST_BUFFER gstbuffer.c:951:gst_buffer_new_allocate: failed to allocate 88 bytes
0:00:05.034709181 4102 0xaaaae553f930 WARN bufferpool gstbufferpool.c:305:do_alloc_buffer: alloc function failed
0:00:05.034714525 4102 0xaaaae553f930 WARN bufferpool gstbufferpool.c:338:default_start: failed to allocate buffer
0:00:05.034718365 4102 0xaaaae553f930 ERROR bufferpool gstbufferpool.c:559:gst_buffer_pool_set_active: start failed
0:00:05.034726845 4102 0xaaaae553f930 WARN nvinfer gstnvinfer.cpp:943:gst_nvinfer_start:<primary_gie> error: Failed to set buffer pool to active
0:00:05.036631669 4102 0xaaaae553f930 WARN GST_PADS gstpad.c:1142:gst_pad_set_active:<primary_gie:sink> Failed to activate pad
ERROR: main:716: Failed to set pipeline to PAUSED
Quitting
ERROR from primary_gie: Failed to set buffer pool to active
Debug info: /dvs/git/dirty/git-master_linux/deepstream/sdk/src/gst-plugins/gst-nvinfer/gstnvinfer.cpp(943): gst_nvinfer_start (): /GstPipeline:pipeline/GstBin:primary_gie_bin/GstNvInfer:primary_gie
App run failed

The above error logs are seen when I run the deepstream samples inside my Orin’s custom docker.
Deepstream runs without errors if I run it outside my docker.

But I want to run it inside my docker

This info might help you in debugging

Could you set enable to 1 and try?

Understood, it’s an oversight. I will try enabling the sink after going to my workplace.

One more question, yesterday I also tried connecting the display to my orin just for checking. The deepstream-test1-app worked when checked outside my docker container.

I used the default source and config files provided for deepstream-test1-app. The command I used is :

./deepstream-test1-app /opt/nvidia/deepstream/deepstream- 6.1/samples/streams/sample_720p.h264

But when I run the same app, inside my custom docker, while the orin is connected to display, I got the similar EGL display error. Is it expected ? Docker won’t recognize display ?

Did you run the command xhost +? You can refer to our FAQ.

I enabled the sink but still see the same error

To summarize,
I ssh into my orin (orin is physically not connected to any display in this case), and when I run any sample apps outside the docker container, the deepstream app runs without any issues.

But when I run it inside my docker container, it always throws errors related to EGL display and nvbuf as shown below :

  1. When Sink type = 3 (Encode + File Save (encoder + muxer + filesink)):
/opt/nvidia/deepstream/deepstream/samples/configs/deepstream-app$ GST_DEBUG=3 deepstream-app -c test.txt 
**No EGL Display **
**nvbufsurftransform: Could not get EGL display connection**
**nvbuf_utils: ERROR getting proc addr of eglCreateImageKHR**
**nvbuf_utils: ERROR getting proc addr of eglDestroyImageKHR**
0:00:00.122765043   527 0xaaaab5659610 WARN     GST_ELEMENT_FACTORY gstelementfactory.c:458:gst_element_factory_make: no such element factory "nvv4l2h264enc"!
** ERROR: <create_encode_file_bin:386>: Failed to create 'sink_sub_bin_encoder1'
** ERROR: <create_encode_file_bin:478>: create_encode_file_bin failed
** ERROR: <create_sink_bin:792>: create_sink_bin failed
** ERROR: <create_processing_instance:815>: create_processing_instance failed
** ERROR: <create_pipeline:1327>: create_pipeline failed
** ERROR: <main:697>: Failed to create pipeline
Quitting
App run failed

  1. When Sink type =1 (Fakesink)
sudo GST_DEBUG=3 deepstream-app -c deepstream_app_config.txt 
No EGL Display 
nvbufsurftransform: Could not get EGL display connection
nvbuf_utils: ERROR getting proc addr of eglCreateImageKHR
nvbuf_utils: ERROR getting proc addr of eglDestroyImageKHR
Deserialize yoloLayer plugin: yolo
0:00:06.279344823   632 0xaaaaf9982660 INFO                 nvinfer gstnvinfer.cpp:646:gst_nvinfer_logger:<primary_gie> NvDsInferContext[UID 1]: Info from NvDsInferContextImpl::deserializeEngineAndBackend() <nvdsinfer_context_impl.cpp:1909> [UID = 1]: deserialized trt engine from :/home/developer/revanth/DeepStream-Yolo/model_b1_gpu0_fp32.engine
INFO: [Implicit Engine Info]: layers num: 5
0   INPUT  kFLOAT data            3x640x640       
1   OUTPUT kFLOAT num_detections  1               
2   OUTPUT kFLOAT detection_boxes 8400x4          
3   OUTPUT kFLOAT detection_scores 8400            
4   OUTPUT kFLOAT detection_classes 8400            

0:00:06.429591211   632 0xaaaaf9982660 INFO                 nvinfer gstnvinfer.cpp:646:gst_nvinfer_logger:<primary_gie> NvDsInferContext[UID 1]: Info from NvDsInferContextImpl::generateBackendContext() <nvdsinfer_context_impl.cpp:2012> [UID = 1]: Use deserialized engine model: /home/developer/revanth/DeepStream-Yolo/model_b1_gpu0_fp32.engine
nvbufsurface: eglGetDisplay failed with error 0x300c
nvbufsurface: Can't get EGL display
0:00:06.455536975   632 0xaaaaf9982660 ERROR       nvinferallocator gstnvinfer_allocator.cpp:102:gst_nvinfer_allocator_alloc: Error: Could not map EglImage from NvBufSurface for nvinfer
0:00:06.455555887   632 0xaaaaf9982660 WARN              GST_BUFFER gstbuffer.c:951:gst_buffer_new_allocate: failed to allocate 88 bytes
0:00:06.455574863   632 0xaaaaf9982660 WARN              bufferpool gstbufferpool.c:305:do_alloc_buffer:<bufferpool0> alloc function failed
0:00:06.455580111   632 0xaaaaf9982660 WARN              bufferpool gstbufferpool.c:338:default_start:<bufferpool0> failed to allocate buffer
0:00:06.455584431   632 0xaaaaf9982660 ERROR             bufferpool gstbufferpool.c:559:gst_buffer_pool_set_active:<bufferpool0> start failed
0:00:06.455593455   632 0xaaaaf9982660 WARN                 nvinfer gstnvinfer.cpp:943:gst_nvinfer_start:<primary_gie> error: Failed to set buffer pool to active
0:00:06.482067642   632 0xaaaaf9982660 WARN                GST_PADS gstpad.c:1142:gst_pad_set_active:<primary_gie:sink> Failed to activate pad
** ERROR: <main:716>: Failed to set pipeline to PAUSED
Quitting
ERROR from primary_gie: Failed to set buffer pool to active
Debug info: /dvs/git/dirty/git-master_linux/deepstream/sdk/src/gst-plugins/gst-nvinfer/gstnvinfer.cpp(943): gst_nvinfer_start (): /GstPipeline:pipeline/GstBin:primary_gie_bin/GstNvInfer:primary_gie
App run failed

I tried this : Running deepstream sample apps in docker container requires host networking and root user

but no improvement

Requesting quick help on this

So did you run xhost + on your host?
I have run the source4_1080p_dec_infer-resnet_tracker_sgie_tiled_display_int8.txt on my board without connecting to a monitor. It works normally.

The link you have provided says, it is for dgpu.

So you mean I have to follow these steps :

  1. xdpyinfo | grep display Use this command to see if host has a display value.
  2. Ssh into my orin
  3. Use the command “xhost +”
  4. Launch the docker on orin.

Is it right?

When you launch the docker, you can also run unset DISPLAY in the docker first.