media: mediatek: vcodec: Set the supported h265 profile for each platform
authorYunfei Dong <yunfei.dong@mediatek.com>
Mon, 23 Oct 2023 03:06:38 +0000 (11:06 +0800)
committerHans Verkuil <hverkuil-cisco@xs4all.nl>
Thu, 23 Nov 2023 18:26:22 +0000 (19:26 +0100)
Set the maximum H265 codec profile for each platform.
The various mediatek platforms support different profiles for decoding,
the profile of the codec limits the capabilities for decoding.

Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com>
Reviewed-by: Sebastian Fricke <sebastian.fricke@collabora.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Sebastian Fricke <sebastian.fricke@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_stateless.c

index a93098b3a390ccf8cef55dc3f58cb2452086ac8c..816709fe0f182100515b74ae95800ca2bf16888d 100644 (file)
@@ -589,6 +589,20 @@ static void mtk_vcodec_dec_fill_h265_level(struct v4l2_ctrl_config *cfg,
        };
 }
 
+static void mtk_vcodec_dec_fill_h265_profile(struct v4l2_ctrl_config *cfg,
+                                            struct mtk_vcodec_dec_ctx *ctx)
+{
+       switch (ctx->dev->chip_name) {
+       case MTK_VDEC_MT8188:
+       case MTK_VDEC_MT8195:
+               cfg->max = V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_10;
+               break;
+       default:
+               cfg->max = V4L2_MPEG_VIDEO_HEVC_PROFILE_MAIN_STILL_PICTURE;
+               break;
+       };
+}
+
 static void mtk_vcodec_dec_reset_controls(struct v4l2_ctrl_config *cfg,
                                          struct mtk_vcodec_dec_ctx *ctx)
 {
@@ -606,6 +620,11 @@ static void mtk_vcodec_dec_reset_controls(struct v4l2_ctrl_config *cfg,
                mtk_v4l2_vdec_dbg(3, ctx, "h264 supported profile: %lld %lld", cfg->max,
                                  cfg->menu_skip_mask);
                break;
+       case V4L2_CID_MPEG_VIDEO_HEVC_PROFILE:
+               mtk_vcodec_dec_fill_h265_profile(cfg, ctx);
+               mtk_v4l2_vdec_dbg(3, ctx, "h265 supported profile: %lld %lld", cfg->max,
+                                 cfg->menu_skip_mask);
+               break;
        default:
                break;
        };