[PATCH 4/4] media: rkvdec: align bytesperline to 64 bytes in rkvdec_fill_decoded_pixfmt()
Venkata Atchuta Bheemeswara Sarma Darbha
vdarbha0473 at gmail.com
Sun Jul 26 13:25:37 PDT 2026
From: Igor Paunovic <royalnet026 at gmail.com>
Ensure bytesperline is 64-byte aligned and scale sizeimage accordingly.
Signed-off-by: Igor Paunovic <royalnet026 at gmail.com>
Signed-off-by: Francesco Saverio Pavone <pavone.lawyer at gmail.com>
Signed-off-by: Venkata Atchuta Bheemeswara Sarma Darbha <vdarbha0473 at gmail.com>
---
drivers/media/platform/rockchip/rkvdec/rkvdec.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/drivers/media/platform/rockchip/rkvdec/rkvdec.c b/drivers/media/platform/rockchip/rkvdec/rkvdec.c
index 436bb460f04e..6ab6530b1cc9 100644
--- a/drivers/media/platform/rockchip/rkvdec/rkvdec.c
+++ b/drivers/media/platform/rockchip/rkvdec/rkvdec.c
@@ -102,12 +102,20 @@ static void rkvdec_fill_decoded_pixfmt(struct rkvdec_ctx *ctx,
struct v4l2_pix_format_mplane *pix_mp)
{
const struct rkvdec_variant *variant = ctx->dev->variant;
+ struct v4l2_plane_pix_format *plane = &pix_mp->plane_fmt[0];
+ u32 aligned_bpl;
v4l2_fill_pixfmt_mp(pix_mp, pix_mp->pixelformat, pix_mp->width, pix_mp->height);
- ctx->colmv_offset = pix_mp->plane_fmt[0].sizeimage;
+ /* ensure bpl is 64 byte aligned and scale sizeimage accordingly. */
+ aligned_bpl = ALIGN(plane->bytesperline, 64);
+ if (aligned_bpl != plane->bytesperline) {
+ plane->sizeimage = plane->sizeimage / plane->bytesperline * aligned_bpl;
+ plane->bytesperline = aligned_bpl;
+ }
- pix_mp->plane_fmt[0].sizeimage += variant->ops->colmv_size(pix_mp->width, pix_mp->height);
+ ctx->colmv_offset = plane->sizeimage;
+ plane->sizeimage += variant->ops->colmv_size(pix_mp->width, pix_mp->height);
}
static void rkvdec_reset_fmt(struct rkvdec_ctx *ctx, struct v4l2_format *f,
--
2.43.0
More information about the Linux-rockchip
mailing list