NV16 format support when the CSI camera captures

hello yt.jeon,

please share another YUV dump with proper width/height settings, and, please dump several frames for reference.
for example, $ v4l2-ctl --device /dev/video0 --set-fmt-video=width=1920,height=2306,pixelformat=NV16 --set-ctrl bypass_mode=0 --stream-mmap --stream-to=frame.yuv --stream-count=5

Dear Jerry,

This dump is made by below cmd.
frame.yuv (42.2 MB)

$ v4l2-ctl --device /dev/video0 --set-fmt-video=width=1920,height=2306,pixelformat=NV16 --set-ctrl bypass_mode=0 --stream-mmap --stream-to=frame.yuv --stream-count=5

Thanks,

hello yt.jeon,

it looks the image saves as YUV422 planar, YV16.

Dear Jerry,

Please explain why the dump is YV16.
There are data in range 0x0~0x438eff (1920x2306 bytes, Y area).
And UV area is filled with ‘0’ (0x438f00~0x871dff).

hello yt.jeon,

there might be some bug for surface alignment, we don’t have sensor for digging into this.
could you please examine pixel memory format,
for example, it should be TEGRA_IMAGE_FORMAT_T_Y8__V8U8_N422 = 44; in driver layer for NV16.

hello yt.jeon,

since NV16 has two planes (Y and UV) in a single buffer, hence we need to configure the additional surface accordingly.
please also try adding below to VI driver,

diff --git a/drivers/media/platform/tegra/camera/vi/vi5_fops.c b/drivers/media/platform/tegra/camera/vi/vi5_fops.c
index b54833d3f..0996f77b2 100644
--- a/drivers/media/platform/tegra/camera/vi/vi5_fops.c
+++ b/drivers/media/platform/tegra/camera/vi/vi5_fops.c
@@ -355,6 +355,9 @@ static int tegra_channel_capture_setup(struct tegra_channel *chan, unsigned int
                setup.csi_port = csi_chan->ports[vi_port].csi_port;
        }
 
+       if (chan->fmtinfo->fourcc == V4L2_PIX_FMT_NV16)
+               setup.channel_flags |= CAPTURE_CHANNEL_FLAG_SEMI_PLANAR;
+
        err = vi_capture_setup(chan->tegra_vi_channel[vi_port], &setup);
        if (err) {
                dev_err(chan->vi->dev, "vi capture setup failed\n");
@@ -404,6 +407,11 @@ static void vi5_setup_surface(struct tegra_channel *chan,
        desc_memoryinfo->surface[0].base_address = offset;
        desc_memoryinfo->surface[0].size = chan->format.bytesperline * height;
        desc->ch_cfg.atomp.surface_stride[0] = bpl;
+       if (chan->fmtinfo->fourcc == V4L2_PIX_FMT_NV16) {
+               desc_memoryinfo->surface[1].base_address = offset + chan->format.sizeimage / 2;
+               desc_memoryinfo->surface[1].size = chan->format.bytesperline * height;
+               desc->ch_cfg.atomp.surface_stride[1] = bpl;
+       }

Dear Jerry,

Issue is gone with the change.
Very thanks for your support.

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