From patchwork Sat Jul 20 07:15:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yunfei Dong X-Patchwork-Id: 813577 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 28F6218635; Sat, 20 Jul 2024 07:56:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.61.82.184 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721462163; cv=none; b=iS3Rjs/tZ04jiFUC6LnrLjQGjyoa1R2XF8if1h+nPbcQl8hrberFODdljx3GOTDtD4o0+gIhvTXQklaVszsr4Cn9gx4ca4J6IpjRlrH2qFEhh0UvMUU4Nzt58WHtMM7MlUt4c9U3KO5GWCS4fBc7bS+mRkmb7W4LObPxovO2Zmk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721462163; c=relaxed/simple; bh=w4Yl2YOBDIW886txDjPkVsEgPYFYqh53ZKXFT3l2gZc=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=FF/RRjQ0bUpclEuhNZAksSssyzttUQSdkq7HNt98sKUnFMHHcHM7pIQXithK/V5rZRk8aCHmmHCGxoetDhym/3pIV+9zK+cVVAU7HR2zbSbMRPh499x7URFbtPCAZZ7ZhKPVHcV2oovjpe9diM3osqpIxC4VOgFO1z7xHgBaOS4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=mediatek.com; spf=pass smtp.mailfrom=mediatek.com; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b=AgQmFNkC; arc=none smtp.client-ip=210.61.82.184 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=mediatek.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mediatek.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="AgQmFNkC" X-UUID: fd594786466711ef87684b57767b52b1-20240720 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=gHn2ChwZKGRaMh+JSWT5XthtUU/2bPNuLTqL9TaTM0I=; b=AgQmFNkCIv2jkr8J0eLH1BBV+2lyhWK4E/xx+p5rQDYQneIgaraGUmcT9Rter3nryePWP8OAcWH3xm5xtsBhceOocaTbQazuw93iASjYnO/hgUs4ln4KYizravn04M02ByUFtvOF9dbJ7mywUtZdAhvJiJnLe8MEuDhYdSsI6Fo=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.40, REQID:c03dd16e-b220-4618-b48c-a3d194929280, 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:ba885a6, CLOUDID:5c4bb4d1-436f-4604-ad9d-558fa44a3bbe, B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:0,File:nil,RT: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,ARC:0 X-CID-BVR: 0,NGT X-CID-BAS: 0,NGT,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-UUID: fd594786466711ef87684b57767b52b1-20240720 Received: from mtkmbs13n2.mediatek.inc [(172.21.101.108)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1952367212; Sat, 20 Jul 2024 15:16:31 +0800 Received: from mtkmbs11n2.mediatek.inc (172.21.101.187) by mtkmbs10n1.mediatek.inc (172.21.101.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Sat, 20 Jul 2024 15:16:30 +0800 Received: from mhfsdcap04.gcn.mediatek.inc (10.17.3.154) by mtkmbs11n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Sat, 20 Jul 2024 15:16:29 +0800 From: Yunfei Dong To: Jeffrey Kardatzke , =?utf-8?q?N=C3=ADcolas_F_=2E_?= =?utf-8?q?R_=2E_A_=2E_Prado?= , Nathan Hebert , "Nicolas Dufresne" , Hans Verkuil , AngeloGioacchino Del Regno , Benjamin Gaignard , Sebastian Fricke , Tomasz Figa , "Mauro Carvalho Chehab" , Marek Szyprowski CC: Chen-Yu Tsai , Yong Wu , "Hsin-Yi Wang" , Fritz Koenig , "Daniel Vetter" , Steve Cho , Yunfei Dong , Sumit Semwal , "Brian Starkey" , John Stultz , "T . J . Mercier" , =?utf-8?q?Christian_K=C3=B6nig?= , Matthias Brugger , , , , , , Subject: [PATCH v7 15/28] media: mediatek: vcodec: support single allocation format Date: Sat, 20 Jul 2024 15:15:53 +0800 Message-ID: <20240720071606.27930-16-yunfei.dong@mediatek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240720071606.27930-1-yunfei.dong@mediatek.com> References: <20240720071606.27930-1-yunfei.dong@mediatek.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-TM-AS-Product-Ver: SMEX-14.0.0.3152-9.1.1006-23728.005 X-TM-AS-Result: No-10--7.215200-8.000000 X-TMASE-MatchedRID: 4YoTATPIqSy5p9aAyE1guQPZZctd3P4BK2i9pofGVSsKogmGusPLbxWM l8ih/tVGrDROgF4X1mtRcP1M5l8Zq//Js/ghYmSKDB+ErBr0bAPmELBDcs0dnfHFoBcOsKezcam vz988laL3cuxjGnQlwIAy6p60ZV62SwOSQ/fMiOrdB/CxWTRRu92KvEVWmYr1zVoOaGaIvLKCCq bT1+76puXfz4RBoCYr+1rcjAfo8wwjfMugmw1MOA== X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--7.215200-8.000000 X-TMASE-Version: SMEX-14.0.0.3152-9.1.1006-23728.005 X-TM-SNTS-SMTP: 9B947E8B3233381C67960D3715F5C2F7C25664AC988CCCC5B21F29D77FF5DABE2000:8 X-MTK: N Changing driver to support single allocation format V4L2_PIX_FMT_MS21. Signed-off-by: Yunfei Dong --- .../platform/mediatek/vcodec/decoder/mtk_vcodec_dec.c | 4 +++- .../mediatek/vcodec/decoder/mtk_vcodec_dec_stateless.c | 9 ++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec.c b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec.c index 98838217b97d..c89c900f7d4d 100644 --- a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec.c +++ b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec.c @@ -49,7 +49,9 @@ static bool mtk_vdec_get_cap_fmt(struct mtk_vcodec_dec_ctx *ctx, int format_inde num_frame_count++; } - if (num_frame_count == 1 || (!ctx->is_10bit_bitstream && fmt->fourcc == V4L2_PIX_FMT_MM21)) + if ((!ctx->is_10bit_bitstream && fmt->fourcc == V4L2_PIX_FMT_MM21) || + (ctx->is_secure_playback && fmt->fourcc == V4L2_PIX_FMT_MS21) || + num_frame_count == 1) return true; q_data = &ctx->q_data[MTK_Q_DATA_SRC]; 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 b903e39fee89..fbea00517565 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 @@ -229,7 +229,7 @@ static const struct mtk_stateless_control mtk_stateless_controls[] = { #define NUM_CTRLS ARRAY_SIZE(mtk_stateless_controls) -static struct mtk_video_fmt mtk_video_formats[9]; +static struct mtk_video_fmt mtk_video_formats[10]; static struct mtk_video_fmt default_out_format; static struct mtk_video_fmt default_cap_format; @@ -770,6 +770,11 @@ static void mtk_vcodec_add_formats(unsigned int fourcc, mtk_video_formats[count_formats].type = MTK_FMT_FRAME; mtk_video_formats[count_formats].num_planes = 2; break; + case V4L2_PIX_FMT_MS21: + mtk_video_formats[count_formats].fourcc = fourcc; + mtk_video_formats[count_formats].type = MTK_FMT_FRAME; + mtk_video_formats[count_formats].num_planes = 1; + break; default: mtk_v4l2_vdec_err(ctx, "Can not add unsupported format type"); return; @@ -798,6 +803,8 @@ static void mtk_vcodec_get_supported_formats(struct mtk_vcodec_dec_ctx *ctx) cap_format_count++; } if (ctx->dev->dec_capability & MTK_VDEC_FORMAT_MM21) { + mtk_vcodec_add_formats(V4L2_PIX_FMT_MS21, ctx); + cap_format_count++; mtk_vcodec_add_formats(V4L2_PIX_FMT_MM21, ctx); cap_format_count++; }