From nobody Tue Dec 16 01:56:16 2025 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) (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 63C5E27147D; Tue, 2 Dec 2025 09:48:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.61.82.184 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764668895; cv=none; b=hVpZXRt2OtN/Ea5MCfTF5n+5UEgypkoFDuIqcwaHkBlAW8Y0wGYYhAKyyly+rgwGyWkSy29dQlUJtNO+UAwWdfyRYOSjrK/FH/fu+gbYnSYYtZ/0tTdx3YrHNQbjGeZQYIjHTlJ8xfkIg78kjR6mEElatkr6S8+BCueIrcO1xnw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764668895; c=relaxed/simple; bh=gSmVv346hwHPmKQNxvSQBb8HY+arBUhn9B3MGBs4M7s=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Yxam59JVWc/mPNvhNNbqNQ1dNlPHjRIxX7HitTvh5fS2AKauX6DtuErlLJhrHAZsE2kEqMuH4NJCqNvKWCnEFftxCmrDlXRxx13e+PLntmPgG28pb3mlHiBISXZ3hlajPEm4Bo6YsryBWdItw2GBNiTW6sA1XL7LcqPsRpPYJBM= 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=JwL0wOi6; arc=none smtp.client-ip=210.61.82.184 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="JwL0wOi6" X-UUID: 002f6608cf6411f0b33aeb1e7f16c2b6-20251202 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=QYty6mYvjqLb4Zs20dNjkjELWNSXj7FpdYud8HrVm9s=; b=JwL0wOi6cbM5kL7M7COfRl6ked6SopCesYWoXlkTVviICs3gNRzHi+VFetO6BogkAmr+7woI/4hMwU+Xz4++QbG7eTyJG0E90L5yZGQ7NRHz/ft9DisEH4K2cyR3HtDcvHrV6ns2MxmlHGHP+eLU6MOHSAsPxh8pdPoO48knqyo=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.3.6,REQID:a1914076-8a55-4953-83ae-556ead1849a2,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:a9d874c,CLOUDID:30455002-1fa9-44eb-b231-4afc61466396,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:81|82|102|836|888|898,TC:-5,Content: 0|15|50,EDM:-3,IP:nil,URL:0,File:130,RT:0,Bulk:nil,QS:nil,BEC:nil,COL:0,OS I:0,OSA:0,AV: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: 002f6608cf6411f0b33aeb1e7f16c2b6-20251202 Received: from mtkmbs14n1.mediatek.inc [(172.21.101.75)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 740669759; Tue, 02 Dec 2025 17:48:05 +0800 Received: from mtkmbs13n2.mediatek.inc (172.21.101.108) 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.1748.26; Tue, 2 Dec 2025 17:48:04 +0800 Received: from mhfsdcap04.gcn.mediatek.inc (10.17.3.154) by mtkmbs13n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1748.26 via Frontend Transport; Tue, 2 Dec 2025 17:48:03 +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 v11 02/12] media: mediatek: jpeg: fix jpeg buffer payload setting Date: Tue, 2 Dec 2025 17:47:50 +0800 Message-ID: <20251202094800.6140-3-kyrie.wu@mediatek.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20251202094800.6140-1-kyrie.wu@mediatek.com> References: <20251202094800.6140-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 6a7e01130f1c..0cf3dc5407e4 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