From patchwork Thu May 16 12:20:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?WXVuZmVpIERvbmcgKOiRo+S6kemjnik=?= X-Patchwork-Id: 797414 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) (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 3DFDE14601E; Thu, 16 May 2024 12:21:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=60.244.123.138 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715862094; cv=none; b=Tu+Hp+SWacjVOCfue+W3wRpd1466cEn02pvKoRWutPZvyXfpgfM0zOQgJmA/dc0oSEZvxIzSSNtxyQL4UoSvzLdTpBQAw0rIVwHbd2C/4scqeR8PvLth1jSdFGjyBvB+CN0uX+oZIMTk25NBPwDThMnJMYJnUSCpbUxBiDJOJN0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715862094; c=relaxed/simple; bh=F3qFQB5+w84XVP7DaDmNjz25HS/J6xJq/YWXjNA6AdM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Q/ZLVn3hYp7tAD8OVkY7BN87SXXcKnTbMyaR1PELNBKXynU8opcXEanfktLPNKy8wiZCBIN6NdqyACJL2B55uIynjYL6Q9Qi8rdDkFQV0wlMfa2UtSZaMVE29Mp4lJN7375u5e3eM9V+sPAx/thMsq+cSz1rX+orqBbdWKWUUAE= 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=Hdk8lfh9; arc=none smtp.client-ip=60.244.123.138 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="Hdk8lfh9" X-UUID: d2f55212137e11efb92737409a0e9459-20240516 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=4yWnzVQpRkQqCkRa0JK646TpFazUXdah/zi3dIa3lbM=; b=Hdk8lfh9gIj4i9/gpeOVzm27Nh0wkIbUl3kRa+1t4ANLWgqDArVxS751Cl3YjuFSaUGjvw8tMLlmypnMpLbPoxlTXxNXmC+gZM60uH4v90zu/pzruoVapRLVS9mUilif2NoOWHFlVwE4butkPzCFR0BoztWdQeCK5zu+cb2E6e4=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.38, REQID:7913d458-55d1-4c6c-8d3e-12dee8f82f63, IP:0, U RL:0,TC:0,Content:-5,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:-5 X-CID-META: VersionHash:82c5f88, CLOUDID:d5537087-8d4f-477b-89d2-1e3bdbef96d1, 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 X-CID-BVR: 0,NGT X-CID-BAS: 0,NGT,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-UUID: d2f55212137e11efb92737409a0e9459-20240516 Received: from mtkmbs10n2.mediatek.inc [(172.21.101.183)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 440520789; Thu, 16 May 2024 20:21:29 +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; Thu, 16 May 2024 20:21:26 +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; Thu, 16 May 2024 20:21:25 +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 v6, 13/24] media: mediatek: vcodec: using shared memory as vsi address Date: Thu, 16 May 2024 20:20:51 +0800 Message-ID: <20240516122102.16379-14-yunfei.dong@mediatek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240516122102.16379-1-yunfei.dong@mediatek.com> References: <20240516122102.16379-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--4.493000-8.000000 X-TMASE-MatchedRID: 6iG0MA7tSw80Z9sXcK7F6QPZZctd3P4BK2i9pofGVSsKogmGusPLb/BY Ro06eVj3M+9E78FP+k6T5In082VlTzMbZlaZZohC58dk5sbwmyhfyi4Yas3gTZsoi2XrUn/Jn6K dMrRsL14qtq5d3cxkNffvWahKfRU4AumCAeBuR1xMqLLbzYMQRd0KPfBv8Xir/XSCcwEXK+hLpF yCy6fhOGlSkdw46JDYQjudTBwWsuSDpE2k8n29kDunTKKPbstUaaeeX2Q5bK9+HGPweyal2mGdU ezV59DHQZpgl3CshRSeqD9WtJkSIw== X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--4.493000-8.000000 X-TMASE-Version: SMEX-14.0.0.3152-9.1.1006-23728.005 X-TM-SNTS-SMTP: DCDDDEEA5E0AF68C38B08C6B898A50FD6D71DE7686C455749767DE4AC0AA57852000:8 X-MTK: N The vsi buffer is allocated by tee share memory for svp mode, need to use the share memory as the vsi address to store vsi data. Signed-off-by: Yunfei Dong --- .../vcodec/decoder/vdec/vdec_h264_req_multi_if.c | 9 +++++++-- .../media/platform/mediatek/vcodec/decoder/vdec_vpu_if.c | 8 ++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_req_multi_if.c b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_req_multi_if.c index 2d4611e7fa0b..d7fec1887ab5 100644 --- a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_req_multi_if.c +++ b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_req_multi_if.c @@ -417,8 +417,13 @@ static int vdec_h264_slice_init(struct mtk_vcodec_dec_ctx *ctx) vsi_size = round_up(sizeof(struct vdec_h264_slice_vsi), VCODEC_DEC_ALIGNED_64); inst->vsi = inst->vpu.vsi; - inst->vsi_core = - (struct vdec_h264_slice_vsi *)(((char *)inst->vpu.vsi) + vsi_size); + if (ctx->is_secure_playback) + inst->vsi_core = + mtk_vcodec_dec_get_shm_buffer_va(ctx->dev->optee_private, MTK_VDEC_CORE, + OPTEE_DATA_INDEX); + else + inst->vsi_core = + (struct vdec_h264_slice_vsi *)(((char *)inst->vpu.vsi) + vsi_size); inst->resolution_changed = true; inst->realloc_mv_buf = true; diff --git a/drivers/media/platform/mediatek/vcodec/decoder/vdec_vpu_if.c b/drivers/media/platform/mediatek/vcodec/decoder/vdec_vpu_if.c index 5336769a3fb5..5c31641e9abe 100644 --- a/drivers/media/platform/mediatek/vcodec/decoder/vdec_vpu_if.c +++ b/drivers/media/platform/mediatek/vcodec/decoder/vdec_vpu_if.c @@ -18,8 +18,12 @@ static void handle_init_ack_msg(const struct vdec_vpu_ipi_init_ack *msg) /* mapping VPU address to kernel virtual address */ /* the content in vsi is initialized to 0 in VPU */ - vpu->vsi = mtk_vcodec_fw_map_dm_addr(vpu->ctx->dev->fw_handler, - msg->vpu_inst_addr); + if (vpu->ctx->is_secure_playback) + vpu->vsi = mtk_vcodec_dec_get_shm_buffer_va(vpu->ctx->dev->optee_private, + MTK_VDEC_LAT0, OPTEE_DATA_INDEX); + else + vpu->vsi = mtk_vcodec_fw_map_dm_addr(vpu->ctx->dev->fw_handler, + msg->vpu_inst_addr); vpu->inst_addr = msg->vpu_inst_addr; mtk_vdec_debug(vpu->ctx, "- vpu_inst_addr = 0x%x", vpu->inst_addr);