Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp160462rda; Sat, 21 Oct 2023 02:47:18 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGrD62CmPE/qErgmFke79U2CKxEWO8lfvKRtD3tDyf5D+SLXkmCf722hxN35o2JkI1mlPXS X-Received: by 2002:a05:6808:222a:b0:3b2:e9ab:68e6 with SMTP id bd42-20020a056808222a00b003b2e9ab68e6mr5653437oib.0.1697881638222; Sat, 21 Oct 2023 02:47:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697881638; cv=none; d=google.com; s=arc-20160816; b=UpKfMu0YiMa2H822xvlsI1cvmClLSy0Q03E1DZl+SuDZVThloo0knFY7KTUXeRCAWl ax5r7w9JRZLzhbOQDpexdDKTeZl2e4bQun/M4nX0VrvUL9KhI8g27s8ABtb3xK1TF6rm aiOl4lxVC+yp5wRpImI7ibWcRxn0Y3OM7gV+PEG15YU9mwOEx7JgamtC2VKcQ4d9hAfv WoBszXAw11UOTY2Hq1W6g8kVCplfeQCC6fhtZa2q+qt/LDmF3BScNafRX/bhFlorBy3J lW/vkKYcHjS18yUNnYRJ6HH214tcWu7G/cY/FXHtfPsureJd8BTYJMP+hkUvF/Hz7y3y I0nQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=FBfsiUSQkdCIlnohOzVPszUMDeDer7x3urIdLkjY4rU=; fh=hadP/Qit0fP83aE7jDic8vfKKSMzMzFbjuOmlm+1S4s=; b=sPDgZNZcyJ66AKAhELjdMsyZVfYZo4kul1AahgshY7o25FJbmwDJFTFC2s2hoNs9lu Xenk82S271BNd4sBA+2hNdIJh3MLuBECrZNYFK2k1VkpgaMMObhIyploQfKtnPx+WGLV wgLizxPaqEE82l1SV7ignZ4MRiKQa75lNSiz6+0PUFxGQEzP4V+75cNF8qV2G9gG5oRA FAr4fYcEsab0vMfTmQoUtdO2mZ1Nh8019mUSgcZl8YxjJZpn2qpm0a/6DOchbuGtQYpC e44LyIDiIoPVmp38oxyXTwlIELVfYoNjP0MZZMkrsGIYlZMzBaT18QNa5fqd2QH2wRSV NJTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=PAhJwMvC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id b185-20020a6334c2000000b00585a02550e1si3413446pga.50.2023.10.21.02.47.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 02:47:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=PAhJwMvC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 58D93822CAAA; Sat, 21 Oct 2023 02:47:17 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230200AbjJUJrN (ORCPT + 99 others); Sat, 21 Oct 2023 05:47:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229614AbjJUJrM (ORCPT ); Sat, 21 Oct 2023 05:47:12 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 75C4C19E; Sat, 21 Oct 2023 02:47:07 -0700 (PDT) Received: from localhost (89-26-75-29.dyn.cablelink.at [89.26.75.29]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: sebastianfricke) by madras.collabora.co.uk (Postfix) with ESMTPSA id 1A1116607314; Sat, 21 Oct 2023 10:47:06 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1697881626; bh=LyoLLL+0iahSppNDISM/wLW84taWhA7/2bDg/F2nugo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=PAhJwMvCVbrkmjr9krtydeV9DW1KH2ILFowN0whOdr85b4XLh7mx7JD9a8I4i1y3h EvcONPCQPCSki02bKyvS8lozJ3ipOk7L4/hXUy422Vn8r23RFI61Sn83clYm7dxZAD gmakw809pKliCTZYNNFw77Ydxsa7b//TiBROoHVyt+xDs6N0sYjXfCKVVY4vq/Jjwh OSW40rIzyKvD1keBSG3/wKnIHeyCa1KOUoNNmfYzvktbPLp7vJK7mOmZTuyr38KXgO rnhrdSKdp4iyy2JRpbjR9Pbh6zXbzwicFI1xN+oDSKaQp9cCxexNfiSZPW6fMoRz6S SuTJhiPD1SxfQ== Date: Sat, 21 Oct 2023 11:47:03 +0200 From: Sebastian Fricke To: Yunfei Dong Cc: =?utf-8?B?TsOtY29sYXMgRiAuIFIgLiBBIC4=?= Prado , Nicolas Dufresne , Hans Verkuil , AngeloGioacchino Del Regno , Benjamin Gaignard , Nathan Hebert , Chen-Yu Tsai , Hsin-Yi Wang , Fritz Koenig , Daniel Vetter , Steve Cho , linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Project_Global_Chrome_Upstream_Group@mediatek.com Subject: Re: [PATCH 2/7] media: mediatek: vcodec: Setting the supported h264 level for each platform Message-ID: <20231021094703.ght7jrrrv6n2u5ef@basti-XPS-13-9310> References: <20231016064346.31451-1-yunfei.dong@mediatek.com> <20231016064346.31451-2-yunfei.dong@mediatek.com> <20231021092345.2636a7utfdb3nbv5@basti-XPS-13-9310> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Disposition: inline In-Reply-To: <20231021092345.2636a7utfdb3nbv5@basti-XPS-13-9310> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Sat, 21 Oct 2023 02:47:17 -0700 (PDT) Hey Yunfei, please replace Setting with Set in the title. On 21.10.2023 11:23, Sebastian Fricke wrote: >Hey Yunfei, > >On 16.10.2023 14:43, Yunfei Dong wrote: >>The supported resolution and fps of different platforms are not the >>same. Need to set the supported level according to the chip name. > >I would suggest the following rewording: > >Set the maximum H264 codec level for each platform. >The various mediatek platforms support different levels for decoding, >the level of the codec limits among others the maximum resolution, bit >rate and frame rate for the decoder. > >With that you can add: >Reviewed-by: Sebastian Fricke > >Regards, >Sebastian > >> >>Signed-off-by: Yunfei Dong >>--- >>.../vcodec/decoder/mtk_vcodec_dec_stateless.c | 45 +++++++++++++++++++ >>1 file changed, 45 insertions(+) >> >>diff --git a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_stateless.c b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_stateless.c >>index e29c9c58f3da..f4af81bddc58 100644 >>--- a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_stateless.c >>+++ b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_stateless.c >>@@ -56,6 +56,15 @@ static const struct mtk_stateless_control mtk_stateless_controls[] = { >> }, >> .codec_type = V4L2_PIX_FMT_H264_SLICE, >> }, >>+ { >>+ .cfg = { >>+ .id = V4L2_CID_MPEG_VIDEO_H264_LEVEL, >>+ .min = V4L2_MPEG_VIDEO_H264_LEVEL_1_0, >>+ .def = V4L2_MPEG_VIDEO_H264_LEVEL_4_1, >>+ .max = V4L2_MPEG_VIDEO_H264_LEVEL_4_2, >>+ }, >>+ .codec_type = V4L2_PIX_FMT_H264_SLICE, >>+ }, >> { >> .cfg = { >> .id = V4L2_CID_STATELESS_H264_DECODE_MODE, >>@@ -519,6 +528,40 @@ static const struct v4l2_ctrl_ops mtk_vcodec_dec_ctrl_ops = { >> .s_ctrl = mtk_vdec_s_ctrl, >>}; >> >>+static void mtk_vcodec_dec_fill_h264_level(struct v4l2_ctrl_config *cfg, >>+ struct mtk_vcodec_dec_ctx *ctx) >>+{ >>+ switch (ctx->dev->chip_name) { >>+ case MTK_VDEC_MT8192: >>+ cfg->max = V4L2_MPEG_VIDEO_H264_LEVEL_5_1; >>+ break; >>+ case MTK_VDEC_MT8188: >>+ case MTK_VDEC_MT8195: >>+ cfg->max = V4L2_MPEG_VIDEO_H264_LEVEL_5_2; >>+ break; >>+ case MTK_VDEC_MT8183: >>+ case MTK_VDEC_MT8186: >>+ cfg->max = V4L2_MPEG_VIDEO_H264_LEVEL_4_2; >>+ break; >>+ default: >>+ cfg->max = V4L2_MPEG_VIDEO_H264_LEVEL_4_1; >>+ break; >>+ }; >>+} >>+ >>+static void mtk_vcodec_dec_reset_controls(struct v4l2_ctrl_config *cfg, >>+ struct mtk_vcodec_dec_ctx *ctx) >>+{ >>+ switch (cfg->id) { >>+ case V4L2_CID_MPEG_VIDEO_H264_LEVEL: >>+ mtk_vcodec_dec_fill_h264_level(cfg, ctx); >>+ mtk_v4l2_vdec_dbg(3, ctx, "h264 supported level: %lld %lld", cfg->max, cfg->def); >>+ break; >>+ default: >>+ break; >>+ }; >>+} >>+ >>static int mtk_vcodec_dec_ctrls_setup(struct mtk_vcodec_dec_ctx *ctx) >>{ >> unsigned int i; >>@@ -532,6 +575,8 @@ static int mtk_vcodec_dec_ctrls_setup(struct mtk_vcodec_dec_ctx *ctx) >> for (i = 0; i < NUM_CTRLS; i++) { >> struct v4l2_ctrl_config cfg = mtk_stateless_controls[i].cfg; >> cfg.ops = &mtk_vcodec_dec_ctrl_ops; >>+ >>+ mtk_vcodec_dec_reset_controls(&cfg, ctx); >> v4l2_ctrl_new_custom(&ctx->ctrl_hdl, &cfg, NULL); >> if (ctx->ctrl_hdl.error) { >> mtk_v4l2_vdec_err(ctx, "Adding control %d failed %d", i, >>-- >>2.18.0 >>