Capturing image using gstreamer on AGX orin: NvBuFfSurfaceFromFd failed

Hi
I am capturing video using gstreamer.
Since I didn’t connect a monitor on Orin, I capture images and record it into a video file. Running the folowing command:

gst-launch-1.0 nvarguscamerasrc ! 'video/x-raw(memory:NVMM),width=(int)1944, height=(int)1096, format=(string)NV12, framerate=(fraction)30/1' ! nvv4l2h264enc ! h264parse ! qtmux ! filesink location=test.mp4 -e

Then the logs dumps:

Setting pipeline to PAUSED ...   
Opening in BLOCKING MODE               
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
Redistribute latency...                                                                                                                                                                                     
NvMMLiteOpen : Block : BlockType = 4 
===== NVMEDIA: NVENC =====
NvMMLiteBlockCreate : Block : BlockType = 4 
GST_ARGUS: Creating output stream
CONSUMER: Waiting until producer is connected...
GST_ARGUS: Available Sensor modes :
GST_ARGUS: 1944 x 1096 FR = 59.999999 fps Duration = 16666667 ; Analog Gain range min 1.000000, max 44.400002; Exposure Range min 44000, max 478696000;
GST_ARGUS: Running with following settings:
   Camera index = 0 
   Camera mode  = 0 
   Output Stream W = 1944 H = 1096 
   seconds to Run    = 0 
   Frame Rate = 59.999999 
GST_ARGUS: Setup Complete, Starting captures for 0 seconds
GST_ARGUS: Starting repeat capture requests.
CONSUMER: Producer has connected; continuing.
nvbuf_utils: dmabuf_fd -1 mapped entry NOT found
Error generated. /dvs/git/dirty/git-master_linux/multimedia/nvgstreamer/gst-nvarguscamera/gstnvarguscamerasrc.cpp, threadExecute:694 NvBufSurfaceFromFd Failed.
Error generated. /dvs/git/dirty/git-master_linux/multimedia/nvgstreamer/gst-nvarguscamera/gstnvarguscamerasrc.cpp, threadFunction:247 (propagating)
Got EOS from element "pipeline0".
Execution ended after 0:00:04.014890296
Setting pipeline to NULL ...
GST_ARGUS: Cleaning up

The file “Test.mp4” is not created, dmesg dumps:


