Which functions should get run when changing the sensor_mode for Tegra's V4L2?

Using L4T 32.6.1 on Jetson Xavier AGX.

I am trying to switch between sensor modes for my application but whenever I try to change the sensor mode to ‘1’ (4234x512), it seems to stay at ‘0’ (8330x512).

I can test this by sending sensor frame size that satisfies mode 0 (8330x512) and being able to capture the frames via V4L2 successfully.
When I try to switch to mode 1 (4234x512), either by using command

v4l2-ctl -d /dev/video0 --set-ctrl=sensor_mode=1

or by setting them in userspace code with VIDIOC_S_EXT_CTRLS and send mode1 frames (4234x512), V4L2 throws errors

[ 2924.537003] tegra194-vi5 15c10000.vi: capture status: 14
[ 2924.537126] tegra194-vi5 15c10000.vi: corr_err: discarding frame 0, flags: 0, err_data 512, src_stream 0, virtual_channel 0, frame_id 0, status 14, sof_ts 2938539680448, eof_ts 94033270927360
[ 2924.558996] tegra194-vi5 15c10000.vi: capture status: 14
[ 2924.559115] tegra194-vi5 15c10000.vi: corr_err: discarding frame 0, flags: 0, err_data 512, src_stream 0, virtual_channel 0, frame_id 0, status 14, sof_ts 2938561686368, eof_ts 94033974912000
[ 2924.580959] tegra194-vi5 15c10000.vi: capture status: 14
[ 2924.581076] tegra194-vi5 15c10000.vi: corr_err: discarding frame 0, flags: 0, err_data 512, src_stream 0, virtual_channel 0, frame_id 0, status 14, sof_ts 2938583692256, eof_ts 94034679101440
[ 2924.602954] tegra194-vi5 15c10000.vi: capture status: 14
[ 2924.603095] tegra194-vi5 15c10000.vi: corr_err: discarding frame 0, flags: 0, err_data 512, src_stream 0, virtual_channel 0, frame_id 0, status 14, sof_ts 2938605698144, eof_ts 94035383289856
[ 2924.624952] tegra194-vi5 15c10000.vi: capture status: 14
[ 2924.625073] tegra194-vi5 15c10000.vi: corr_err: discarding frame 0, flags: 0, err_data 512, src_stream 0, virtual_channel 0, frame_id 0, status 14, sof_ts 2938627704064, eof_ts 94036087479296

If I manually switch the modes (mode0 <-> mode1) in the sensor driver mode table and the sensor’s device tree code (tegra194-camera-x199-p0-a00.dtsi) and I send the frames (4234x512), I can successfully capture frames via V4L2. Trying to switch to mode1 (8330x512) throws these errors in dmesg:

[85377.793588] tegra194-vi5 15c10000.vi: corr_err: discarding frame 0, flags: 0, err_data 256, src_stream 0, virtual_channel 0, frame_id 0, status 14, sof_ts 85385938424448, eof_ts 2732350030532608
[85377.829446] tegra194-vi5 15c10000.vi: capture status: 14
[85377.829571] tegra194-vi5 15c10000.vi: corr_err: discarding frame 0, flags: 0, err_data 256, src_stream 0, virtual_channel 0, frame_id 0, status 14, sof_ts 85385974357088, eof_ts 2732351180579840
[85377.865381] tegra194-vi5 15c10000.vi: capture status: 14
[85377.865507] tegra194-vi5 15c10000.vi: corr_err: discarding frame 0, flags: 0, err_data 256, src_stream 0, virtual_channel 0, frame_id 0, status 14, sof_ts 85386010290592, eof_ts 2732352330450944
[85377.901307] tegra194-vi5 15c10000.vi: capture status: 14
[85377.901451] tegra194-vi5 15c10000.vi: corr_err: discarding frame 0, flags: 0, err_data 256, src_stream 0, virtual_channel 0, frame_id 0, status 14, sof_ts 85386046223488, eof_ts 2732353480306688
[85377.937244] tegra194-vi5 15c10000.vi: capture status: 14
[85377.937368] tegra194-vi5 15c10000.vi: corr_err: discarding frame 0, flags: 0, err_data 256, src_stream 0, virtual_channel 0, frame_id 0, status 14, sof_ts 85386082156416, eof_ts 2732354629953536
[85377.973145] tegra194-vi5 15c10000.vi: capture status: 14
[85377.973290] tegra194-vi5 15c10000.vi: corr_err: discarding frame 0, flags: 0, err_data 256, src_stream 0, virtual_channel 0, frame_id 0, status 14, sof_ts 85386118089504, eof_ts 2732355779813376

Are there any known bugs with changing sensor_modes?
Which functions under /kernel/nvidia/drivers/media/platform/tegra/camera need to be executed for a successful sensor_mode change?

Attached is the .dtsi and driver files.
Our application uses other methods to configure/initialize the sensor so we do not rely on the camera connector’s I2C FYI.

tegra194-camera-x199-p0-a00.dtsi (19.5 KB)
x199.c (8.7 KB)
x199_mode_tbls.h (1.5 KB)

User error: Did not set VIDIOC_S_FMT appropriately.

Glad to know you found the solution. Thanks

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.