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 27EA52A1BA; 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=1757905355; cv=none; b=f58OwEOXKlxiNRPQlu7cjesRII7HFlI+JK9uHWKKMcwl83ZsMYKbMzKoj8IZLTnzYSh5OtbcUk5vLzHWkUusS/OGIEAlYDGbrUbi39TEsD1zgax7P6+TcHOyAm1Nu3RuASZRYf79YxD1q7udWzjJQbyNNxq+AS6S1e5CfZtm6dc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757905355; c=relaxed/simple; bh=Jbr4NsRMdPRdRTbUzDyc9NI2/ZP0C1LLXkm8oOuSpoc=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=I2Tkb6KGwAupeHBCKzXG0AhQv9Z0kaYfC9nPdWAM7r5CR2jVJbU5alkrgaV+Oddu1GwybOhgMoRjdjLcd21hOtQJN6OXnlv88W0neY5y2eoYafRHmlEJMT+/A/b/I6Cwm/G1nm5DF3EMefTTFoKkoHrO10TEgAxRgDXqpR1SQ88= 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=Q6cZ5FTQ; 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="Q6cZ5FTQ" X-UUID: 684e8bea91e011f0bd5779446731db89-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=1oTp1eE/gqGD61exCLYKdPUMWyxwpon1DAFes+an1kM=; b=Q6cZ5FTQ0jPCPUNAO5TPKDDC/Rlfdp/dJw1X369e2pFYkzhpAORGS4dDazlVXN3/0UIyQR5fiEBW3z//f8gufRGip3BYshr1tE16jit0hPOk9WmmxXOxSdJ7+CHVmUiXa4b0SywkjYJbFK/S5q2z/K+2sKrE8/Av6IQIKeNhNec=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.3.4,REQID:9f184150-6de4-4d77-ae56-9717c58c0619,IP:0,UR L: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:1ca6b93,CLOUDID:228f4bf8-ebfe-43c9-88c9-80cb93f22ca4,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: 684e8bea91e011f0bd5779446731db89-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 1139154971; 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:23 +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 02/12] media: mediatek: jpeg: fix jpeg buffer payload setting Date: Mon, 15 Sep 2025 11:02:01 +0800 Message-ID: <20250915030212.22078-3-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 multi-core jpegdec, if one of hws gets the event of resolution changing, the payload size, representing the size of Y/C data, needed to change. But others hws are decoding at the same time and it can not be changed immediately, which results that the payload size is not equal to the real buffer length of the hw's, which occurred resolution changing and a warnning call trace will print. So the setting of payload size must less than the real buffer length to remove the warnning logs. Fixes: 0fa49df4222f ("media: mtk-jpegdec: support jpegdec multi-hardware") Signed-off-by: Kyrie Wu --- .../platform/mediatek/jpeg/mtk_jpeg_core.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c b/drivers= /media/platform/mediatek/jpeg/mtk_jpeg_core.c index c4fef74dab96..59ef0cdd378e 100644 --- a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c +++ b/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c @@ -709,6 +709,7 @@ static int mtk_jpeg_buf_prepare(struct vb2_buffer *vb) struct mtk_jpeg_ctx *ctx =3D vb2_get_drv_priv(vb->vb2_queue); struct mtk_jpeg_q_data *q_data =3D NULL; struct v4l2_plane_pix_format plane_fmt =3D {}; + unsigned long max_size; int i; =20 q_data =3D mtk_jpeg_get_q_data(ctx, vb->vb2_queue->type); @@ -717,12 +718,20 @@ static int mtk_jpeg_buf_prepare(struct vb2_buffer *vb) =20 for (i =3D 0; i < q_data->fmt->colplanes; i++) { plane_fmt =3D q_data->pix_mp.plane_fmt[i]; + max_size =3D plane_fmt.sizeimage; + if (ctx->enable_exif && - q_data->fmt->fourcc =3D=3D V4L2_PIX_FMT_JPEG) - vb2_set_plane_payload(vb, i, plane_fmt.sizeimage + - MTK_JPEG_MAX_EXIF_SIZE); - else - vb2_set_plane_payload(vb, i, plane_fmt.sizeimage); + q_data->fmt->fourcc =3D=3D V4L2_PIX_FMT_JPEG) { + max_size +=3D MTK_JPEG_MAX_EXIF_SIZE; + + vb2_set_plane_payload(vb, i, + MIN(vb->planes[i].length, + max_size)); + } else { + vb2_set_plane_payload(vb, i, + MIN(plane_fmt.sizeimage, + vb->planes[i].length)); + } } =20 return 0; --=20 2.45.2