Received: by 2002:ab2:7041:0:b0:1f4:bcc8:f211 with SMTP id x1csp21330lql; Fri, 12 Apr 2024 02:15:30 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWzeE0+eApyyB4/xlmFBDh9Qu8NU6lBZgZLeiTbDofOYJ8ZQVG6PMmsZRZjvlMZM4gTdcS231CYJ4qyCY0LlN+nRMYQLudOSNutsbOoNg== X-Google-Smtp-Source: AGHT+IHjJgWhU473jLsKa1B9pUL6HaUxLng7zxMpS/8ZnP9GCcqm27q/oosbleIekimmFkLMeL5N X-Received: by 2002:a05:6a20:a11d:b0:1a7:aa2c:6126 with SMTP id q29-20020a056a20a11d00b001a7aa2c6126mr2689652pzk.46.1712913330319; Fri, 12 Apr 2024 02:15:30 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712913330; cv=pass; d=google.com; s=arc-20160816; b=NHN53Fp6vK7cX+XASPIkoxCnBcoMlytGZEh2r14clADa9HeVS0ROgul8UuCqkKFrJt z+TC9lmpMKVcXV5GNKz53ltAubvIoCLGavd62V/WqanC9roNq2ir/8epnXe9400cUMDE 1k7DFU3V55ynFe5Y4R3yg9pjLv/FFvHVW0XHw79EPrQAfasGpIvKabH+kT1aLXEbmJak LP4+9jvWaXq/vKaG/riyUsAjvC6JjHPghMZ8rR3GXrf0ZRPkRmSGjZBcAcrfyjB5Q+Bb rlxer5ERdaIeNc902F0Ct84Nn4YwRODZK7e+Ji5YnuRco0MVIfEVtzpLkvb7gnTiGBVa DEsg== 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=B+ef2Q9ahOvlZFjf4kINWNbY/u+5TXF52PZFS/LVSOw=; fh=+3keNzaSOvsaq+BXFM2IqKmKMiZV6QsxTCb//k4Cpek=; b=nTRIYI3IVOULnwHoTFN7MkQa0G+HlQoBt6BOs1lzj7TjNN92xgpDSJkltj6ZWxT7JL v3JbEA+7AqIvb7hG/A4YVot4bCa/R6Zlh/t4F2REcJDnhJsy9oqGpvFLz5C+meMdZMTg KurI2zLn9GQ1W3+dtALVFy6QW0SqWYjSSvdBPQS4bIpCCrmywutV/MeQ4o3Q245WHP62 DeUoZbTP6w5iAabIdVaQtwKnBcj4UBPeV4l9AFwH0CpNjIxkknroj3jiHw+i75LETOXr B8JXCAcUlrLLC1/bkyWaWrMFDA9BTnu2ETXoU/8641WzQ7VshsCWkLnzS1r53ZCcjoof ToiA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=I3d2Gv4I; 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-142354-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-142354-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id fv10-20020a056a00618a00b006ed0b798f56si1431192pfb.48.2024.04.12.02.15.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 02:15:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-142354-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=I3d2Gv4I; 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-142354-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-142354-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 3212E287B33 for ; Fri, 12 Apr 2024 09:13:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3D26256448; Fri, 12 Apr 2024 09:09:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="I3d2Gv4I" 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 5A8ED58229; Fri, 12 Apr 2024 09:09:21 +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=1712912964; cv=none; b=e1OjalXGyP73u1e40RoRenA57Q/bI9L4YFx0gsAIzwgm4tS8pZkWlR9zd8rHUxoBJO0HbzSZpaaU+DZVi2dvzgw/U7rDggAAGoGeWGDH1eSIyN+6ssyWPnDpDyZyy5j83sEOw80+XoAFgRNQMxaxsPHs2EWhyjVsjoabBEWS1R8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712912964; c=relaxed/simple; bh=BxfPOpQZbMoGgw/8sqx2yikXnKw32Zy2ZzibLZ6sp20=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=nWOAbYxlPEE9dc7d3+cBzupfiKiF9v3uZz6S3QUhRYvKZBxx63vdJZY4oafEEBffO9XRGNYtDTZHiKMu6iPhr3C3X77zvfuAWN+d7DsV0nnCeoQIzOLjTfcfX2pnc4H16BcZ7mh7gcG/74TwVoiDtdVjJYTmYHxOemijCqbSHkA= 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=I3d2Gv4I; 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: 5663437cf8ac11eeb8927bc1f75efef4-20240412 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=B+ef2Q9ahOvlZFjf4kINWNbY/u+5TXF52PZFS/LVSOw=; b=I3d2Gv4IsdkV11PnjaLqYuJZfxCwOS2+xNf/oLfg+w/txWwvlr7eBwzQDX1S2mWW0gNu9HzjFduOpyX9m0v3oDZs/VKcVmMXRA5p+mM6Cj5X9/6by0gOIJcAfmkGu3eH2baEq/G8BEL/WjuQ0R2aesQC9+qxbZpMbf3puD/QXPo=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.37,REQID:dda42d08-3ea9-43f6-bdef-92559c3be19b,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:6f543d0,CLOUDID:ffe4d5fa-ed05-4274-9204-014369d201e8,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: 5663437cf8ac11eeb8927bc1f75efef4-20240412 Received: from mtkmbs13n1.mediatek.inc [(172.21.101.193)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1243896220; Fri, 12 Apr 2024 17:09:16 +0800 Received: from mtkmbs11n2.mediatek.inc (172.21.101.187) by MTKMBS14N2.mediatek.inc (172.21.101.76) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Fri, 12 Apr 2024 17:09:14 +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; Fri, 12 Apr 2024 17:09:12 +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 v5,13/23] media: mediatek: vcodec: using shared memory as vsi address Date: Fri, 12 Apr 2024 17:08:41 +0800 Message-ID: <20240412090851.24999-14-yunfei.dong@mediatek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240412090851.24999-1-yunfei.dong@mediatek.com> References: <20240412090851.24999-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: TPKnaArzlb40Z9sXcK7F6QPZZctd3P4BK2i9pofGVSsKogmGusPLb/BY Ro06eVj3M+9E78FP+k6T5In082VlTzMbZlaZZohC58dk5sbwmyhfyi4Yas3gTZsoi2XrUn/Jn6K dMrRsL14qtq5d3cxkNd9Yv5wIp3lSt60hkI2pQ2CK7F3rMBgxv9NV+Z1yWVO7LpxXk6BRcssk+l YdApu1OhjUf8I4ABKpbG4rxE+9EaHkND3OC32gUa6c9X2DKLPd82Gj2QC3yG0smXVK/H8eHzG7s r7xobSAsPEFD+rZA81DDKa3G4nrLQ== 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: A0F58FCED3818B83AE8FC4A54B55B14D1EE6BD834E297FBBC6516943757948762000: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.18.0