[PATCH v19 07/13] media: mediatek: jpeg: fix resolution change event handling in decoder

Kyrie Wu kyrie.wu at mediatek.com
Sun Nov 15 17:33:32 PST 2026


Announce a source change from the decoder worker and stop processing
while the context is in MTK_JPEG_SOURCE_CHANGE. Check that state before
comparing resolutions to avoid duplicate source-change notifications.

Keep queue-format updates in CAPTURE STREAMOFF under its existing
locking instead of changing queue data asynchronously in the worker.

Fixes: dedc21500334 ("media: mtk-jpegdec: add jpeg decode worker interface")
Signed-off-by: Kyrie Wu <kyrie.wu at mediatek.com>
---
 drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c | 5 ++++-
 1 file changed, 4 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 6e8b83987..a34f2d6a5 100644
--- a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c
+++ b/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c
@@ -1742,10 +1742,13 @@ retry_select:
 	v4l2_m2m_buf_copy_metadata(src_buf, dst_buf);
 	jpeg_src_buf = mtk_jpeg_vb2_to_srcbuf(&src_buf->vb2_buf);
 
+	if (ctx->state == MTK_JPEG_SOURCE_CHANGE)
+		goto getbuf_fail;
+
 	if (mtk_jpeg_check_resolution_change(ctx,
 					     &jpeg_src_buf->dec_param)) {
-		mtk_jpeg_queue_src_chg_event(ctx);
 		ctx->state = MTK_JPEG_SOURCE_CHANGE;
+		mtk_jpeg_queue_src_chg_event(ctx);
 		goto getbuf_fail;
 	}
 
-- 
2.51.0.windows.2




More information about the Linux-mediatek mailing list