]> git.baikalelectronics.ru Git - kernel.git/commit
media: mediatek: vcodec: decoder: Fix resolution clamping in TRY_FMT
authorChen-Yu Tsai <wenst@chromium.org>
Wed, 6 Jul 2022 08:21:36 +0000 (09:21 +0100)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Fri, 8 Jul 2022 17:08:40 +0000 (18:08 +0100)
commitb2ba46b33efb71c565a725b18c2cfdd54d86dec5
treee36cda30bf06b5b082392daa329fd2e7e2d860ea
parentc47b570bfb1d19bd8c4eebd033804878b05daf5b
media: mediatek: vcodec: decoder: Fix resolution clamping in TRY_FMT

In commit 04a7305443d1 ("media: mediatek: vcodec: Read max resolution
from dec_capability"), TRY_FMT clamps the resolution to the maximum
that was previously set either by default 1080p or the limit set by a
previous S_FMT call. This does not make sense when doing TRY_FMT for
the output side, which may have different capabilities.

Instead, for the output side, find the maximum resolution based on the
pixel format requested. For the capture side, find the maximum
resolution based on the currently set output format.

The maximum resolution is found from the list of per-format frame
sizes, so the patch "media: mediatek: vcodec: dec: Fix 4K frame size
enumeration" is needed.

Fixes: 04a7305443d1 ("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>
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c