media: coda: round up decoded buffer size for all codecs
authorPhilipp Zabel <p.zabel@pengutronix.de>
Wed, 18 Mar 2020 18:35:31 +0000 (19:35 +0100)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Tue, 14 Apr 2020 09:46:03 +0000 (11:46 +0200)
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 <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/media/platform/coda/coda-common.c

index d0d093d..46163e5 100644 (file)
@@ -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 *