Video converter with many cameras (Tegra APIs)

Dear all,

Now I’m facing problem when terminate application converting frames from UYVY to YUV420 on 2 or 3 cameras. More details:

  1. If I use only v4l2 to capture frame (memory buff type : V4L2_MEMORY_MMAP) and convert to RGB to display with OpenCV everything would work well even 2 or 3 cameras, there is no warning message on debug terminal.

  2. If I use v4l2 to capture frame (memory buff type: V4L2_MEMORY_DMABUF) and feed to Video converter to convert to YUV420:
    a. Run only one camera, it will show below warning when start

nvmap_alloc_handle: PID 1775: HX500: WARNING: All NvMap Allocations must have a tag to identify the subsystem allocating memory.Please pass the tag to the API call NvRmMemHanldeAllocAttr() or relevant.
  and when stop
[   78.792273] tegra-vi4 15700000.vi: Status:  5 channel:00 frame:0000
[   78.798654] tegra-vi4 15700000.vi:          timestamp sof 88469448320 eof 88469628512 data 0x00000001
[   78.808015] tegra-vi4 15700000.vi:          capture_id 210 stream  0 vchan  0

b. If run 2 or 3 cameras same time then OS easily would be hang/stuck once application has been terminated. I create each thread for each camera capturing and converting.
Hang/stuck log

