Hi, I’m using the Jetson AGX Orin based computer and IMX.390 based GMSL Camera. When capturing camera frames with gstreamer, “vi-output” process caused high CPU load (50~70%).
Environment:
- Jetson: AGX Orin
- L4T version: R35.3.1
- Image sensor: imx.390
- gstreamer command:
gst-launch-1.0 v4l2src device="/dev/video0" ! "video/x-raw, format=(string)UYVY, width=(int)1920, height=(int)1080" ! nvvidconv ! "video/x-raw(memory:NVMM), width=480, height=270, format=(string)I420" ! nvvidconv ! xvimagesink sync=false
I tried a function trace of “vi-output” and guessed “tegra_channel_kthread_capture_enqueue” thread was in a busy loop.
vi-output, imx3-10393 [005] ...1 25802.981586: kthread_should_stop <-tegra_channel_kthread_capture_enqueue
vi-output, imx3-10393 [005] ...1 25802.981587: kthread_should_stop <-tegra_channel_kthread_capture_enqueue
vi-output, imx3-10393 [005] ...1 25802.981587: kthread_should_stop <-tegra_channel_kthread_capture_enqueue
vi-output, imx3-10393 [005] ...1 25802.981587: _raw_spin_lock_irqsave <-tegra_channel_kthread_capture_enqueue
vi-output, imx3-10393 [005] d..2 25802.981587: _raw_spin_unlock_irqrestore <-tegra_channel_kthread_capture_enqueue
vi-output, imx3-10393 [005] ...1 25802.981587: kthread_should_stop <-tegra_channel_kthread_capture_enqueue
vi-output, imx3-10393 [005] ...1 25802.981587: kthread_should_stop <-tegra_channel_kthread_capture_enqueue
vi-output, imx3-10393 [005] ...1 25802.981588: kthread_should_stop <-tegra_channel_kthread_capture_enqueue
vi-output, imx3-10393 [005] ...1 25802.981588: _raw_spin_lock_irqsave <-tegra_channel_kthread_capture_enqueue
vi-output, imx3-10393 [005] d..2 25802.981588: _raw_spin_unlock_irqrestore <-tegra_channel_kthread_capture_enqueue
vi-output, imx3-10393 [005] ...1 25802.981588: kthread_should_stop <-tegra_channel_kthread_capture_enqueue
vi-output, imx3-10393 [005] ...1 25802.981588: kthread_should_stop <-tegra_channel_kthread_capture_enqueue
vi-output, imx3-10393 [005] ...1 25802.981589: kthread_should_stop <-tegra_channel_kthread_capture_enqueue
I checked dmesg and found this warning.
corr_err: discarding frame 0, flags: 0, err_data
I thought this error might be the cause. So I applied this patch and the “vi-output” process became low CPU load.
modified kernel/nvidia/drivers/media/platform/tegra/camera/vi/vi5_fops.c
@@ -691,6 +691,7 @@ static int tegra_channel_kthread_capture_enqueue(void *data)
< (chan->capture_queue_depth * chan->valid_ports))) {
spin_unlock_irqrestore(
&chan->capture_state_lock, flags);
+ dequeue_buffer(chan, false);
break;
}
spin_unlock_irqrestore(&chan->capture_state_lock,
Is this patch correct? Or if there is another best solution, I would like to know.