From nobody Thu Oct 2 18:08:01 2025 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 8F66E21D3F6; Mon, 15 Sep 2025 03:02:31 +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=1757905353; cv=none; b=jbPV0KFvcL76u1S3wQji4FduDXf07I1aBN7v8EkxLBlKsCtWtgbOYWKUn7QWb6J80QZkr5FNvckoI6Cr/Z4pMNZxZUQ5hqqHVCDc0UET3tgaIPHNwPIJ5Qt5roaNhaVixHRdUlX9/r29S64PGiDwTRN2HQTz8gFm56TNK0w1NaU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757905353; c=relaxed/simple; bh=lGqVfaNg+UUASg8CSJy+lGf8IapIQi2lLRbTU0+yvbk=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=uQa+XoKqDUeIPYaL/7kMJCgh8zMtJKfJLuyxrXnBG5OM6zOcWxEqPVlKI8bA8v9SeTSBhtuoeZgqYPS5v6Yy/4mzpfrDbQdXaGVp6JX3Pdr/lSCE7gJkESE58lCozEb8jnWQCp+UrpRDkfGtuppaQY6BV9Q4c/T2s8C/wYiRmBE= 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=HEDlgIaf; 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="HEDlgIaf" X-UUID: 68532e6691e011f0bd5779446731db89-20250915 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:To:From; bh=psXflDCSIqhouHGczbLiL7m2tvz4BYOGpTdzpXakq9c=; b=HEDlgIafa8DOWClIN3UViX2oe0wkOThhe8vFlx7NR3AJA8lt8rs+TzLsf+mQw3s1UZ0z1eGU0kyiGxkBQ559pxIRVel1ORoi1ckEz5kpK6phualRUfeRhSiZymc+i2r4l1xwgc2PrnJsQYOX6ON7GjbAbzCgrEYV6JXzT8l5YuI=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.3.4,REQID:fb7ec923-3d55-4140-8997-5cec4744e00c,IP:0,UR L:0,TC:0,Content:-5,EDM:25,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:20 X-CID-META: VersionHash:1ca6b93,CLOUDID:9ada50a9-24df-464e-9c88-e53ab7cf7153,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:81|82|102,TC:-5,Content:0|15|50,EDM: 5,IP:nil,URL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,A V:0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 2,SSN|SDN X-CID-BAS: 2,SSN|SDN,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-CID-RHF: D41D8CD98F00B204E9800998ECF8427E X-UUID: 68532e6691e011f0bd5779446731db89-20250915 Received: from mtkmbs14n1.mediatek.inc [(172.21.101.75)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 588788584; Mon, 15 Sep 2025 11:02:25 +0800 Received: from mtkmbs11n2.mediatek.inc (172.21.101.187) 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; Mon, 15 Sep 2025 11:02:23 +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.1258.39 via Frontend Transport; Mon, 15 Sep 2025 11:02:24 +0800 From: Kyrie Wu To: Hans Verkuil , Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matthias Brugger , AngeloGioacchino Del Regno , Kyrie Wu , , , , , Subject: [PATCH v9 03/12] media: mediatek: jpeg: fix jpeg buffer layout Date: Mon, 15 Sep 2025 11:02:02 +0800 Message-ID: <20250915030212.22078-4-kyrie.wu@mediatek.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20250915030212.22078-1-kyrie.wu@mediatek.com> References: <20250915030212.22078-1-kyrie.wu@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: quoted-printable X-MTK: N Content-Type: text/plain; charset="utf-8" For memory alloc operation of jpeg dst buffer: the mallocing memory function interface use vb2_buffer as the base addr. If structure mtk_jpeg_src_buf wants to be allocated to memory, it needs to be placed vb2_v4l2_buffer at the starting position, because structure vb2_buffer is at the starting position of vb2_v4l2_buffer, and the allocated size is set to the size of structure mtk_jpeg_src_buf, so as to ensure that structures mtk_jpeg_src_buf, vb2_v4l2_buffer and vb2_buffer can all be allocated memory. Fixes: 5fb1c2361e56 ("mtk-jpegenc: add jpeg encode worker interface") 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 59ef0cdd378e..fff8c12421af 100644 --- a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c +++ b/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c @@ -1099,7 +1099,7 @@ static int mtk_jpeg_queue_init(void *priv, struct vb2= _queue *src_vq, dst_vq->type =3D V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; dst_vq->io_modes =3D VB2_DMABUF | VB2_MMAP; dst_vq->drv_priv =3D ctx; - dst_vq->buf_struct_size =3D sizeof(struct v4l2_m2m_buffer); + dst_vq->buf_struct_size =3D sizeof(struct mtk_jpeg_src_buf); dst_vq->ops =3D jpeg->variant->qops; dst_vq->mem_ops =3D &vb2_dma_contig_memops; dst_vq->timestamp_flags =3D 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 6be5cf30dea1..148fd41759b7 100644 --- a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.h +++ b/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.h @@ -85,10 +85,10 @@ struct mtk_jpeg_variant { }; =20 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; =20 struct mtk_jpeg_ctx *curr_ctx; --=20 2.45.2