Skewed image when the TEGRA_STRIDE_ALIGNMENT is set to 1


The default value of TEGRA_STRIDE_ALIGNMENT is 1 on Xavier and 256 on TX2, as mentioned in this post

When TEGRA_STRIDE_ALIGNMENT is set to 1 there is an issue with images acquired from the V4L2 pipeline. First line of the image is missing a few pixels. Second line starts where the last few pixels of the first line should be. Because the first line is shorter, the whole image is skewed.

This can be reproduced on both Xavier and TX2 when the TEGRA_STRIDE_ALIGNMENT is set to 1.
Tested on multiple image sensors and resolutions.

Is this the intended behavior or is this an issue? Why was the TEGRA_STRIDE_ALIGNMENT value changed in Xavier? (168 KB)

Hi dominik.zebec,

Could you share the issue image? What sensors have you reproduced the issue on xavier?

I have attachted the following files to my original post:

  • displayed_skewed_image - how the image affected image is displayed
  • - two raw files of images, one with TEGRA_STRIDE_ALIGNMENT set to 1, other to 256
  • raw_difference - shows the line in hex editor where the images start to differ

Additional info:
Resulution is 4056x3040, bit depth 10.
Images obtained using v4l2-ctl. The same issue was reproduced with a custom V4L2 application.
The issue is reproducable on both TX2 and Xavier.
We are using the latest L4T (32).

Hope this helps with locating the issue.

I got similar problems in Xavier.

Have you tried with a width of multiple of 32pix? (e.g. 4032)
In L4T32.2, most of example device tree uses width of multiples of 32pix (like imx185, 274 and 390).
For me, it happened only for a sensor mode with a width not a multiples of 32pix.

It seems to me that bytesperline in channel.c should be a multiples of 64.
Setting TEGRA_STRIDE_ALIGNMENT to 64 or using another sensor mode worked for me.