This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM62P: How to use DMA for video stream transmission

Part Number: AM62P

Hi,

We are capturing video streams on the AM62P platform. However, when transmitting 4 video streams simultaneously, the CPU usage is extremely high and nearly fully occupied. Therefore, we intend to use DMA for video stream transmission to free up CPU resources. Could you advise on how to configure the underlying device tree and driver?

  • Hi Ying,

    Can you please clarify what the media pipeline looks like and what part of the transmission are you trying to offload to the DMA?

    Also, please share if you are using any framework like GStreamer or TIOVX?

    Regards,
    Jay

  • Hi Jay,

    I originally used the following command to acquire video stream data:

    gst-launch-1.0 \
    v4l2src device=/dev/video-imx219-cam%d io-mode=mmap !
    video/x-raw, width=1280, height=960, format=UYVY !
    appsink

    However, when acquiring 4 video streams simultaneously, the CPU usage is extremely high. Therefore, I attempted to use DMA for transmission with the following command:

    gst-launch-1.0 \
      v4l2src device=/dev/video0 io-mode=dmabuf-import ! \
      video/x-raw, width=1280, height=960, format=UYVY ! \
      videoconvert ! \
      appsink

    Unfortunately, this resulted in an error (details below). Could you please help me figure out how to optimize this setup to reduce CPU utilization and free up CPU resources? Thanks!

    root@am62pxx-evm:~# gst-launch-1.0   v4l2src device=/dev/video3 io-mode=dmabuf-import !   video/x-raw, width=1280, height=960, format=UYVY !   videoconvert !   appsink
    Setting pipeline to PAUSED ...
    Pipeline is live and does not need PREROLL ...
    Pipeline is PREROLLED ...
    Setting pipeline to PLAYING ...
    New clock: GstSystemClock
    ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: No downstream pool to import from.
    Additional debug info:
    /usr/src/debug/gstreamer1.0-plugins-good/1.22.12/sys/v4l2/gstv4l2object.c(5471): gst_v4l2_object_decide_allocation (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
    When importing DMABUF or USERPTR, we need a pool to import from
    ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Internal data stream error.
    Execution ended after 0:00:00.003532110
    Setting pipeline to NULL ...
    Additional debug info:
    /usr/src/debug/gstreamer1.0/1.22.12/libs/gst/base/gstbasesrc.c(3134): gst_base_src_loop (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
    streaming stopped, reason not-negotiated (-4)
    Freeing pipeline ...
    

    Regards

  • Hi Ying,

    What input and output formats are you trying to use? I don't see any caps negotiation after videoconvert? The actual transfer of data from camera to the device should be using DMA. Can you tell me if you are triggering memcopy in the application after the appsink? You can also try benchmarking with a fakesink to see if the issue is from the v4l2src node.

    Regards,
    Jay