[PATCH 0/2] media: rzg2l-cru: Fix DMA stride alignment

From: Tommaso Merciai

Date: Wed Jun 24 2026 - 06:43:36 EST


Dear All,

While testing ov5645 + RZ/G3E we found out that the UYVY8_2X8/2592x1944
is broken. The issue is that the CRU DMA engine requires the line stride
to be a multiple of 128 bytes (RZG2L_CRU_STRIDE_ALIGN). v4l2_fill_pixfmt()
sets bytesperline as width * bytes_per_pixel with no alignment, so for
widths whose natural stride is not 128-byte aligned the hardware silently
rounds up, causing a mismatch that produces visible horizontal banding in
the captured image.

Tested using:

media-ctl -d /dev/media0 --set-v4l2 '"ov5645 0-003c":0[fmt:UYVY8_2X8/2592x1944 field:none]'
media-ctl -d /dev/media0 --set-v4l2 '"csi-16000400.csi2":0[fmt:UYVY8_2X8/2592x1944]'
media-ctl -d /dev/media0 --set-v4l2 '"cru-ip-16000000.video":0[fmt:UYVY8_2X8/2592x1944]'

v4l2-ctl -d /dev/video0 --verbose --set-fmt-video=width=2592,height=1944,pixelformat=UYVY --stream-mmap --stream-count=100 --stream-to=./frame.raw
gst-launch-1.0 v4l2src device=/dev/video0 blocksize=76800 io-mode=dmabuf num-buffers=200 ! video/x-raw,format=UYVY,width=2592,height=1944 ! videoconvert ! queue ! waylandsink sync=false

This patch fix the issue.

Kind Regards,
Tommaso

Tommaso Merciai (2):
media: v4l2-common: add v4l2_fill_pixfmt_aligned() helper
media: rzg2l-cru: Align bytesperline to hardware DMA stride
requirement

.../platform/renesas/rzg2l-cru/rzg2l-video.c | 3 ++-
drivers/media/v4l2-core/v4l2-common.c | 17 +++++++++++++----
include/media/v4l2-common.h | 3 +++
3 files changed, 18 insertions(+), 5 deletions(-)

--
2.54.0