[  158.146117] [RCE] NVCSILP clock rate = 408000000 Hz.
[  158.374117] [RCE] VI5: tegra_vi_channel_alloc()
[  158.374124] [RCE] VI5: unit 0 stream ID table:
[  158.374125] [RCE] VI5: unit 0 stream ID table from THI:
[  158.374127] [RCE] VI5: FALCON_CSB_AFBIF_STREAMID_CTL = 0x00
[  158.374129] [RCE] VI5: vi5_trace_enable: configuring trace buffer at iova=0xc55dda00 size=32768
[  158.374130] [RCE] VI5: tegra_vi_channel_alloc: ch=11
[  158.440024] Tegra_Channel_Start_Streaming
[  158.451605] vi5_channel_start_streaming
[  158.451609] Channel.c: tegra_channel_set_stream
[  158.454472] bwmgr API not supported
[  158.460179] tegra_csi_s_stream
[  158.460306] Tegra channel set stream OK
[  158.460410] bwmgr API not supported
[  158.486119] [RCE] VI5: tegra_vi_channel_reset(11)
[  158.486230] [RCE] VI5: vi5_channel_disable(11)
[  158.486231] [RCE] VI5: vi5 reset completed in 1 retries
[  158.486232] [RCE] VI5: tegra_vi_channel_reset(11)
[  158.486233] [RCE] VI5: vi5_channel_disable(11)
[  158.486233] [RCE] VI5: tegra_vi_channel_reset(11)
[  158.486234] [RCE] VI5: vi5_channel_disable(11)
[  158.486235] [RCE] VI5: vi5 reset completed in 1 retries
[  158.486236] [RCE] tegra_nvcsi_stream_tpg_disable(vm0, stream=4, vc=0)
[  158.486237] [RCE] tegra_nvcsi_stream_tpg_disable: channel 0 is already disabled
[  158.486238] [RCE] VI5: tegra_vi_channel_release(11)
[  158.486239] [RCE] VI5: vi5_channel_disable(11)
[  158.486240] [RCE] VI5: vi5 reset completed in 1 retries
[  158.486240] [RCE] VI5: vi5_update_streams: ch=11 stream_mask=0x00
[  158.486241] [RCE] VI5: tegra_vi_channel_alloc()
[  158.486242] [RCE] VI5: tegra_vi_channel_alloc: ch=11
[  158.486243] [RCE] tegra_nvcsi_stream_set_config(vm0, stream=4, csi=4)
[  158.486244] [RCE] MIPI clock = 180000 kHz, tHS-SETTLE = 0, tCLK-SETTLE = 0
[  158.486244] [RCE] tegra_nvcsi_stream_open(vm0, stream=4, csi=4)
[  158.486245] [RCE] nvcsi_calc_ths_settle ths_settle 82
[  158.486246] [RCE] nvcsi_calc_ths_settle ths_settle 82
[  158.486247] [RCE] nvcsi_calc_tclk_settle tclk_settle 75
[  158.486248] [RCE] VI5: PFSD enabled for channel: NO, expected_count. 0
[  158.486248] [RCE] VI5: channel_submit(11, bfe7e000)
[  158.486249] [RCE] VI5: completion_actions[8] size = 30, next offset = 314
[  158.486250] [RCE] VI5: completion_actions[0] size = 31, next offset = 345
[  158.486251] [RCE] VI5: completion_actions[2] size = 14, next offset = 359
[  158.486252] [RCE] VI5: completion_actions[1] size = 30, next offset = 389
[  158.486252] [RCE] VI5: completion_actions[4] size = 1, next offset = 390
[  158.486253] [RCE] VI5: completion_actions[3] size = 14, next offset = 404
[  158.486254] [RCE] VI5: completion_actions[5] size = 2, next offset = 406
[  158.486255] [RCE] VI5: vi5_update_streams: ch=11 stream_mask=0x10
[  158.486255] [RCE] VI5: enabling stream 4
[  158.486256] [RCE] VI5: PFSD enabled for channel: NO, expected_count. 0
[  158.486257] [RCE] VI5: channel_submit(11, bfe7e180)
[  158.486258] [RCE] VI5: completion_actions[8] size = 30, next offset = 314
[  158.486259] [RCE] VI5: completion_actions[0] size = 31, next offset = 345
[  158.486259] [RCE] VI5: completion_actions[2] size = 14, next offset = 359
[  158.486260] [RCE] VI5: completion_actions[1] size = 30, next offset = 389
[  158.486261] [RCE] VI5: completion_actions[4] size = 1, next offset = 390
[  158.486262] [RCE] VI5: completion_actions[3] size = 14, next offset = 404
[  158.486262] [RCE] VI5: completion_actions[5] size = 2, next offset = 406
[  158.486263] [RCE] VI5: vi5_update_streams: ch=11 stream_mask=0x10

Thank you.

Did you verify the sensor driver by v4l2-ctl first?

v4l2-ctl --set-fmt-video=width=1944,height=1096 --set-ctrl bypass_mode=0 --stream-mmap

Hi ShaneCCC:
Yes, I tried. But the vi request went timeout after the cmd.
Check the dmesg, it just timeout and reset the channel over and over.

Get the trace log.
Enable trace log by below command.
And issue v4l2-ctl capture command then cat /sys/kernel/debug/tracing/trace again.

echo 1 > /sys/kernel/debug/tracing/tracing_on
echo 30720 > /sys/kernel/debug/tracing/buffer_size_kb
echo 1 > /sys/kernel/debug/tracing/events/tegra_rtcpu/enable
echo 1 > /sys/kernel/debug/tracing/events/freertos/enable
echo 3 > /sys/kernel/debug/camrtc/log-level
echo 1 > /sys/kernel/debug/tracing/events/camera_common/enable
echo > /sys/kernel/debug/tracing/trace
cat /sys/kernel/debug/tracing/trace

Hi ShaneCCC:
Here is the logs
tracing.txt (40.1 KB)

Thanks

The trace log shows didn’t receive any validate data from sensor.
Maybe need to probe the signals to confirm it.

Hi ShaneCCC
May I know what part of the log shows that the VI didn’t receive data?
Thank you

2022年9月2日 09:42,ShaneCCC via NVIDIA Developer Forums notifications@nvidia.discoursemail.com寫道:

Hello [DaWuLun], did you manage to solve your issue? I am having the exact same error.