[PATCH 1/3] staging: media: cedrus: take the output line stride from the capture format

From: Jernej Skrabec

Date: Fri Nov 27 2026 - 01:55:37 EST


cedrus_dst_format_set() programs the line stride of the untiled output
formats as the width aligned to 16, which is the bytesperline that
cedrus_prepare_format() gives these formats. Program bytesperline
itself instead, so that a decoder can use a larger stride, and so that
the stride is the one of the buffer when a decoder sets the format up
for a frame smaller than it.

Likewise, take the height as it is: cedrus_prepare_format() already
aligns it to 16 for these formats.

No functional change.

Signed-off-by: Jernej Skrabec <jernej.skrabec@xxxxxxxxx>
---
drivers/staging/media/sunxi/cedrus/cedrus_hw.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_hw.c b/drivers/staging/media/sunxi/cedrus/cedrus_hw.c
index b66d855daaf8..7e742cbb1cdd 100644
--- a/drivers/staging/media/sunxi/cedrus/cedrus_hw.c
+++ b/drivers/staging/media/sunxi/cedrus/cedrus_hw.c
@@ -84,7 +84,7 @@ void cedrus_engine_disable(struct cedrus_dev *dev)
void cedrus_dst_format_set(struct cedrus_dev *dev,
struct v4l2_pix_format *fmt)
{
- unsigned int width = fmt->width;
+ unsigned int bytesperline = fmt->bytesperline;
unsigned int height = fmt->height;
u32 chroma_size;
u32 reg;
@@ -94,7 +94,7 @@ void cedrus_dst_format_set(struct cedrus_dev *dev,
case V4L2_PIX_FMT_NV21:
case V4L2_PIX_FMT_YUV420:
case V4L2_PIX_FMT_YVU420:
- chroma_size = ALIGN(width, 16) * ALIGN(height, 16) / 2;
+ chroma_size = bytesperline * height / 2;

switch (fmt->pixelformat) {
case V4L2_PIX_FMT_NV12:
@@ -116,8 +116,8 @@ void cedrus_dst_format_set(struct cedrus_dev *dev,
reg = chroma_size / 2;
cedrus_write(dev, VE_PRIMARY_CHROMA_BUF_LEN, reg);

- reg = VE_PRIMARY_FB_LINE_STRIDE_LUMA(ALIGN(width, 16)) |
- VE_PRIMARY_FB_LINE_STRIDE_CHROMA(ALIGN(width, 16) / 2);
+ reg = VE_PRIMARY_FB_LINE_STRIDE_LUMA(bytesperline) |
+ VE_PRIMARY_FB_LINE_STRIDE_CHROMA(bytesperline / 2);
cedrus_write(dev, VE_PRIMARY_FB_LINE_STRIDE, reg);

break;
--
2.43.0