summaryrefslogtreecommitdiffstats
path: root/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateless.c
diff options
context:
space:
mode:
authorChen-Yu Tsai <wenst@chromium.org>2022-07-06 09:21:34 +0100
committerMauro Carvalho Chehab <mchehab@kernel.org>2022-07-08 18:06:56 +0100
commitf1748f8f8174a65a885a8e6c0dc11658a6705ac2 (patch)
tree89e77b4d39896297bf225e3056bf585779a63103 /drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateless.c
parent106be65a4119b299c676fcedd247e3ca67186f59 (diff)
downloadlinux-stable-f1748f8f8174a65a885a8e6c0dc11658a6705ac2.tar.gz
linux-stable-f1748f8f8174a65a885a8e6c0dc11658a6705ac2.tar.bz2
linux-stable-f1748f8f8174a65a885a8e6c0dc11658a6705ac2.zip
media: mediatek: vcodec: decoder: Fix 4K frame size enumeration
This partially reverts commit b018be06f3c7 ("media: mediatek: vcodec: Read max resolution from dec_capability"). In this commit, the maximum resolution ended up being a function of both the firmware capability and the current set format. However, frame size enumeration for output (coded) formats should not depend on the format set, but should return supported resolutions for the format requested by userspace. Fix this so that the driver returns the supported resolutions correctly, even if the instance only has default settings, or if the output format is currently set to VP8F, which does not support 4K. This adds an copy of special casing for !VP8 and 4K support. The other existing copy will be removed when .max_{width,height} are removed from |struct mtk_vcodec_ctx| in a subsequent patch. Fixes: b018be06f3c7 ("media: mediatek: vcodec: Read max resolution from dec_capability") Signed-off-by: Chen-Yu Tsai <wenst@chromium.org> Tested-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Diffstat (limited to 'drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateless.c')
-rw-r--r--drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateless.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateless.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateless.c
index f1c0276c9026..5da9901e93a3 100644
--- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateless.c
+++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateless.c
@@ -360,6 +360,13 @@ static void mtk_vcodec_add_formats(unsigned int fourcc,
mtk_vdec_framesizes[count_framesizes].fourcc = fourcc;
mtk_vdec_framesizes[count_framesizes].stepwise = stepwise_fhd;
+ if (!(ctx->dev->dec_capability & VCODEC_CAPABILITY_4K_DISABLED) &&
+ fourcc != V4L2_PIX_FMT_VP8_FRAME) {
+ mtk_vdec_framesizes[count_framesizes].stepwise.max_width =
+ VCODEC_DEC_4K_CODED_WIDTH;
+ mtk_vdec_framesizes[count_framesizes].stepwise.max_height =
+ VCODEC_DEC_4K_CODED_HEIGHT;
+ }
num_framesizes++;
break;
case V4L2_PIX_FMT_MM21: