We have an alignment issue when trying with the Sony imx296 monochrome RAW10 camera when capturing frames in Jetson TX2 NX. We are capturing the raw frames using v4l2-ctl.
Our camera resolution is 1456x1088, but with the captured frame, the resolution is 1536x1088. We tried with some other camera resolution such as 1440x1080, then also the resolution of the captured frame is 1536x1080, and the pixels after 1440 are filled with black.
We went into the kernel code for identifying these width alignment issues and found the following
From this, the width is aligned to the multiple of RM_SURFACE_ALIGNMENT. So I tried reducing the value of RM_SURFACE_ALIGNMENT to 64, then the width is changed to 1472 (multiple of 64) with black pixels from 1456 to 1472.
So my questions are
Can I change the RM_SURFACE_ALIGNMENT to any value? My intention is to set the camera resolution to 1440x1080 so that I can get proper resolution on the recorded frmae if I set RM_SURFACE_ALIGNMENT to 32[for example, If I set RM_SURFACE_ALIGNMENT as 32, and 1440 is a multiple of 32, I will get proper resolution in output]. But when I set RM_SURFACE_ALIGNMENT to 32, the recorded frames are not proper.
Is there any way to get the same output resolution as input for raw capturing in Jetson TX2 NX (if the resolution is 1456x1088 or 1440x1080) (As I can see the driver calling vi4_stride_align() function in all cases)
we should have follow VI’s 64 byte aligned to set the correct stride, set the width alignment to 64.
so, this resolution doesn’t follow the alignment, you may adjust the width as 1472x1088 to follow the alignment,
the surface has allocate to 1472 for VI’s alignment, since the active region is only 1456, you’ll have 16 pixels padding with zeros.
furthermore,
you may enable v4l2-ctl command-line, adding the controls preferred_stride=<> to adjust the stride settings.
Q1
you can change the RM_SURFACE_ALIGNMENT to any value, however, it’s due to hardware limitation VI requirements that must be atom (64-byte) aligned.
Q2
as VI allocated buffer should follow 64-alignment, the capture raw already include those zero paddings, the solution is using gst pipeline with nvarguscamerasrc plugin to use nvvidconv cropping frames.
hello @JerryChang,
I already tried preferred_stride=<> and as per the code, if I call referred_stride, eventually it will call tegra_channel_fmt_align() function and then it will call vi_stride_align(). So I need to hardcode RM_SURFACE_ALIGNMENT with 64.
Q1
When I went through the VI5 source code, vi_stride_align() function is missing in vi5_fops.c file. So if I use Xavier NX, can I use stride alignment as 32? (If I use stride alignment 32, then I can make sensor resolution as 1440x1080 and save the frames without any padding)
Q2
Does gst pipeline with nvarguscamerasrc plugin support RAW10 monochrome data? I suppose it will support only format: { (string)NV12, (string)P010_10LE } formats
you may have a try to create camera_overrides file, and add below contents to support monochrome sensors.
please put the file under… /var/nvidia/nvcam/settings/camera_overrides.isp
for example,