summaryrefslogtreecommitdiffstats
path: root/drivers/media/platform/coda/coda-common.c
diff options
context:
space:
mode:
authorPhilipp Zabel <p.zabel@pengutronix.de>2020-03-18 19:35:31 +0100
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>2020-04-14 11:46:03 +0200
commitdbe939814cfa0154421ab1643f48b7cdd379d522 (patch)
treefb02a16ebe3bb77924b6e1d771fa44dfe9f68173 /drivers/media/platform/coda/coda-common.c
parentmedia: v4l2-common: Add BGR666 to v4l2_format_info (diff)
downloadlinux-dbe939814cfa0154421ab1643f48b7cdd379d522.tar.xz
linux-dbe939814cfa0154421ab1643f48b7cdd379d522.zip
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 <p.zabel@pengutronix.de> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Diffstat (limited to 'drivers/media/platform/coda/coda-common.c')
-rw-r--r--drivers/media/platform/coda/coda-common.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/media/platform/coda/coda-common.c b/drivers/media/platform/coda/coda-common.c
index d0d093dd8f7c..46163e524c1e 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 *