AnsweredAssumed Answered

v4l2src lost frames detected when using imxcompositor_g2d on i.MX8MMini

Question asked by JP Arnaud on Nov 22, 2019
Latest reply on Jan 9, 2020 by JP Arnaud

I am experimenting with imxcompositor_g2d in order to overlay some text in an RTP pipeline but as soon as it is linked together with the v4l2src, the v4l2src element drops frames and prints "lost frames detected".

 

I'd like to use the hardware acceleration for the overlay as the textoverlay element consumes too much CPU and ditto for the compositor element.

 

I have boiled down the problem to the following very simple GStreamer pipeline:

imxcompositor_g2d name=c ! video/x-raw,format=RGB16,width=1920,height=1080 ! fakevideosink sync=false async=true enable-last-sample=false v4l2src ! c.sink_0

 

This is running on an i.MX8M Mini.

 

The CPU usage is pretty low, around 7%. Profiling the app shows that the following functions are using up most of the CPU:

  • __pi___inval_dcache_area
  • __pi___clean_dcache_area_poc
  • _raw_spin_unlock_irqrestore

And an example of the callstack is below (taken from perf).

 

I'm guessing I'm doing something seriously wrong here as otherwise the imxcompositor_g2d would be unusable.

 

If I replace the imxcompositor_g2d with the compositor element, the CPU usage goes to 80%, but the v4l2 does not report dropped frames.

 

84.01%     0.00%  comp:src        libglib-2.0.so.0.5400.3           [.] g_thread_proxy
            |
            ---g_thread_proxy
               g_thread_pool_thread_proxy
               default_func
               gst_task_func
               |          
                --83.78%--gst_aggregator_aggregate_func
                          |          
                          |--81.03%--gst_video_aggregator_aggregate
                          |          |          
                          |          |--72.52%--gst_imxcompositor_aggregate_frames
                          |          |          |          
                          |          |          |--36.69%--imx_g2d_fill_color
                          |          |          |          |          
                          |          |          |          |--33.24%--__GI___ioctl
                          |          |          |          |          |          
                          |          |          |          |           --33.16%--__sys_trace_return
                          |          |          |          |                     sys_ioctl
                          |          |          |          |                     |          
                          |          |          |          |                      --33.10%--do_vfs_ioctl
                          |          |          |          |                                dma_buf_ioctl
                          |          |          |          |                                |          
                          |          |          |          |                                |--13.44%--dma_buf_map_attachment
                          |          |          |          |                                |          ion_map_dma_buf
                          |          |          |          |                                |          __pi___clean_dcache_area_poc
                          |          |          |          |                                |          
                          |          |          |          |                                |--13.00%--dma_buf_unmap_attachment
                          |          |          |          |                                |          ion_unmap_dma_buf
                          |          |          |          |                                |          |          
                          |          |          |          |                                |           --12.93%--__pi___inval_dcache_area
                          |          |          |          |                                |          
                          |          |          |          |                                 --6.11%--arch_setup_dma_ops
                          |          |          |          |                                           |          
                          |          |          |          |                                            --6.04%--of_find_compatible_node
                          |          |          |          |                                                      _raw_spin_unlock_irqrestore

Outcomes