From: Philipp Zabel
Date: Wed, 18 Mar 2020 18:35:31 +0000 (+0100)
Subject: media: coda: round up decoded buffer size for all codecs
X-Git-Tag: v5.15~3350^2~563
X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=dbe939814cfa0154421ab1643f48b7cdd379d522;p=platform%2Fkernel%2Flinux-starfive.git
media: coda: round up decoded buffer size for all codecs
The BIT decoders always write 16x16 macroblocks. Align stride and height to
avoid spilling luma data into the top of the chroma planes.
Signed-off-by: Philipp Zabel
Signed-off-by: Hans Verkuil
Signed-off-by: Mauro Carvalho Chehab
---
diff --git a/drivers/media/platform/coda/coda-common.c b/drivers/media/platform/coda/coda-common.c
index d0d093d..46163e52 100644
--- a/drivers/media/platform/coda/coda-common.c
+++ b/drivers/media/platform/coda/coda-common.c
@@ -637,8 +637,8 @@ static int coda_try_fmt_vid_cap(struct file *file, void *priv,
if (ret < 0)
return ret;
- /* The h.264 decoder only returns complete 16x16 macroblocks */
- if (codec && codec->src_fourcc == V4L2_PIX_FMT_H264) {
+ /* The decoders always write complete macroblocks */
+ if (ctx->inst_type == CODA_INST_DECODER) {
f->fmt.pix.height = round_up(f->fmt.pix.height, 16);
f->fmt.pix.bytesperline = round_up(f->fmt.pix.width, 16);
f->fmt.pix.sizeimage = f->fmt.pix.bytesperline *