SK-AM62P-LP: How to ensure that the gstbuf output by the decoder must be DMA buf in the kmscube use case?

Part Number: SK-AM62P-LP
Other Parts Discussed in Thread: AM62P

Tool/software:

As the title says, when executing the VIDEO branch of the kmscube use case, the output gstbuf from the decoder module may not be a dma buf. To reproduce this, add the following print statement to the buffer_to_image function in gst-decoder.c, then execute the VIDEO branch of kmscube on the development board, and observe the print output to determine the status of the gst buf.

	if (is_dmabuf_mem) {
		dmabuf_fd = dup(gst_dmabuf_memory_get_fd(mem));
		printf("is dmabuf\n");
	} else {
		GstMapInfo map_info;
		gst_buffer_map(buf, &map_info, GST_MAP_READ);
		dmabuf_fd = buf_to_fd(dec->gbm, map_info.size, map_info.data);
		gst_buffer_unmap(buf, &map_info);
		printf("not dmabuf\n");
	}

  • The background of the research on this issue is that our camera has a resolution of 1920x1536 and a YUV format. When the gst buf is not a DMA buf, the time consumed for value copying is 50ms, which is unacceptable.
    Therefore, some other questions I would like to ask are:
    1. Under what circumstances will the gst buf of the gst capture video frame not be a dma buf? Is there any way to avoid this?

    2. In the V4L2 node of the gst, is there a way to set the gst buf to be a DMA buf?

    3. What other operations can ensure zero-copy loading of image data from gst to egl?

    4. If the above problems cannot be solved, what are the ways to speed up the value copying operation?

  • Hi Quan Li,

    Assuming that you are using AM62P for testing your experiments.

    In the first query, you are talking about decoder and the second one talks about camera capture. 

    On AM62P we have a hardware accelerator that does decoding in both H.264/H.265 video formats.  (GStreamer element for encode/decode are v4l2h264enc/v4l2h264dec resp.) When running kmscube, are you sure its taking this decoder or vp9 (that does decoding in software and doesn't use dma buf) . 

    Also on camera capture, you can try and run this sample pipeline and see if it helps:

    gst-launch-1.0 -v v4l2src device=/dev/video2 io-mode=dmabuf-import ! video/x-raw, format=UYVY, width=1920, height=1080, framerate=30/1 ! ticolorconvert ! video/x-raw, format=NV12, width=1920, height=1080 !  v4l2h264enc ! filesink location=test.264. 

    Best Regards,

    Suren