Adv7282am dubole image

hello tek.xing,

you’re able to check the image details for byte-per-line,
or, you may add debug message in below sources to check chan->format.bytesperline
$l4t-sources/public_sources/kernel/nvidia/drivers/media/platform/tegra/camera/vi/channel.c

[ 4.749559] tek.xing tegra_channel_update_format, bytesperline = 3840, preferred_stride = 0, bytesperline = 3840
[ 4.749894] tek.xing tegra_channel_update_format, bytesperline = 1440, preferred_stride = 0, bytesperline = 1440
[ 4.749897] tek.xing tegra_channel_update_format, bytesperline = 1440, preferred_stride = 0, bytesperline = 1440
[ 4.749924] tek.xing tegra_channel_update_format, bytesperline = 1440, preferred_stride = 0, bytesperline = 1440

Tx2 capture size is 720x576.
is it ok?

by the way, i want to know that the D-PHY could cause this issue?

hello tek.xing,

please have a try to apply this kernel change to add function for setting bytes-per-line.
thanks

diff --git a/drivers/media/platform/tegra/camera/vi/channel.c b/drivers/media/platform/tegra/camera/vi/channel.c
index 9f9a5dc..940b6ba 100644
--- a/drivers/media/platform/tegra/camera/vi/channel.c
+++ b/drivers/media/platform/tegra/camera/vi/channel.c
@@ -148,6 +148,25 @@ static u32 get_aligned_buffer_size(struct tegra_channel *chan,
        return size;
 }

+static void tegra_channel_set_bytesperline(struct tegra_channel *chan,
+                               const struct tegra_video_format *vfmt,
+                               struct v4l2_pix_format *pix)
+{
+       unsigned int bpl;
+       unsigned int numerator, denominator;
+       unsigned int align, fmt_align;
+       const struct tegra_frac *bpp = &vfmt->bpp;
+
+       denominator = (!bpp->denominator) ? 1 : bpp->denominator;
+       numerator = (!bpp->numerator) ? 1 : bpp->numerator;
+       fmt_align = (denominator == 1) ? numerator : 1;
+       align = lcm(chan->width_align, fmt_align);
+
+       bpl = (pix->width * numerator) / denominator;
+       pix->bytesperline = tegra_core_bytes_per_line(
+               pix->width, align, vfmt);
+}
+
 static void tegra_channel_fmt_align(struct tegra_channel *chan,
                                const struct tegra_video_format *vfmt,
                                u32 *width, u32 *height, u32 *bytesperline)
@@ -1836,6 +1855,7 @@ __tegra_channel_try_format(struct tegra_channel *chan,

        v4l2_fill_pix_format(pix, &fmt.format);

+       tegra_channel_set_bytesperline(chan, vfmt, pix);
        tegra_channel_fmt_align(chan, vfmt,
                                &pix->width, &pix->height, &pix->bytesperline);

No change,Same as before.

adv7282am output format and size is yuv422 8bit 720x576.

I use below command to capture video stream:
gst-launch-1.0 v4l2src device=/dev/video0 ! ‘video/x-raw, format=(string)UYVY, width=(int)720, height=(int)576, framerate=(fraction)30/1’ ! xvimagesink -ev

[ 36.825421] tek.xing tegra_channel_set_bytesperline, bytesperline = 1440
[ 36.825436] tek.xing tegra_channel_update_format, bytesperline = 1440, preferred_stride = 1440, bytesperline = 1440

hello tek.xing,

could you please dump the yuv capture with v4l2 standard controls, and please attach it for us checking.
for example,
$ v4l2-ctl -d /dev/video0 --set-fmt-video=width=720,height=576,pixelformat=UYVY --set-ctrl bypass_mode=0 --stream-mmap --stream-count=5 --stream-to=test.raw

test.raw.log (2.4 MB)

i use your command captured and use pYUV decode it as below:

test.raw file can’t be upload, you can download it and rename it to test.raw.

please have a try to apply this patch to add interlace support.
vi4-add-interlace-support.patch.txt (11.3 KB)

adv7282am is progressive video output, because i enable I2P function,
adv7282am converts the interlaced video input into a progressive video(576P) output.

And, when i applyed this patch, the issue is still exist.

hello tek.xing,

could you please hack bytes-per-line values in the kernel driver to check we’re in the right direction…
thanks

i don’t understand your mean cleayly. adv7282am 's byter-per-line is 1440, and i print it in kernel is also 1440.

[ 5082.558561] tek.xing tegra_channel_set_bytesperline, bytesperline = 1440
[ 5082.558591] tek.xing tegra_channel_update_format, bytesperline = 1440, preferred_stride = 1440, bytesperline = 1440

so far,i don’t know the root cause of this iusse.

hello tek.xing,

may I know what’s your result by converting to NV12 formats.
i.e. $ gst-launch-1.0 v4l2src ! 'video/x-raw,width=720, height=576,format=(string)UYVY' ! nvvidconv ! 'video/x-raw(memory:NVMM),format=(string)NV12' ! nvoverlaysink

hello tek.xing,

there’s VI requirements that must be atom (64-Byte) aligned; bytesperline=1440 did not following this.
could you please adjust the output format as 736x576 for testing? the idea is let the bytesperline changes to 1472.
thanks

The manufacturer hasn’t replied to me so far,but,i think, It is not feasible.

adv7282am can output below size:

Except for 720x576, none of the others can be captured by TX2.

please have a quick testing with hard code the bytesperline values in kernel driver as 1472.

The manufacturer replyed:ADV7282am does not (process up scaling and down scaling) have the capability to convert from one video resolution to other.

due to VI requirements that must be atom (64-Byte) aligned;
could you please hack such value in kernel driver for verification.
thanks

Hi tek,xing,

There is no update from you for a period, assuming this is not an issue any more.
Hence we are closing this topic. If need further support, please open a new one. Thanks