mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 18:41:58 +09:00
media: mediatek: vcodec: Force capture queue format to MM21
[ Upstream commit68c7df5276] While the decoder can produce frames in both MM21 and MT21C formats, only MM21 is currently supported by userspace tools (like gstreamer and libyuv). In order to ensure userspace keeps working after the SCP firmware is updated to support both MM21 and MT21C formats, force the MM21 format for the capture queue. This is meant as a stopgap solution while dynamic format switching between MM21 and MT21C isn't implemented in the driver. Fixes:7501edef6b("media: mediatek: vcodec: Different codec using different capture format") Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com> Reviewed-by: Nicolas F. R. A. Prado <nfraprado@collabora.com> Tested-by: Nicolas F. R. A. Prado <nfraprado@collabora.com> Reviewed-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> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
4d5c8a8916
commit
01dc8f41fc
@@ -39,10 +39,9 @@ static bool mtk_vdec_get_cap_fmt(struct mtk_vcodec_ctx *ctx, int format_index)
|
|||||||
{
|
{
|
||||||
const struct mtk_vcodec_dec_pdata *dec_pdata = ctx->dev->vdec_pdata;
|
const struct mtk_vcodec_dec_pdata *dec_pdata = ctx->dev->vdec_pdata;
|
||||||
const struct mtk_video_fmt *fmt;
|
const struct mtk_video_fmt *fmt;
|
||||||
struct mtk_q_data *q_data;
|
|
||||||
int num_frame_count = 0, i;
|
int num_frame_count = 0, i;
|
||||||
bool ret = true;
|
|
||||||
|
|
||||||
|
fmt = &dec_pdata->vdec_formats[format_index];
|
||||||
for (i = 0; i < *dec_pdata->num_formats; i++) {
|
for (i = 0; i < *dec_pdata->num_formats; i++) {
|
||||||
if (dec_pdata->vdec_formats[i].type != MTK_FMT_FRAME)
|
if (dec_pdata->vdec_formats[i].type != MTK_FMT_FRAME)
|
||||||
continue;
|
continue;
|
||||||
@@ -50,27 +49,10 @@ static bool mtk_vdec_get_cap_fmt(struct mtk_vcodec_ctx *ctx, int format_index)
|
|||||||
num_frame_count++;
|
num_frame_count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (num_frame_count == 1)
|
if (num_frame_count == 1 || fmt->fourcc == V4L2_PIX_FMT_MM21)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
fmt = &dec_pdata->vdec_formats[format_index];
|
return false;
|
||||||
q_data = &ctx->q_data[MTK_Q_DATA_SRC];
|
|
||||||
switch (q_data->fmt->fourcc) {
|
|
||||||
case V4L2_PIX_FMT_VP8_FRAME:
|
|
||||||
if (fmt->fourcc == V4L2_PIX_FMT_MM21)
|
|
||||||
ret = true;
|
|
||||||
break;
|
|
||||||
case V4L2_PIX_FMT_H264_SLICE:
|
|
||||||
case V4L2_PIX_FMT_VP9_FRAME:
|
|
||||||
if (fmt->fourcc == V4L2_PIX_FMT_MM21)
|
|
||||||
ret = false;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
ret = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct mtk_q_data *mtk_vdec_get_q_data(struct mtk_vcodec_ctx *ctx,
|
static struct mtk_q_data *mtk_vdec_get_q_data(struct mtk_vcodec_ctx *ctx,
|
||||||
|
|||||||
Reference in New Issue
Block a user