Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp246857lqo; Thu, 16 May 2024 05:24:37 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXDOTOttmZsu4JD1ksKoKYq6YuXGNGkJbKtRJBGsqktoa6N2ImPT69czm+BKLBd0eaIPC5rmk/+HU8yHN0QFcZ3eT2w6d9fbZkzRpWZdA== X-Google-Smtp-Source: AGHT+IF5y9KxchcdtNsr2/M/olblyebVwaFf1whINZgZ3ZncCxmRwnBN/kg+OJTyM7kfXacCx1sU X-Received: by 2002:a17:906:aad0:b0:a59:cfab:50d with SMTP id a640c23a62f3a-a5a2d536daemr1258441466b.2.1715862277413; Thu, 16 May 2024 05:24:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715862277; cv=pass; d=google.com; s=arc-20160816; b=cIXTx0ZAc7DDqOWMKtnwM6/N5pbitalm0Gck5R5fkTh29uNlv31yzcXw+uGXI8wApA xpXPApdkbJui8cRMTkyoexVS2JlbeYAT4cK36it40a7CmFUSAT8eBA0mFLFNqg4bSIeZ V/2Af+K2IX+W+s6t/tOaXqybyymFSEros19DP0EB5TNoC61gHirJmSqyOMdXYUFafV9+ NKTbjxgf2ntavY0gARtBu5CeR3o4lztZXUD2HdLEgRbKQEoWBbVvkucSeNwvH2Vbd+XA xINILTGfWqgCdQgjenICNz7FECIcFHmntClYH23it/EvH2vHHwuvX575OAN/FQhcHKEV nXvg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=4yWnzVQpRkQqCkRa0JK646TpFazUXdah/zi3dIa3lbM=; fh=+3keNzaSOvsaq+BXFM2IqKmKMiZV6QsxTCb//k4Cpek=; b=jGQSJyBzIpDii+IapYty7s9fGG2hLIz5l+NUgUvKe3ht2Ci83WU/4PnPOOHVqojsJJ h+27cahMwzI0Nx3RgrbBp6Gy5MwhiMqvnjt/dg60EB5+7QtY5m2vHNDiMICssxfVyAbf yAcUomXTSUad6YjxdmSDoK4oqfbcCuuK/9WxKkZzy+3IAaDxdsWdK+8OEILjYp3uGRXJ erGcp2SfcXgtRDmkrsC8EOv6UWIOO8Xgs1isztTOH4IUSzBh46+bx9mUlYG/V7qlG4aR yT74PZ5UCaD8iQGGJuOCzDY7nZjsFgQbx599lDWzBHlJkvnhtSStVWLdR2KupVGSR8Cp uJ/Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=Hdk8lfh9; arc=pass (i=1 spf=pass spfdomain=mediatek.com dkim=pass dkdomain=mediatek.com dmarc=pass fromdomain=mediatek.com); spf=pass (google.com: domain of linux-kernel+bounces-181006-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-181006-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a5a17c2c728si806399166b.970.2024.05.16.05.24.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 05:24:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-181006-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=Hdk8lfh9; arc=pass (i=1 spf=pass spfdomain=mediatek.com dkim=pass dkdomain=mediatek.com dmarc=pass fromdomain=mediatek.com); spf=pass (google.com: domain of linux-kernel+bounces-181006-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-181006-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id EF7011F227CE for ; Thu, 16 May 2024 12:24:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F33EC1509A9; Thu, 16 May 2024 12:21:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="Hdk8lfh9" 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 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=20F=20=2E=20R=20=2E=20A=20=2E=20Prado?= , 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=20K=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-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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--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); -- 2.25.1