Modify raw frames of an OV5693 camera from TX2 Kernel Drivers

Hi all,

I am looking for either modifying or blocking the video stream for all cameras from kernel after a while since it was started. I managed to find the frames when I am using v4l2src in GStreamer. They pass through the function tegra_channel_capture_frame in vi4_fops.vi, but when I use nvarguscamerasrc, the frames do not pass through tegra_channel_capture_frame.

I have read that when I am using nvarguscamerasrc, it uses a userspace driver:

https://devtalk.nvidia.com/default/topic/1048187/b/t/post/5319847/

I have tried to locate the function, but I have not achieved it.

Also, I have tried to turn off the camera and release the buffers queue to block the frame streams, but it leads to Kernel Panics and Segmentation faults.

So, my goal is either alter the frames or stop the transmission from Kernel without touching camera drivers. I thought I could do it with v4l2, but I am not sure until now that it is possible. Does someone do something similar or know where I could block the video stream or alter the frames from kernel?

Any suggestion is welcome as well.

Thanks in advance
Leon

hello luis.leon,

please refer to the Camera Architecture Stack, if you working with nvarguscamerasrc then the userspace driver of [Camera Core] block is involved.
Otherwise, v4l2src uses direct kernel IOCTL calls to access V4L2 functionality.

if you just stop the transmission from Kernel without touching camera drivers, camera sensor still outputting frames and CSI buffers will overflow soon.
please share your use-case in detail.
thanks

Hi JerryChang,

Thanks for replying. I managed to solve it using an emergency_reboot from Kernel. Just to share it, when the camera starts to stream, I activate a timer. After it reaches the time limit, the board restarts.

I would like to ask where “Camera Core” is located, just for general information.

Thanks in advance,
Leon.

hello luis.leon,

I would like to ask where “Camera Core” is located, just for general information.
below pre-built library represent [Camera Core] parts.
/usr/lib/aarch64-linux-gnu/tegra/libnvscf.so

my suggestion is having implementation based-on v4l2src, to handle IOCTL calls directly.
please also note that,
VI driver had internal ring buffer mechanism to deliver camera buffer to user-space for usage.
if you just stop outputting streaming and not consuming buffers, you should also handle this to avoid overflow issue.

void tegra_channel_ring_buffer(struct tegra_channel *chan,
					struct vb2_v4l2_buffer *vb,
					struct timespec *ts, int state)
{...}