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 9C6F7C87FCF for ; Mon, 11 Aug 2025 02:31:25 +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:To:From:Reply-To:Cc:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=NvcERnFywOFxjEXRSQi3DNguFzpNGPChoYvvbF5CHk4=; b=cxQZACeT2Pc/JgBii3ypnaoHfa VHBUo2kZGd5Q7xJq6qheXiT847O9QxkZ5jslnHqYlrEi4v+MEOo2GNfTtQ9vOaZnK0Ns0MC2B+23E 7KxQiwWx0uwqdpatgt8IigG4ypvRJSsg/KAz+1ikUTO+VnDAbBiTKCD811yDHgHk8ngSBBDJivP3J KAjdkA3MhxG9pAN3Nelr9DIjBWcyO6x7jBgxEJi3tZoGEsBtVjOAgL0Ru5gUAmgi+SzKAcLcXr5HA MzAvNKvK+IAcrgiKHxF5gE1KSdMvMRPg+nF5x8SFMfRCtOgK4T3zn8cU7jSlt2iM2BQ5UqMRit1yr D23RJcvQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1ulIJo-00000006Lr0-2kAQ; Mon, 11 Aug 2025 02:31:24 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1ulIEj-00000006L6y-0nJe; Mon, 11 Aug 2025 02:26:14 +0000 X-UUID: 8697b6cc765a11f09eb0dd999d3936bf-20250810 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=NvcERnFywOFxjEXRSQi3DNguFzpNGPChoYvvbF5CHk4=; b=M+J5dr6/9QfkEmYhltaHrtsBU4z7C5zXwREyWbeGoUTUUvST+gjsAC9vP//PJvP5bl3YUyzsvORrvWBiubLOF+ECmpOnXuErgssruj2D/jTwbVzw4nGYFYSCYXFfL69Z/UP8cAfSYXbqyQrYUCt2W0ntShkcetff1WBhkY0Nt3M=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.3.3,REQID:ee644c5a-062b-4e6e-aa57-1192de433d56,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:f1326cf,CLOUDID:37f643ce-1ac4-40cd-97d9-e8f32bab97d5,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: 8697b6cc765a11f09eb0dd999d3936bf-20250810 Received: from mtkmbs14n1.mediatek.inc [(172.21.101.75)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 487122507; Sun, 10 Aug 2025 19:26:02 -0700 Received: from mtkmbs11n1.mediatek.inc (172.21.101.185) by MTKMBS09N1.mediatek.inc (172.21.101.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.39; Mon, 11 Aug 2025 10:25:54 +0800 Received: from mhfsdcap04.gcn.mediatek.inc (10.17.3.154) by mtkmbs11n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1258.39 via Frontend Transport; Mon, 11 Aug 2025 10:25:53 +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 v8 02/12] media: mediatek: jpeg: fix jpeg buffer payload setting Date: Mon, 11 Aug 2025 10:25:44 +0800 Message-ID: <20250811022555.1049-3-kyrie.wu@mediatek.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20250811022555.1049-1-kyrie.wu@mediatek.com> References: <20250811022555.1049-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-20250810_192609_229184_55C4FD74 X-CRM114-Status: GOOD ( 15.92 ) 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 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 = vb2_get_drv_priv(vb->vb2_queue); struct mtk_jpeg_q_data *q_data = NULL; struct v4l2_plane_pix_format plane_fmt = {}; + unsigned long max_size; int i; q_data = mtk_jpeg_get_q_data(ctx, vb->vb2_queue->type); @@ -717,12 +718,20 @@ static int mtk_jpeg_buf_prepare(struct vb2_buffer *vb) for (i = 0; i < q_data->fmt->colplanes; i++) { plane_fmt = q_data->pix_mp.plane_fmt[i]; + max_size = plane_fmt.sizeimage; + if (ctx->enable_exif && - q_data->fmt->fourcc == 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 == V4L2_PIX_FMT_JPEG) { + max_size += 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)); + } } return 0; -- 2.46.0