[bug]: help for line pixel mismatch in raw

Hi NV,
my board is orin + max96712 + module(max9295+imx728), raw12, rggb. and I use below 2 method to capture raw data:
v4l2-ctl -d /dev/video0 --set-fmt-video=width=3868,height=2176,pixelformat=RG12 --set-ctrl bypass_mode=0 --stream-mmap --stream-count=1 --stream-to=camera_v4l2.raw --verbose
nvargus_nvraw --c 0 --mode 0 --file camera_nvargus_nvraw.raw --format “raw”

detail in attachment.
there is pixel mismatch in camera_v4l2.raw, but disappear in nvargus_nvraw tool

so my question is:

  1. does sensor output is pixel mismatch? v4l2-ctl just capture whole it’s receive?
  2. why nvargus_nvraw output is normal? does isp works?

Thanks
camera_nvargus_nvraw.raw (16.1 MB)
camera_v4l2.raw (16.1 MB)

hello henglei.hu,

you should assign the exactly same support format to dump the raw image.
please execute v4l to examine all sensor support formats, i.e. $ v4l2-ctl -d /dev/video0 --list-formats-ext

hello JerryChang,

v4l2-ctl -d /dev/video0 --list-formats-ext
ioctl: VIDIOC_ENUM_FMT
Type: Video Capture

    [0]: 'RG12' (12-bit Bayer RGRG/GBGB)
            Size: Discrete 3868x2176
                    Interval: Discrete 0.033s (30.000 fps)

hello henglei.hu,

nvargus_nvraw it’ll capture raw and embedded some header to save it as nvraw.
may I also confirm which Jetpack release you’re working with?

hello JerryChang,
I use this source code version: Jetson_Linux_R35.3.1_aarch64.tbz2

hello JerryChang,
add public_sources.tbz2 and
Tegra_Linux_Sample-Root-Filesystem_R35.3.1_aarch64.tbz2
all these got from
Jetson Linux | NVIDIA Developer

hello henglei.hu,

may I have more details about the pixel mismatch?
as mentioned, nvargus_nvraw it’ll capture raw and embedded some header to create another raw file.

hello JerryChang,
for example, this is part of attachment “camera_nvargus_nvraw.raw”,


this is part of attachment “camera_v4l2.raw”

it’s very strange: there is offset each lines, but very 8 lines the mismatch return back;

hello henglei.hu,

could you please examine sensor format dumps with $ nvargus_nvraw --lps.
are they (v4l2 v.s. nvargus_nvraw ) reporting the same supported formats?

hello JerryChang,
please help to check:
$ nvargus_nvraw --lps
nvargus_nvraw version 1.14.0
Number of supported sensor entries 1
Entry Source Mode Uniquename Resolution FR BitDepth Mode
Index Index Index CSI Dyn Type
0 0 0 imx728_bottom 3868x2176 29 12 12 Bayer

hello JerryChang,
please help to check, wait your good news.

hello henglei.hu,

we’ve try fetch the raw file as below command-line for comparison.
however, we don’t see any difference between these raw files.
$ v4l2-ctl -d /dev/video0 --set-fmt-video=width=3840,height=2160,pixelformat=RG10 --set-ctrl bypass_mode=0 --stream-mmap --stream-count=1 --stream-to=v4l2.raw --verbose
$ ./nvargus_nvraw --c 0 --mode 0 --file nvargus_nvraw.raw --format “raw”

is there conversion you’ve done? I notice that resolutions are different.
may I also know the tools you’re used to view the raw file? for example, could you please try 3rdparty tool, such as 7yuv.

hello JerryChang,
camera_nvargus_nvraw.raw has the same resolution with camera_v4l2.raw, both 3868x2176.
and i check these two raw in 7yuv with “Bayer RGGB 16-bit, 3868x2176”.

hello henglei.hu,

we cannot reproduce this issue locally with reference camera module, IMX274.

hello JerryChang,
it seems hard to debuging…
could tell me the difference between v4l2 way and nvargus_nvraw way?
does nvargus_nvraw capture raw from isp?
if so, isp get input raw data from vi by ddr or just stream path?
i think v4l2 get raw data from vi by ddr, right?

hello henglei.hu,

they’re went through different pipelines, you may see-also Camera Architecture Stack.
there might be an issue with VI alignment, please try setting the width alignment to 64.
you may running v4l2-ctl command to adjust the stride by --preferred_stride= for testing.
for example,
$ v4l2-ctl -d /dev/video0 --set-fmt-video=width=3868,height=2176,pixelformat=RG12 --set-ctrl bypass_mode=0 --stream-mmap --set-ctrl preferred_stride=64 --stream-count=1 --stream-to=camera_v4l2.raw

hello JerryChang,
i usd the --preferred_stride=64 and capture raw seems no improvement, still with line mismatch. please help to check :
camera_v4l2_stride64.7z (7.1 MB)

hello henglei.hu,

could you please also enable below debug print for checking the settings v4l command to dump raw files.
$public_sources/kernel_src/kernel/nvidia/drivers/media/platform/tegra/camera/vi/channel.c

static void tegra_channel_update_format(...)
{
...
        dev_dbg(&chan->video->dev,
                        "%s: Resolution= %dx%d bytesperline=%d\n",
                        __func__, width, height, chan->format.bytesperline);

BTW,
for the quick testing, you may also trying to set the preferred_stride as 3904.

hello JerryChange,
when i use v4l2-ctl cmd with preferred_stride=3904, the capture raw still like before.log print like this:
(NULL device *): tegra_channel_update_format: Resolution= 3868x2176 bytesperline=3904.
then i change v4l2-ctl with preferred_stride=7744, line mismatch disappeared. thank you very much!

glad to know it works, I’m just curious why 7744.