mirror of
https://github.com/torvalds/linux.git
synced 2026-11-06 21:58:01 +01:00
media: mediatek: jpeg: retry HW selection after successful wait
wait_event_interruptible_timeout() returns a positive value when its
condition becomes true before the timeout. mtk_jpegdec_worker() treats
every nonzero result as a failure, so a normal decoder wakeup finishes
the mem2mem job as though no hardware became available.
Handle interrupted waits and exhausted timeout retries separately, and
retry hardware selection after a successful wakeup. Increment the retry
count only for actual timeouts. The encoder uses
wait_event_interruptible(), whose successful return is zero, so its
existing check is correct; leave that separate no-timeout policy
unchanged.
Fixes: dedc215003 ("media: mtk-jpegdec: add jpeg decode worker interface")
Cc: stable@vger.kernel.org
Assisted-by: Codex:gpt-5
Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
This commit is contained in:
parent
96f6b5e229
commit
eb0bbd0ad6
|
|
@ -1698,9 +1698,15 @@ static void mtk_jpegdec_worker(struct work_struct *work)
|
|||
ret = wait_event_interruptible_timeout(jpeg->hw_wq,
|
||||
atomic_read(&jpeg->hw_rdy) > 0,
|
||||
MTK_JPEG_HW_TIMEOUT_MSEC);
|
||||
if (ret != 0 || (i++ > MTK_JPEG_MAX_RETRY_TIME)) {
|
||||
dev_err(jpeg->dev, "%s : %d, all HW are busy\n",
|
||||
__func__, __LINE__);
|
||||
if (ret < 0) {
|
||||
dev_err(jpeg->dev, "decoder HW wait interrupted: %d\n",
|
||||
ret);
|
||||
v4l2_m2m_job_finish(jpeg->m2m_dev, ctx->fh.m2m_ctx);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ret && i++ > MTK_JPEG_MAX_RETRY_TIME) {
|
||||
dev_err(jpeg->dev, "all decoder HW are busy\n");
|
||||
v4l2_m2m_job_finish(jpeg->m2m_dev, ctx->fh.m2m_ctx);
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user