From nobody Thu Apr 2 02:40:47 2026 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 411E63859CF; Thu, 19 Mar 2026 02:22:05 +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=1773886927; cv=none; b=rLSNmsiLSzlHIBqUt4pc78YXATl9m8AXsws7Fzjkqg5OM/Ma39XDMbnECKjlWuVWrVLEhU95biZkKjuIE3HpTQghacL/gbZx7rYkXDjh7S2gSRDHCqBx8f3eVMvON/8G8I/CFsZEhqQVWZq+oya8vh2AAnbdCR9HgHP3KKhqnOQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773886927; c=relaxed/simple; bh=Fj6vkJCf4pGnknD4qlY3xL6++wfjpR7zkpHVIvs0M/w=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=i6xvDpoShOlFZh9tG/1xQmRJO2Wr//ab2Wlwjnu07Q2JK1d0vuRng7STYPIpZjdrYFbNjDoU6IOzRLkTkTN3EYHn2a7Z23LiGO6xwPo7ewxD14S8gS/AJW29Xb3eZZ/m+m+oOhFbyieJIzr7TSdlxneFUKaWQ9oAydb/wKiLs6Q= 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=L35EBSm1; 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="L35EBSm1" X-UUID: 69c95f36233a11f1a02d4725871ece0b-20260319 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=83h/0yZetRY9ULGUO/DU5qEdtL070T+5ae6VMpNT5o0=; b=L35EBSm11+42tWs0E+hkUpBMUTyI1sgJ58FD69z7jHyQzGe+q4eeXa4mGv3KHdG7tg/X1xqSVsfodz1jt2god8LtvNu6uKMrKD3QpGtq5hoUMmppVw0OZuim0iTVyyfr1nVxdirmKDlW+sMB/1xVcKvL4BDbpqHAK9S5a2QrcD8=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.3.12,REQID:55ec72a0-b383-4c4e-8e4a-73499dd084e8,IP:0,U RL:0,TC:0,Content:0,EDM:-20,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:-20 X-CID-META: VersionHash:e7bac3a,CLOUDID:efb0a94c-9183-487b-8624-e74f2dd98990,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:81|82|102|836|888|898,TC:-5,Content: 0|15|50,EDM:1,IP:nil,URL:0,File:130,RT:0,Bulk:nil,QS:nil,BEC:-1,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: 2,SSN|SDN X-CID-BAS: 2,SSN|SDN,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-CID-RHF: D41D8CD98F00B204E9800998ECF8427E X-UUID: 69c95f36233a11f1a02d4725871ece0b-20260319 Received: from mtkmbs14n2.mediatek.inc [(172.21.101.76)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1996145290; Thu, 19 Mar 2026 10:22:01 +0800 Received: from mtkmbs13n1.mediatek.inc (172.21.101.193) by mtkmbs11n1.mediatek.inc (172.21.101.185) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.29; Thu, 19 Mar 2026 10:22:00 +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.2562.29 via Frontend Transport; Thu, 19 Mar 2026 10:21:59 +0800 From: Kyrie Wu To: Hans Verkuil , Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Nicolas Dufresne , Conor Dooley , Matthias Brugger , AngeloGioacchino Del Regno , Kyrie Wu , , , , , Subject: [PATCH v13 07/12] media: mediatek: jpeg: fix resolution change event handling in decoder Date: Thu, 19 Mar 2026 10:21:46 +0800 Message-ID: <20260319022152.31313-8-kyrie.wu@mediatek.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20260319022152.31313-1-kyrie.wu@mediatek.com> References: <20260319022152.31313-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" This patch refines the handling of resolution change events within JPEG decoder worker. The `mtk_jpeg_set_queue_data` function is now called to set up queue data before signaling a source change through `mtk_jpeg_queue_src_chg_event`. By reorganizing these calls, the patch ensures that necessary queue information is updated prior to transitioning the context state to `MTK_JPEG_SOURCE_CHANGE`. A condition is added to exit early if the context is already in the `MTK_JPEG_SOURCE_CHANGE` state, preventing redundant operations and improving processing efficiency. Fixes: dedc21500334 ("media: mtk-jpegdec: add jpeg decode worker interface") Signed-off-by: Kyrie Wu --- drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c b/drivers= /media/platform/mediatek/jpeg/mtk_jpeg_core.c index 2596c3453053..efcbad953be1 100644 --- a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c +++ b/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c @@ -1735,11 +1735,15 @@ static void mtk_jpegdec_worker(struct work_struct *= work) =20 if (mtk_jpeg_check_resolution_change(ctx, &jpeg_src_buf->dec_param)) { - mtk_jpeg_queue_src_chg_event(ctx); + mtk_jpeg_set_queue_data(ctx, &jpeg_src_buf->dec_param); ctx->state =3D MTK_JPEG_SOURCE_CHANGE; + mtk_jpeg_queue_src_chg_event(ctx); goto getbuf_fail; } =20 + if (ctx->state =3D=3D MTK_JPEG_SOURCE_CHANGE) + goto getbuf_fail; + mtk_jpegdec_set_hw_param(ctx, hw_id, src_buf, dst_buf); ret =3D pm_runtime_resume_and_get(comp_jpeg[hw_id]->dev); if (ret < 0) { --=20 2.45.2