From patchwork Mon Oct 14 07:33:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yunfei Dong X-Patchwork-Id: 13834240 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D2915CFC503 for ; Mon, 14 Oct 2024 07:37:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date :Subject:CC:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=sHIKlEGQc1gMljjo6XctvH3MyRQKPj0bj6tE3zjFyEg=; b=2UZPQqL4HyvIv4pw6LC/KVxhEA rRjdsA3GoPanfn8hB1enjI8VkuCZ3r0AJSffkRD5xNgKCPbGPYtk9+HyCruI+K+AUveg3J7wqRQMN LgoWA2Mtk8ID//+//D+71QtWasU8xOstiONgqv//jZpG9rjNWl/kETwoPWoS4ZbKjeyNDMgXjraDT i7WInVV0JyrATf/2eAE2b9lz0nEA9j1pY3vRdyRFfUjw3uFNp9JmN60KQLWhbHe6TXRgIWc0P9R55 nTTa5KelM7Q1JLwOctepGVsigR6UWWBCmz9/bhGzbBBtvBU5SdGfy+oW886yxiBV4LCbdv3ph6YqQ xAnXYZ7w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t0FeK-000000045Lv-3Wy2; Mon, 14 Oct 2024 07:37:52 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t0FZy-000000044R6-3oND; Mon, 14 Oct 2024 07:33:25 +0000 X-UUID: 955b36c889fe11efba0aef63c0775dbf-20241014 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=sHIKlEGQc1gMljjo6XctvH3MyRQKPj0bj6tE3zjFyEg=; b=iFzjLr8CxnuK4P6wd0HW9Rl4C9ASVWDnE6eFPZl+P2m5tFj5yCUQXe572eVdDDdK0bBVUhc4nF3QtECTFdtG9ysO4ZzEci8OoZyoY6IB4AP89rMOgt/EGmjC0KFeqeOeKFUxDoFI820s/um2jXl6RjHVw9P+GpnQrpeWZwpeHiI=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.41,REQID:81636433-2e5a-4da5-9230-be41d4e81059,IP:0,U RL:0,TC:0,Content:0,EDM:25,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:25 X-CID-META: VersionHash:6dc6a47,CLOUDID:8f6fbe06-3d5c-41f6-8d90-a8be388b5b5b,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:5,IP:nil,UR L:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0,LES:1,S PR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-UUID: 955b36c889fe11efba0aef63c0775dbf-20241014 Received: from mtkmbs13n2.mediatek.inc [(172.21.101.108)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1817581006; Mon, 14 Oct 2024 00:33:19 -0700 Received: from mtkmbs11n2.mediatek.inc (172.21.101.187) by mtkmbs10n2.mediatek.inc (172.21.101.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Mon, 14 Oct 2024 15:33:16 +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; Mon, 14 Oct 2024 15:33:15 +0800 From: Yunfei Dong To: =?utf-8?q?N=C3=ADcolas_F_=2E_R_=2E_A_=2E_Prado?= , Sebastian Fricke , Nicolas Dufresne , Hans Verkuil , AngeloGioacchino Del Regno , Benjamin Gaignard , Nathan Hebert , Daniel Almeida CC: Hsin-Yi Wang , Fritz Koenig , Daniel Vetter , Steve Cho , "Yunfei Dong" , , , , , , Subject: [PATCH 5/6] media: mediatek: vcodec: adding non extend struct Date: Mon, 14 Oct 2024 15:33:09 +0800 Message-ID: <20241014073314.18409-6-yunfei.dong@mediatek.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20241014073314.18409-1-yunfei.dong@mediatek.com> References: <20241014073314.18409-1-yunfei.dong@mediatek.com> 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--8.865500-8.000000 X-TMASE-MatchedRID: SJCrnFkDoFsQ5hxJOM7hQxlckvO1m+JcTJDl9FKHbrkS+jFO7d+PW4XU efEuqZPbprivVPtMHvYgtOjYSVCcGMZR5zLxbV5qSHCU59h5KrHEoDEGChh7CQoDY6gYCVOTWLm v5Mq0iytzQGdyGqOMPYAy6p60ZV62fJ5/bZ6npdjKayT/BQTiGhsMr2aelUWF66AX8NMCygLa1t TiSs0wA9D8gdPbakiJ3KstBC/47ng= X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--8.865500-8.000000 X-TMASE-Version: SMEX-14.0.0.3152-9.1.1006-23728.005 X-TM-SNTS-SMTP: A81E988DBF4D0C9E3BCA885B5E5AAA3B44D34589CF95CCF41E60A04EF21469B32000:8 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241014_003323_069757_D3666CF9 X-CRM114-Status: GOOD ( 12.09 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org Adding non extend struct to support old architecture to calculate address end in kernel. Signed-off-by: Yunfei Dong --- .../decoder/vdec/vdec_h264_req_multi_if.c | 76 ++++++++++++++++++- 1 file changed, 73 insertions(+), 3 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 ba7fd3200d98..d6dc1cc5a712 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 @@ -66,6 +66,29 @@ struct vdec_h264_slice_info_ex { u32 reserved; }; +/** + * struct vdec_h264_slice_info - decode information + * + * @nal_info: nal info of current picture + * @timeout: Decode timeout: 1 timeout, 0 no timeount + * @bs_buf_size: bitstream size + * @bs_buf_addr: bitstream buffer dma address + * @y_fb_dma: Y frame buffer dma address + * @c_fb_dma: C frame buffer dma address + * @vdec_fb_va: VDEC frame buffer struct virtual address + * @crc: Used to check whether hardware's status is right + */ +struct vdec_h264_slice_info { + u16 nal_info; + u16 timeout; + u32 bs_buf_size; + u64 bs_buf_addr; + u64 y_fb_dma; + u64 c_fb_dma; + u64 vdec_fb_va; + u32 crc[8]; +}; + /* * struct vdec_h264_slice_mem - memory address and size */ @@ -124,6 +147,44 @@ struct vdec_h264_slice_vsi_ex { struct vdec_h264_slice_lat_dec_param h264_slice_params; }; +/** + * struct vdec_h264_slice_vsi - shared memory for decode information exchange + * between SCP and Host. + * + * @wdma_err_addr: wdma error dma address + * @wdma_start_addr: wdma start dma address + * @wdma_end_addr: wdma end dma address + * @slice_bc_start_addr: slice bc start dma address + * @slice_bc_end_addr: slice bc end dma address + * @row_info_start_addr: row info start dma address + * @row_info_end_addr: row info end dma address + * @trans_start: trans start dma address + * @trans_end: trans end dma address + * @wdma_end_addr_offset: wdma end address offset + * + * @mv_buf_dma: HW working motion vector buffer + * dma address (AP-W, VPU-R) + * @dec: decode information (AP-R, VPU-W) + * @h264_slice_params: decode parameters for hw used + */ +struct vdec_h264_slice_vsi { + /* LAT dec addr */ + u64 wdma_err_addr; + u64 wdma_start_addr; + u64 wdma_end_addr; + u64 slice_bc_start_addr; + u64 slice_bc_end_addr; + u64 row_info_start_addr; + u64 row_info_end_addr; + u64 trans_start; + u64 trans_end; + u64 wdma_end_addr_offset; + + u64 mv_buf_dma[H264_MAX_MV_NUM]; + struct vdec_h264_slice_info dec; + struct vdec_h264_slice_lat_dec_param h264_slice_params; +}; + /** * struct vdec_h264_slice_share_info - shared information used to exchange * message between lat and core @@ -172,10 +233,19 @@ struct vdec_h264_slice_inst { struct mtk_vcodec_mem pred_buf; struct mtk_vcodec_mem mv_buf[H264_MAX_MV_NUM]; struct vdec_vpu_inst vpu; - struct vdec_h264_slice_vsi_ex *vsi_ex; - struct vdec_h264_slice_vsi_ex *vsi_core_ex; + union { + struct vdec_h264_slice_vsi_ex *vsi_ex; + struct vdec_h264_slice_vsi *vsi; + }; + union { + struct vdec_h264_slice_vsi_ex *vsi_core_ex; + struct vdec_h264_slice_vsi *vsi_core; + }; - struct vdec_h264_slice_vsi_ex vsi_ctx_ex; + union { + struct vdec_h264_slice_vsi_ex vsi_ctx_ex; + struct vdec_h264_slice_vsi vsi_ctx; + }; struct vdec_h264_slice_lat_dec_param h264_slice_param; unsigned int resolution_changed;