Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp978158rda; Sun, 22 Oct 2023 20:07:53 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF9GZq0uI9UiL49SJaO0bEyPYdebvsXB4j6VxIVm5SWNjmKVlzwy3ZC8Mmqc0htFZZtPmCU X-Received: by 2002:a05:6870:2885:b0:1e9:f6c3:8594 with SMTP id gy5-20020a056870288500b001e9f6c38594mr10916855oab.2.1698030472764; Sun, 22 Oct 2023 20:07:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698030472; cv=none; d=google.com; s=arc-20160816; b=lQyXF+koERFQ5b3se7G7xxQ/Mg1HN01uBDE/H1VKu52QfS2Wd1GmJVST84GzY+wQ5H WPgvlKMYfAzplzElT1D3urF+7rHou3kPvB4reglgnqqA6sAuhyku9+CFMMrNY3KKsdXy LjprvfPMNFxzqpvs75tWHbV0zcg2zoJHk2K5thzRVwgjOqwm/IvVEXR6V9MA1xmNqPRr slI5nva3b44uaxMtQafIQqzH+3UsjqCxF9hW6I4zFOqyzhE4MRAYOgXkIk9Tw6EF4I0m dfQhsjULUBgAz33mqejAa2QDxPBf2CNY5ocz8V5otMHsEU1hqCWR3o2ukGqD2QQbpGpU nLog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=iIWgFfwZkXtrdo0suZm6RwbWtR40DfaE3rAe5GWMwLk=; fh=7Q1zA1easzsurnDULhsHBjNBSNp3vIf28hkFgmjcwo0=; b=uyK7tTtfUOQtrPUztnmJlXnRnNW7ctvIicIrkWdv5AdERJ5qviMGOV2C/jRk+MI44f Kq1NMM8QvSwhzhPxTrsEGEUSXyNjZL30gj55HzdFG6JH/dgKIarWG3WBeySEGQR1QWuZ +oFC/QTda9E9Cl9PL9ifDHHLUNIdd/we/jmf5T0d9/3t79t7mh89gzioHfCN7kSyhOkz 2iOD/lQhgk+lhklNeorDYNX0mly/nuQRNpHANsxnQEG7aePaHaKUsGqY4j84FVfpH7MO l9rVON2nZ5SZBsOr60V6g2bu2HsMrO1bhc2/5S2hIuWvzP9Ube+eFrAnY9WP6A50Ma/H xNRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=bp12lJpk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id s17-20020a656911000000b005ac0759396asi5651470pgq.634.2023.10.22.20.07.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Oct 2023 20:07:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=bp12lJpk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id C546C8087B4F; Sun, 22 Oct 2023 20:07:43 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233263AbjJWDHR (ORCPT + 99 others); Sun, 22 Oct 2023 23:07:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233129AbjJWDG7 (ORCPT ); Sun, 22 Oct 2023 23:06:59 -0400 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AFB1DD46; Sun, 22 Oct 2023 20:06:52 -0700 (PDT) X-UUID: 3427010a715111ee8051498923ad61e6-20231023 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=iIWgFfwZkXtrdo0suZm6RwbWtR40DfaE3rAe5GWMwLk=; b=bp12lJpk1dMEo/7WYiJaB11rJ84tkf28Fg+Y0MTHZHchKkumxOVzHofHKgPxI++j5KqBVU8hNCDU8AvaN7YrNVTxl6slSTs0tHWWb4dAIi81+zhLXFqnFaYCtZKKIfqzPQnrGs1pp8HjOrtn8qZ40QippIGwTYKhVshFfCCTYlE=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.32,REQID:ec525d98-07fb-4531-bd81-83e112bab9d9,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:5f78ec9,CLOUDID:5950a4fb-4a48-46e2-b946-12f04f20af8c,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0,LES:1,SPR:NO, DKR:0,DKP:0,BRR:0,BRE:0 X-CID-BVR: 0,NGT X-CID-BAS: 0,NGT,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-UUID: 3427010a715111ee8051498923ad61e6-20231023 Received: from mtkmbs10n2.mediatek.inc [(172.21.101.183)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 217837279; Mon, 23 Oct 2023 11:06:47 +0800 Received: from mtkmbs13n1.mediatek.inc (172.21.101.193) by MTKMBS14N1.mediatek.inc (172.21.101.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Mon, 23 Oct 2023 11:06:45 +0800 Received: from mhfsdcap04.gcn.mediatek.inc (10.17.3.154) by mtkmbs13n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Mon, 23 Oct 2023 11:06:44 +0800 From: Yunfei Dong To: Sebastian Fricke , =?UTF-8?q?N=C3=ADcolas=20F=20=2E=20R=20=2E=20A=20=2E=20Prado?= , Nicolas Dufresne , Hans Verkuil , AngeloGioacchino Del Regno , Benjamin Gaignard , Nathan Hebert CC: Chen-Yu Tsai , Hsin-Yi Wang , Fritz Koenig , Daniel Vetter , "Steve Cho" , Yunfei Dong , , , , , , Subject: [PATCH v2,3/7] media: mediatek: vcodec: Set the supported h265 level for each platform Date: Mon, 23 Oct 2023 11:06:36 +0800 Message-ID: <20231023030640.16393-4-yunfei.dong@mediatek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231023030640.16393-1-yunfei.dong@mediatek.com> References: <20231023030640.16393-1-yunfei.dong@mediatek.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-TM-AS-Product-Ver: SMEX-14.0.0.3152-9.1.1006-23728.005 X-TM-AS-Result: No-10--3.086800-8.000000 X-TMASE-MatchedRID: AGyNPhznEz/nWmH8Qoh70pyBsp6+TmyGjiWciALpTNMx3z93vsEFGtvM SB0gigG5ThbvLLI8RvNELJsmoli+adAjTMr/wDJy7spMO3HwKCDaoFJAcCHymC8zQZ2rR/Op8bf 335SL+11yLoBTJinK3+uLFZZYlisfHxPMjOKY7A8LbigRnpKlKZvjAepGmdoO4aFwAALy/uKyKQ DJPZx2Hu+zvpLmmWkv/rGGU8AhgWiSEv7qwpBbmFM7o8d4416lSwv4nSP4/VL1yE6GKuGBsClAL GFiDaFp8jae4OD13tAV7Mc+rowcVKtX/F0pBwVJjSV5hDFby7ZnIxZyJs78kg== X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--3.086800-8.000000 X-TMASE-Version: SMEX-14.0.0.3152-9.1.1006-23728.005 X-TM-SNTS-SMTP: C9D0983908FB3F416092D1C7DDD89FE71C8C5EE95D5EDE13A6ACA2322155D1882000:8 X-MTK: N X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email 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 (fry.vger.email [0.0.0.0]); Sun, 22 Oct 2023 20:07:44 -0700 (PDT) Set the maximum H265 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. Signed-off-by: Yunfei Dong Reviewed-by: Sebastian Fricke --- .../vcodec/decoder/mtk_vcodec_dec_stateless.c | 30 +++++++++++++++++++ 1 file changed, 30 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 7aaf0db13a76..f68518ba57c5 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 @@ -147,6 +147,16 @@ static const struct mtk_stateless_control mtk_stateless_controls[] = { }, .codec_type = V4L2_PIX_FMT_HEVC_SLICE, }, + { + .cfg = { + .id = V4L2_CID_MPEG_VIDEO_HEVC_LEVEL, + .min = V4L2_MPEG_VIDEO_HEVC_LEVEL_1, + .def = V4L2_MPEG_VIDEO_HEVC_LEVEL_4, + .max = V4L2_MPEG_VIDEO_HEVC_LEVEL_4_1, + }, + .codec_type = V4L2_PIX_FMT_HEVC_SLICE, + }, + { .cfg = { .id = V4L2_CID_STATELESS_HEVC_DECODE_MODE, @@ -549,6 +559,22 @@ static void mtk_vcodec_dec_fill_h264_level(struct v4l2_ctrl_config *cfg, }; } +static void mtk_vcodec_dec_fill_h265_level(struct v4l2_ctrl_config *cfg, + struct mtk_vcodec_dec_ctx *ctx) +{ + switch (ctx->dev->chip_name) { + case MTK_VDEC_MT8188: + cfg->max = V4L2_MPEG_VIDEO_HEVC_LEVEL_5_1; + break; + case MTK_VDEC_MT8195: + cfg->max = V4L2_MPEG_VIDEO_HEVC_LEVEL_5_2; + break; + default: + cfg->max = V4L2_MPEG_VIDEO_HEVC_LEVEL_4; + break; + }; +} + static void mtk_vcodec_dec_reset_controls(struct v4l2_ctrl_config *cfg, struct mtk_vcodec_dec_ctx *ctx) { @@ -557,6 +583,10 @@ static void mtk_vcodec_dec_reset_controls(struct v4l2_ctrl_config *cfg, mtk_vcodec_dec_fill_h264_level(cfg, ctx); mtk_v4l2_vdec_dbg(3, ctx, "h264 supported level: %lld %lld", cfg->max, cfg->def); break; + case V4L2_CID_MPEG_VIDEO_HEVC_LEVEL: + mtk_vcodec_dec_fill_h265_level(cfg, ctx); + mtk_v4l2_vdec_dbg(3, ctx, "h265 supported level: %lld %lld", cfg->max, cfg->def); + break; default: break; }; -- 2.18.0