Hi,
I’m trying to manage(view and manipulate) the captured RAW Frames at the kernel level. So I found videobuf2 in the default kernel sources(4.9.x) to manage buffers for v4l2 drivers. So Is there any similar alternative available for NVIDIA sources?. If any, can you suggest me a reference for the same?. Please note that I wanted to perform this operation at the kernel level only, not at the userspace end.
Current Jetson camera framework using vb2, suppose vb2 could be the good choose.
Hi @ShaneCCC
Thanks for your reply!
I was referring to the below structures to extract the video buffer at the kernel level.
struct vb2_buffer
struct vb2_v4l2_buffer
struct tegra_channel
struct tegra_channel_buffer
But I’m not able to get the pixel data from video buffer. Instead, I got some properties like number of planes and image size .
Can you help to find it out?
Check the vi5_setup_surface() in vi5_fops.c the surface[0].base_address
Hi @ShaneCCC ,
I cannot find surface[0].base_address . Only found offset and offset_hi . I wanted to read out pixels from a specified locations from the entire buffer.
I mean the “desc_memoryinfo->surface[0].base_address = offset”
static void vi5_setup_surface(struct tegra_channel *chan,
struct tegra_channel_buffer *buf, unsigned int descr_index, unsigned int vi_port)
{
dma_addr_t offset = buf->addr + chan->buffer_offset[vi_port];
u32 height = chan->format.height;
u32 width = chan->format.width;
u32 format = chan->fmtinfo->img_fmt;
u32 bpl = chan->format.bytesperline;
u32 data_type = chan->fmtinfo->img_dt;
u32 nvcsi_stream = chan->port[vi_port];
struct capture_descriptor *desc = &chan->request[vi_port][descr_index];
struct capture_descriptor_memoryinfo *desc_memoryinfo =
&chan->tegra_vi_channel[vi_port]->capture_data->requests_memoryinfo[descr_index];
if (chan->valid_ports > NVCSI_STREAM_1){
height = chan->gang_height;
width = chan->gang_width;
offset = buf->addr + chan->buffer_offset[1 - vi_port];
}
memcpy(desc, &capture_template, sizeof(capture_template));
memset(desc_memoryinfo, 0, sizeof(*desc_memoryinfo));
desc->sequence = chan->capture_descr_sequence;
desc->ch_cfg.match.stream = (1u << nvcsi_stream); /* one-hot bit encoding */
desc->ch_cfg.match.vc = (1u << chan->virtual_channel); /* one-hot bit encoding */
desc->ch_cfg.frame.frame_x = width;
desc->ch_cfg.frame.frame_y = height;
desc->ch_cfg.match.datatype = data_type;
desc->ch_cfg.match.datatype_mask = 0x3f;
desc->ch_cfg.pixfmt_enable = 1;
desc->ch_cfg.pixfmt.format = format;
desc_memoryinfo->surface[0].base_address = offset;
desc_memoryinfo->surface[0].size = chan->format.bytesperline * height;
desc->ch_cfg.atomp.surface_stride[0] = bpl;
Hi @ShaneCCC
Thank you for the response.
I was asking about that is there any way to view each of the pixel’s value(or view the entire v4l2 buffer) at kernel side?.
I was referring to vb2_queue , vb2_plane , vb2_v4l_buffer and tegra_channel structures to locate the exact buffer from where I could find the data.
Also, I’m using Jetpack 4.4.1 (Kernel 4.9.140).
The offset of dma_addr_t should be the buffer start address for pixel data.
Hi @ShaneCCC
So you’re suggesting me to access the buffer using this starting address, right?. I tried to do that by incrementing the position by 1 and print is using printk, but giving 0 values. Am I doing anything wrong?
OK, maybe you can reference to the user space APP like v4l2-ctl to query the buffer.
Thanks
system
Closed
February 14, 2024, 4:48am
13
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.