media: mediatek: vcodec: decoder: Embed framesize inside mtk_video_fmt
authorChen-Yu Tsai <wenst@chromium.org>
Wed, 6 Jul 2022 08:21:38 +0000 (09:21 +0100)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Fri, 8 Jul 2022 17:10:29 +0000 (18:10 +0100)
commitcfce5b186537b0339d0872aa209a927e4a04be52
treeb522249fa11b6853fa74d6f9ec021a0aaa96401c
parente8d266d533b171387945f8a0bad1944a5609f63b
media: mediatek: vcodec: decoder: Embed framesize inside mtk_video_fmt

Right now the decoder maintains two separate lists for supported pixel
formats and frame sizes. Getting the supported frame sizes for the
current set format is a bit convoluted, requiring a search through
the separate frame size list. The frame sizes are used to clamp and
align requested resolutions.

Instead, the frame size structure could be embedded inside the pixel
format structure. Getting one also gets the other. And since the
the driver already keeps pointers to the current set format, getting
the frame sizes becomes straightforward.

Do just that. Move v4l2_frmsize_stepwise inside mtk_video_fmt, and get
rid of mtk_codec_framesizes.

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
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateful.c
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateless.c
drivers/media/platform/mediatek/vcodec/mtk_vcodec_drv.h