[20701.927991] [VuNguyen] ov10635_power_off 1918
[20739.188519] [VuNguyen] ov10635_power_on 1881
[20739.223924] nvmap_alloc_handle: PID 4761: HX500: WARNING: All NvMap Allocations must have a tag to identify the subsystem allocating memory.Please pass the tag to the API call NvRmMemHanldeAllocAttr() or relevant. 
[20739.244232] [VuNguyen] ov10635_power_on 1881
[20739.270743] [vunguyen] ov10635_s_stream [+] 1
[20739.275235] [vunguyen] ov10635_s_stream, i2c addr: 0x48
[20739.280183] [vunguyen] ov10635_s_stream [+] 1
[20739.280185] [vunguyen] ov10635_s_stream, i2c addr: 0x48
[20742.253805] tegra-vi4 15700000.vi: Status:  5 channel:00 frame:0000
[20742.253809] [vunguyen] ov10635_s_stream [+] 0
[20742.264527] tegra-vi4 15700000.vi:          timestamp sof 20751904736992 eof 20751904870656 data 0x00000001
[20742.274322] tegra-vi4 15700000.vi:          capture_id 1835 stream  0 vchan  0
[20742.281615] tegra-vi4 15700000.vi: Status:  5 channel:01 frame:0000
[20742.287922] tegra-vi4 15700000.vi:          timestamp sof 20751896158208 eof 20751906639072 data 0x00000002
[20742.297707] tegra-vi4 15700000.vi:          capture_id 3552 stream  2 vchan  0
[20742.304981] Unable to handle kernel paging request at virtual address ffffffbe429f0f40
[20742.304993] [vunguyen] ov10635_s_stream [+] 0
[20742.305823] [VuNguyen] ov10635_power_off 1918
[20742.306180] [VuNguyen] ov10635_power_off 1918
[20742.326057] pgd = ffffffc19efab000
[20742.329487] [ffffffbe429f0f40] *pgd=0000000000000000, *pud=0000000000000000
[20742.336519] Internal error: Oops: 96000005 [#1] PREEMPT SMP
[20742.342084] Modules linked in:
[20742.345150] CPU: 5 PID: 3161 Comm: kworker/5:1 Not tainted 4.4.38 #135
[20742.351666] Hardware name: quill (DT)
[20742.355329] Workqueue: events tegra_channel_status_worker
[20742.360730] task: ffffffc1ec637080 ti: ffffffc1a2834000 task.ti: ffffffc1a2834000
[20742.368205] PC is at osq_lock+0x54/0x18c
[20742.372124] LR is at mutex_optimistic_spin+0x94/0x1c8
[20742.377166] pc : [<ffffffc0000ea578>] lr : [<ffffffc0000e9c28>] pstate: 60000045
[20742.384547] sp : ffffffc1a2837c00
[20742.387855] x29: ffffffc1a2837c00 x28: 0000000000000000 
[20742.393183] x27: 0000000000000000 x26: ffffffc1aebcf038 
[20742.398507] x25: ffffffc1ec637080 x24: 0000000000000000 
[20742.403830] x23: 0000000000000000 x22: 0000000000000000 
[20742.409154] x21: 0000000000000000 x20: 00000000c82f5f60 
[20742.414477] x19: ffffffc1aebcf018 x18: ffffffc000bc7e38 
[20742.419800] x17: ffffffc000b54a60 x16: ffffffc000b54a60 
[20742.425123] x15: ffffffc000b54a60 x14: 0000000000000001 
[20742.430446] x13: 00000026e42decd9 x12: 000000000000bb4a 
[20742.435770] x11: 000000000000c36a x10: 0000000000000400 
[20742.441093] x9 : 0000000000000000 x8 : ffffffc1f5daf570 
[20742.446416] x7 : 0000000000000018 x6 : ffffffc001443510 
[20742.451739] x5 : ffffffc001214000 x4 : 0000000000000000 
[20742.457062] x3 : 00000000c82f5fbf x2 : ffffffc1f5dc1000 
[20742.462386] x1 : ffffffc001241148 x0 : ffffffc1aebcf038 
[20742.467708] 
[20742.469196] Process kworker/5:1 (pid: 3161, stack limit = 0xffffffc1a2834020)
[20742.476318] Call trace:
[20742.478762] [<ffffffc0000ea578>] osq_lock+0x54/0x18c
[20742.483722] [<ffffffc000b46694>] __mutex_lock_interruptible_slowpath+0x3c/0x1d8
[20742.491020] [<ffffffc000b46878>] mutex_lock_interruptible+0x48/0x4c
[20742.497280] [<ffffffc00090a104>] vi_notify_channel_reset+0x38/0x88
[20742.503451] [<ffffffc0007a06a0>] tegra_channel_handle_error+0x5c/0xa0
[20742.509883] [<ffffffc0007a06f4>] tegra_channel_status_worker+0x10/0x18
[20742.516403] [<ffffffc0000bbca0>] process_one_work+0x150/0x448
[20742.522140] [<ffffffc0000bc0cc>] worker_thread+0x134/0x40c
[20742.527619] [<ffffffc0000c1968>] kthread+0xe0/0xf4
[20742.532403] [<ffffffc000084f90>] ret_from_fork+0x10/0x40
[20742.537707] ---[ end trace 2f108655eea162ba ]---
[20742.544975] note: kworker/5:1[3161] exited with preempt_count 1
[20742.550978] Unable to handle kernel paging request at virtual address ffffffffffffffd8
[20742.558882] pgd = ffffffc19efab000
[20742.562276] [ffffffffffffffd8] *pgd=0000000000000000, *pud=0000000000000000
[20742.569250] Internal error: Oops: 96000005 [#2] PREEMPT SMP
[20742.574811] Modules linked in:
[20742.577871] CPU: 5 PID: 3161 Comm: kworker/5:1 Tainted: G      D         4.4.38 #135
[20742.585600] Hardware name: quill (DT)
[20742.589260] task: ffffffc1ec637080 ti: ffffffc1a2834000 task.ti: ffffffc1a2834000
[20742.596732] PC is at kthread_data+0x4/0xc
[20742.600734] LR is at wq_worker_sleeping+0x10/0xc4
[20742.605428] pc : [<ffffffc0000c2038>] lr : [<ffffffc0000bcb78>] pstate: 600000c5
[20742.612807] sp : ffffffc1a2837860
[20742.616113] x29: ffffffc1a2837860 x28: ffffffc1a2834000 
[20742.621435] x27: 0000000000000000 x26: ffffffc001241000 
[20742.626756] x25: 0000000000000005 x24: ffffffc000b458d0 
[20742.632077] x23: 0000000000000000 x22: ffffffc1ec637610 
[20742.637398] x21: ffffffc001213000 x20: ffffffc1ec637080 
[20742.642719] x19: ffffffc1f5dc0500 x18: ffffffc000bc7e38 
[20742.648041] x17: 000000000000000e x16: 0000000000000007 
[20742.653364] x15: 0000000000000001 x14: 0000000000000007 
[20742.658686] x13: 000000000000000e x12: 0000000000000013 
[20742.664008] x11: 000000000000001a x10: 000000000023b282 
[20742.669330] x9 : 000000000023b282 x8 : 0000000000000230 
[20742.674651] x7 : 0000000000000000 x6 : 00000000018e0ec4 
[20742.679974] x5 : ffffffc1f5dc0500 x4 : ffffffc1f5dc0ee0 
[20742.685298] x3 : 000000000001af3b x2 : ffffffc1ecc03000 
[20742.690620] x1 : 0000000000000005 x0 : 0000000000000000 
[20742.695939] 
[20742.697426] Process kworker/5:1 (pid: 3161, stack limit = 0xffffffc1a2834020)
[20742.704546] Call trace:
[20742.706988] [<ffffffc0000c2038>] kthread_data+0x4/0xc
[20742.712032] [<ffffffc000b454f8>] __schedule+0x348/0x6dc
[20742.717246] [<ffffffc000b458d0>] schedule+0x44/0xa8
[20742.722115] [<ffffffc0000a6c60>] do_exit+0x5b0/0x9a0
[20742.727073] [<ffffffc000089c08>] bug_handler.part.3+0x0/0x7c
[20742.732725] [<ffffffc00009c7c0>] __do_kernel_fault.part.7+0x74/0x84
[20742.738981] [<ffffffc00009ab10>] cpu_enable_pan+0x0/0x48
[20742.744282] [<ffffffc0000813a0>] do_mem_abort+0x40/0xa0
[20742.749496] [<ffffffc000084540>] el1_da+0x18/0x78
[20742.754191] [<ffffffc000b46694>] __mutex_lock_interruptible_slowpath+0x3c/0x1d8
[20742.761486] [<ffffffc000b46878>] mutex_lock_interruptible+0x48/0x4c
[20742.767743] [<ffffffc00090a104>] vi_notify_channel_reset+0x38/0x88
[20742.773913] [<ffffffc0007a06a0>] tegra_channel_handle_error+0x5c/0xa0
[20742.780342] [<ffffffc0007a06f4>] tegra_channel_status_worker+0x10/0x18
[20742.786859] [<ffffffc0000bbca0>] process_one_work+0x150/0x448
[20742.792594] [<ffffffc0000bc0cc>] worker_thread+0x134/0x40c
[20742.798070] [<ffffffc0000c1968>] kthread+0xe0/0xf4
[20742.802852] [<ffffffc000084f90>] ret_from_fork+0x10/0x40
[20742.808154] ---[ end trace 2f108655eea162bb ]---
[20742.814923] Fixing recursive fault but reboot is needed!
  1. I also tried to run samples 12_camera_v4l2_cuda when I terminated application by “ctrl +c” errors would flush on terminal as below
[ 2851.779072] [VuNguyen] ov10635_power_on 1881
[ 2851.865184] [vunguyen] ov10635_s_stream [+] 1
[ 2851.869550] [vunguyen] ov10635_s_stream, i2c addr: 0x48
[ 2854.740915] [vunguyen] ov10635_s_stream [+] 0
[ 2854.747412] [VuNguyen] ov10635_power_off 1918
[ 2854.765714] camera_v4l2_cud[4549]: unhandled level 2 translation fault (11) at 0x00000000, esr 0x92000006
[ 2854.775475] pgd = ffffffc1944bc000
[ 2854.778926] [00000000] *pgd=00000002144bb003, *pud=00000002144bb003, *pmd=0000000000000000
[ 2854.787476] 
[ 2854.788982] CPU: 3 PID: 4549 Comm: camera_v4l2_cud Not tainted 4.4.38 #135
[ 2854.796037] Hardware name: quill (DT)
[ 2854.799745] task: ffffffc06c95be80 ti: ffffffc194498000 task.ti: ffffffc194498000
[ 2854.807339] PC is at 0x7f7a9b94e0
[ 2854.810678] LR is at 0x7f7a9b9490
[ 2854.814043] pc : [<0000007f7a9b94e0>] lr : [<0000007f7a9b9490>] pstate: 60000000
[ 2854.821563] sp : 0000007fd57dddf0
[ 2854.824898] x29: 0000007fd57dde40 x28: 0000007fd57de348 
[ 2854.830361] x27: 00000000c0145608 x26: 0000000000000006 
[ 2854.835792] x25: 000000007d000000 x24: 0000000000000004 
[ 2854.841171] x23: 0000000000478540 x22: 0000000000000000 
[ 2854.846597] x21: 0000000000000000 x20: 0000000000000000 
[ 2854.852053] x19: 0000000000000000 x18: 0000000000000000 
[ 2854.857439] x17: 0000007f7a988fb0 x16: 0000007f7926b7d8 
[ 2854.862911] x15: 001b27029a80f646 x14: 0000000000000000 
[ 2854.868302] x13: 00000001f4000000 x12: 0000000000000017 
[ 2854.873731] x11: 00000000000de6ea x10: 000000005a5c56c0 
[ 2854.879154] x9 : 00000000000af270 x8 : 00000000000af270 
[ 2854.884531] x7 : 0000000000000000 x6 : 0000000000000001 
[ 2854.890008] x5 : 0000000000000000 x4 : 0000000000478428 
[ 2854.895427] x3 : 0000000000000000 x2 : 0000000000000000 
[ 2854.900848] x1 : 0000000000000000 x0 : 0000000000478540 
[ 2854.906235] 
[ 2854.907763] Library at 0x7f7a9b94e0: 0x7f7a9b5000 /usr/lib/aarch64-linux-gnu/libv4l/plugins/libv4l2_nvvidconv.so
[ 2854.918014] Library at 0x7f7a9b9490: 0x7f7a9b5000 /usr/lib/aarch64-linux-gnu/libv4l/plugins/libv4l2_nvvidconv.so
[ 2854.928223] vdso base = 0x7f7a9f7000

I was wondering is there any differences between V4L2_MEMORY_MMAP and V4L2_MEMORY_DMABUF could cause that problem. Or because of the other reason.

Thanks
Vu Nguyen

Hi,
Please share a sample to reproduce the issue. Thanks.

Hi DaneLLL,

https://drive.google.com/open?id=1sEXDcliDWsh02M9DSxuBQvub4gunnd8L

Plsz download and extract to “/home/nvidia/tegra_multimedia_api/samples” and just run “make” command. You can change NUM_CAM_SUPPORT value in “.h” file.

I found one strange thing that if I enable render everything worked well, but if render was disabled then easily to see below log as well as easily stuck.

[   78.792273] tegra-vi4 15700000.vi: Status:  5 channel:00 frame:0000
[   78.798654] tegra-vi4 15700000.vi:          timestamp sof 88469448320 eof 88469628512 data 0x00000001
[   78.808015] tegra-vi4 15700000.vi:          capture_id 210 stream  0 vchan  0

Thanks and Best Regards,
Vu Nguyen

Hi DaneLLL,

Did you try my application.
FYI, if I only capture frames from 3 cameras and display with OpenCV it would never happen this issue.

Thanks,
Vu Nguyen

Hi Vu,
We don’t have board with multiple YUV sensors so we try multiple USB cameras. The issue is not seen with USB cameras.

So are you able to reprocude the issue via v4l2-ctl? Like ‘v4l2-ctl -d /dev/video0 & v4l2-ctl -d /dev/video1 & v4l2-ctl -d /dev/video2 &’

Hi DaneLLL,

If I use only v4l2 it would be OK, the problem only happen when I enabled Video Converter (Tegra APIs).
I think it might relate to shared memory between v4l2 and Video Converter.

Thanks

Hi Vu,
How about ‘./camera_v4l2_cuda -d /dev/video0 & ./camera_v4l2_cuda -d /dev/video1 &’ ?

Hi D

Hi DaneLLL,

It started well. However when I terminate the application Ubuntu has been stuck then I could control nothing except HW reboot. Debug log as below

[ 2592.623249] [vunguyen] ov10635_s_stream [+] 1
[ 2592.627702] [vunguyen] ov10635_s_stream, i2c addr: 0x48
[ 2592.724977] [vunguyen] ov10635_s_stream [+] 1
[ 2592.729427] [vunguyen] ov10635_s_stream, i2c addr: 0x48
[ 2592.735663] [vunguyen] ov10635_s_stream [+] 1
[ 2592.740061] [vunguyen] ov10635_s_stream, i2c addr: 0x48
[ 2600.170786] [vunguyen] ov10635_s_stream [+] 0
[ 2600.177096] [VuNguyen] ov10635_power_off 1918
[ 2649.894820] tegra-vi4 15700000.vi: Status:  5 channel:00 frame:0000
[ 2649.894822] [vunguyen] ov10635_s_stream [+] 0
[ 2649.895784] [VuNguyen] ov10635_power_off 1918
[ 2649.909956] tegra-vi4 15700000.vi:          timestamp sof 2659566032512 eof 2659566150432 data 0x00000001
[ 2649.920825] tegra-vi4 15700000.vi:          capture_id 1719 stream  0 vchan  0
[ 2649.929344] tegra-vi4 15700000.vi: Status:  5 channel:01 frame:0000
[ 2649.935653] tegra-vi4 15700000.vi:          timestamp sof 2659575746144 eof 2659581550432 data 0x00000002
[ 2649.945228] tegra-vi4 15700000.vi:          capture_id 1716 stream  2 vchan  0
[ 2649.945251] Unable to handle kernel paging request at virtual address ffffffbe41c21b40

Thanks

Hi DaneLLL,

FYI,
If I opened 3 applications for 3 cameras on 3 terminal tabs and terminate one by one, everything would be OK.

Updated:

If I used thread as below it would be not stable.

int
main_thread(int dummy)
{
    context_t ctx;
    int error = 0;

    set_defaults(&ctx);

    /*CHECK_ERROR(parse_cmdline(&ctx, argc, argv), cleanup,
            "Invalid options specified");*/

    CHECK_ERROR(init_components(&ctx), cleanup,
            "Failed to initialize v4l2 components");

    CHECK_ERROR(prepare_buffers(&ctx), cleanup,
            "Failed to prepare v4l2 buffs");

    CHECK_ERROR(start_stream(&ctx), cleanup,
            "Failed to start streaming");

    CHECK_ERROR(start_capture(&ctx), cleanup,
            "Failed to start capturing")

    CHECK_ERROR(stop_stream(&ctx), cleanup,
            "Failed to stop streaming");

cleanup:
    if (ctx.cam_fd > 0)
        close(ctx.cam_fd);

    //if (ctx.renderer != NULL)
    //    delete ctx.renderer;

    if (ctx.egl_display && !eglTerminate(ctx.egl_display))
        printf("Failed to terminate EGL display connection\n");

    /*if (ctx.conv != NULL)
    {
        if (ctx.conv->isInError())
        {
            printf("Video converter is in error\n");
            error = 1;
        }
        delete ctx.conv;
    }*/

    if (ctx.g_buff != NULL)
    {
        for (unsigned i = 0; i < V4L2_BUFFERS_NUM; i++)
            if (ctx.g_buff[i].dmabuff_fd)
                NvBufferDestroy(ctx.g_buff[i].dmabuff_fd);
        free(ctx.g_buff);
    }

    while(!ctx.conv_output_plane_buf_queue->empty())
    {
        ctx.conv_output_plane_buf_queue->pop();
    }

    delete ctx.conv_output_plane_buf_queue;

    if (error)
        printf("App run failed\n");
    else
        printf("App run was successful\n");

    return -error;
}

int main (void) {
    std::thread encoderThread;
    int dummy = 0;

    encoderThread = std::thread (&main_thread, dummy);
    encoderThread.join();

    return 0;
}

Even though I run with only one camera but with thread it’s easy to see below debug log (rarely seen without thread using)

[ 3373.109569] tegra-vi4 15700000.vi: Status:  5 channel:00 frame:0000
[ 3373.115980] tegra-vi4 15700000.vi:          timestamp sof 3382772358144 eof 3382772625440 data 0x00000001
[ 3373.125637] tegra-vi4 15700000.vi:          capture_id 10502 stream  0 vchan  0

Updated:

And when I started the application, sometime I faced this problem

[ 1454.668726] [vunguyen] ov10635_s_stream, i2c addr: 0x48
[ 1455.681792] tegra-vi4 15700000.vi: PXL_SOF syncpt timeout! err = -11
[ 1456.685754] tegra-vi4 15700000.vi: PXL_SOF syncpt timeout! err = -11
[ 1457.689822] tegra-vi4 15700000.vi: PXL_SOF syncpt timeout! err = -11
[ 1457.699388] [vunguyen] ov10635_s_stream [+] 0
[ 1458.693825] tegra-vi4 15700000.vi: PXL_SOF syncpt timeout! err = -11
[ 1458.700611] [vunguyen] ov10635_s_stream [+] 0
[ 1458.705130] nvcsi 150c0000.nvcsi: csi4_stream_check_status (2) ERROR_STATUS2VI_VC0 = 0x00000004
[ 1458.714026] nvcsi 150c0000.nvcsi: csi4_stream_check_status (2) INTR_STATUS 0x00010006
[ 1458.721967] nvcsi 150c0000.nvcsi: csi4_stream_check_status (2) ERR_INTR_STATUS 0x00010006

Hi Vu,
There is another sample for v4l2 source tegra_multimedia_api\samples\v4l2cuda

Could you also try it?

Hi DaneLLL,

Do you mean tegra_multimedia_api\samples\12_camera_v4l2_cuda ?
I’m working on it.

Thanks
Vu Nguyen

No. I mean v4l2cuda at

tegra_multimedia_api\samples\v4l2cuda

Hi DaneLLL,

It look like working but I want to use Nvidia Video Converter and Video Encoder as well also.

Thanks,
Vu Nguyen

Hi Vu,
Please try to put a delay at

// Push nv_buffer into conv output queue for conversion
            pthread_mutex_lock(&ctx->queue_lock);
            ctx->conv_output_plane_buf_queue->push(&ctx->g_buff[v4l2_buf.index]);
            pthread_cond_broadcast(&ctx->queue_cond);
            pthread_mutex_unlock(&ctx->queue_lock);

<b>usleep(100000);</b>

            // Enqueue camera buff
            // It might be more reasonable to wait for the completion of
            // VIC processing before enqueue current buff. But VIC processing
            // time is far less than camera frame interval, so we probably
            // don't need such synchonization.
            if (ioctl(ctx->cam_fd, VIDIOC_QBUF, &v4l2_buf))
                ERROR_RETURN("Failed to queue camera buffers: %s (%d)",
                        strerror(errno), errno);

It is possible to have race condition between VIC and camera capture here.

Hi DaneLLL,

I tried but after several time running and stop, it still happen as below

[  400.295292] tegra-vi4 15700000.vi:          timestamp sof 409944985632 eof 409961203008 data 0x00000002
[  400.304754] tegra-vi4 15700000.vi:          capture_id 159 stream  2 vchan  0
[  400.311982] tegra-vi4 15700000.vi: Status:  5 channel:02 frame:0000
[  400.318358] tegra-vi4 15700000.vi:          timestamp sof 409965331040 eof 409965509248 data 0x00000004
[  400.327815] tegra-vi4 15700000.vi:          capture_id 194 stream  4 vchan  0
[  400.335047] Unable to handle kernel NULL pointer dereference at virtual address 00000000
[  400.335534] [vunguyen] ov10635_s_stream [+] 0
[  400.336895] [VuNguyen] ov10635_power_off 1918
[  400.350831] [VuNguyen] ov10635_power_off 1918
[  400.356348] pgd = ffffffc0014a5000
[  400.359770] [00000000] *pgd=000000026cdd6003, *pud=000000026cdd6003, *pmd=000000026cdd7003, *pte=00e8000003881707
[  400.370229] Internal error: Oops: 96000005 [#1] PREEMPT SMP
[  400.375792] Modules linked in:
[  400.378852] CPU: 4 PID: 30 Comm: kworker/4:0 Not tainted 4.4.38 #135
[  400.385191] Hardware name: quill (DT)
[  400.385900] [VuNguyen] ov10635_power_off 1918
[  400.393197] Workqueue: events tegra_channel_status_worker
[  400.398606] task: ffffffc1ec633200 ti: ffffffc1ec7c8000 task.ti: ffffffc1ec7c8000
[  400.406088] PC is at vi_notify_channel_reset+0x18/0x88
[  400.411221] LR is at tegra_channel_handle_error+0x5c/0xa0
[  400.416614] pc : [<ffffffc00090a0e4>] lr : [<ffffffc0007a06a0>] pstate: 60000045
[  400.423998] sp : ffffffc1ec7cbcf0
[  400.427309] x29: ffffffc1ec7cbcf0 x28: ffffffc1f5daec18 
[  400.432639] x27: ffffffc1f5daeee0 x26: ffffffc0013bb000 
[  400.437965] x25: 0000000000000000 x24: 0000000000000000 
[  400.443288] x23: ffffffc1f5db4400 x22: 0000000000000001 
[  400.448609] x21: 0000000000000000 x20: ffffffc1ec32d018 
[  400.453930] x19: 0000000000000000 x18: 0000000000000032 
[  400.459250] x17: 0000007f931711f8 x16: ffffffc000b54a60 
[  400.464572] x15: ffffffc000b54a60 x14: 0000000000000001 
[  400.469899] x13: 00000035f8bd1ee4 x12: 000000000006d908 
[  400.475222] x11: 000000000004b3fd x10: 000000000004b3fd 
[  400.480544] x9 : 0000000000000000 x8 : ffffffc1f5d9e570 
[  400.485867] x7 : 0000000000000018 x6 : ffffffc001443510 
[  400.491193] x5 : ffffffc1ec7cbd60 x4 : ffffffc1f5db0200 
[  400.496518] x3 : 0000000000000002 x2 : ffffffc1ec7cbd50 
[  400.501844] x1 : ffffffc1de097000 x0 : 0000000000000001

Sometime it looked more stable if I enable renderer

// Render the frame into display
    if (v4l2_buf->m.planes[0].bytesused)
        ctx->renderer->render(buffer->planes[0].fd);

Thanks
Vu Nguyen

Hi DaneLLL,

After I tried to increase num of v4l2 buffer from 4 to 10, issue gone. Thank for your support.

#define V4L2_BUFFERS_NUM    10                                                                         
#define MAX_QUEUE_BUFER     100

#define INFO(fmt, ...) \
    if (ctx->enable_verbose) \
        printf("INFO: %s(): (line:%d) " fmt "\n", __FUNCTION__, __LINE__, ##__VA_ARGS__);             

#define WARN(fmt, ...) \
        printf("WARN: %s(): (line:%d) " fmt "\n", __FUNCTION__, __LINE__, ##__VA_ARGS__);             

#define CHECK_ERROR(cond, label, fmt, ...) \                                                          
    if (!cond) { \
        error = 1; \
        printf("ERROR: %s(): (line:%d) " fmt "\n", __FUNCTION__, __LINE__, ##__VA_ARGS__); \          
        goto label; \                                                                                 
    }

VuNguyen