From mboxrd@z Thu Jan 1 00:00:00 1970 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 EF9C7C5B549 for ; Fri, 30 May 2025 08:05:24 +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=OZgJlLqonv38l5RGHoperSGRC6MB1OzkzkEVVzcVj6A=; b=n+1HHm7G8Clyp/FGbWX0se1Lva CWTer7uUXIXVFtIZZLikocqbk9L4XGDGZFqeRhXXM1q5abs7EL06vFw7WLqEW/RnSJqQWcWd2k9WH d4/gW9VBwXrg2CzXC5MK+rE7vUboPYIAuJQFlnfdcHdYZVGWmz8+4WCx4wxXWG3Df7Yxo8fWIjZap 2OM/vHmi8W4MjEBOEO7wITYmrgNUij6TW/oZDRWHncriSNbzIMNe+VLvuqwRCbY1zJuErg1xsMZ7K H3BUIxic7iyxGCAdcD5OU9u2nmGmRu3gCrnGWLSwVMqR1WjB1+3EU/JP8rGR08BVpGTBwkLDoPj8N uZzTueBQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1uKujz-0000000HY4U-3NPC; Fri, 30 May 2025 08:05:23 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1uKuR8-0000000HUm6-34KQ; Fri, 30 May 2025 07:45:56 +0000 X-UUID: 1a762a463d2a11f08d385d50fb11b32d-20250530 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=OZgJlLqonv38l5RGHoperSGRC6MB1OzkzkEVVzcVj6A=; b=OBxSEatEehJ7qHeCbGFizpUb82ZibskdsfL1B4j47yMyyNMJXqQvF64zUyvFy+CeB7wE3RIDgyuRn65wlK6wobAr5b6z26KzcazR98aqcpaJ5ONPFugP7tCrwdvBHG3OSYprAsav89aFGaIiOaw2bRYsoap9iuKHb2HwzyCnLcA=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.2.1,REQID:1c2e79f0-68c9-4d09-9a87-e8d7f88df18f,IP:0,UR L:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION:r elease,TS:0 X-CID-META: VersionHash:0ef645f,CLOUDID:52ef4759-eac4-4b21-88a4-d582445d304a,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:81|82|102,TC:nil,Content:0|50,EDM:-3 ,IP:nil,URL: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: 1a762a463d2a11f08d385d50fb11b32d-20250530 Received: from mtkmbs11n2.mediatek.inc [(172.21.101.187)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1481108188; Fri, 30 May 2025 00:45:49 -0700 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.1258.39; Fri, 30 May 2025 15:45:45 +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.1258.39 via Frontend Transport; Fri, 30 May 2025 15:45:45 +0800 From: Kyrie Wu To: Hans Verkuil , Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matthias Brugger , AngeloGioacchino Del Regno , Kyrie Wu , , , , , CC: Subject: [PATCH v5 07/12] media: mediatek: jpeg: refactor jpeg dst buffer layout Date: Fri, 30 May 2025 15:45:32 +0800 Message-ID: <20250530074537.26338-8-kyrie.wu@mediatek.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20250530074537.26338-1-kyrie.wu@mediatek.com> References: <20250530074537.26338-1-kyrie.wu@mediatek.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250530_004554_779429_41D773A4 X-CRM114-Status: GOOD ( 14.21 ) 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 1. change dst buffer size to same as struct mtk_jpeg_src_buf to make sure all params of mtk_jpeg_src_buf could get a memory. 2. For memory alloc operation: the v4l2 framework malloc a memory, the base addr is vb2_buffer and the size is sizeof(struct mtk_jpeg_src_buf), mtk_jpeg_src_buf could get itself addr by container_of like that: vb2_buffer -> vb2_v4l2_buffer -> mtk_jpeg_src_buf. vb2_v4l2_buffer must keep on the top of mtk_jpeg_src_buf. Signed-off-by: Kyrie Wu --- drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c | 2 +- drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c b/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c index 52d59bb5c9ad..7e3509be6f69 100644 --- a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c +++ b/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c @@ -1103,7 +1103,7 @@ static int mtk_jpeg_queue_init(void *priv, struct vb2_queue *src_vq, dst_vq->type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; dst_vq->io_modes = VB2_DMABUF | VB2_MMAP; dst_vq->drv_priv = ctx; - dst_vq->buf_struct_size = sizeof(struct v4l2_m2m_buffer); + dst_vq->buf_struct_size = sizeof(struct mtk_jpeg_src_buf); dst_vq->ops = jpeg->variant->qops; dst_vq->mem_ops = &vb2_dma_contig_memops; dst_vq->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY; diff --git a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.h b/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.h index 655dc9c3280c..186cd1862028 100644 --- a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.h +++ b/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.h @@ -96,10 +96,10 @@ struct mtk_jpeg_variant { }; struct mtk_jpeg_src_buf { - u32 frame_num; struct vb2_v4l2_buffer b; struct list_head list; u32 bs_size; + u32 frame_num; struct mtk_jpeg_dec_param dec_param; struct mtk_jpeg_ctx *curr_ctx; -- 2.46.0