v4l2: resolve a busy loop [1/1]
authorSong Zhao <song.zhao@amlogic.com>
Tue, 22 Dec 2020 00:54:00 +0000 (16:54 -0800)
committerSong Zhao <song.zhao@amlogic.com>
Tue, 22 Dec 2020 06:28:10 +0000 (22:28 -0800)
PD#SWPL-38455

Problem:
When decoder ES chunk is full, aml_vdec_worker can get next source
buffer but can't not decoder it with vdec_if_decode(). But it will
trigger v4l2_m2m_job_finish() and do another try immediately. This
is a busy loop.

Solution:
Sleep for 50ms when ES chun is full.

Verify:
T5D + TRC

Change-Id: Ide6163242075981c769d6381ecf7edebe7837b4f
Signed-off-by: Song Zhao <song.zhao@amlogic.com>
drivers/amvdec_ports/aml_vcodec_dec.c

index 29da0f1754e94434c38fb73ece35aafba461dd23..808dd525963ac355d10321a309ade6bc16c21439 100644 (file)
@@ -902,6 +902,9 @@ static void aml_vdec_worker(struct work_struct *work)
                aml_vdec_flush_decoder(ctx);
 
                goto out;
+       } else {
+               /* decoder is lack of resource, retry after short delay */
+               usleep_range(50000, 55000);
        }
 
        v4l2_m2m_job_finish(dev->m2m_dev_dec, ctx->m2m_ctx);