umlaeute / v4l2loopback

v4l2-loopback device
GNU General Public License v2.0
3.71k stars 529 forks source link

[feature request] Support V4L2_MEMORY_DMABUF #501

Open daijh opened 2 years ago

daijh commented 2 years ago

Ask V4L2_MEMORY_DMABUF feature support in v4l2loopback. It could be helpful for hardware accelerator usage, e.g. GL and HW encoder.

daijh commented 2 years ago

WIP a POC to implement this feature. Will submit PR for review soon.

chrisiberg commented 1 year ago

Something new on this? Would be great to connect in gst to a vaapidecoder with "v4l2sink io-mode=dmabuf-import" !

daijh commented 1 year ago

Sorry for late reply. I had an under-development (buggy and limitation) driver which is able to accept dmabuf import. It changes a few things over original driver.

It may need ~3 week to cleanup for experiment usage.

chrisiberg commented 1 year ago

Would be great, can't await to test!

umlaeute commented 1 year ago

afaic the lack of support for V4L2_MEMORY_DMABUF is the reason why people cannot use the proprietary nvcamerasrc for nVidia's Tegra/Jetson platform (which depends on V4L2_MEMORY_DMABUF)

activey commented 1 year ago

Yeah, it would be great to have it because of #128

chrisiberg commented 1 year ago

Did someone try daijh expbuf-dmabuf? https://github.com/daijh/v4l2loopback/tree/expbuf-dmabuf

I had no luck with it, error compiling in yocto with kernel 5.15.94

v4l2loopback.c:3593:28: error: storage size of 'map' isn't known | 3593 | struct dma_buf_map map;

daijh commented 1 year ago

Did someone try daijh expbuf-dmabuf? https://github.com/daijh/v4l2loopback/tree/expbuf-dmabuf

I had no luck with it, error compiling in yocto with kernel 5.15.94

v4l2loopback.c:3593:28: error: storage size of 'map' isn't known | 3593 | struct dma_buf_map map;

I am glad to hear that you are interested in the expbuf-dmabuf repo. It has been verified to work on Intel MIPI cameras, and probably with USB camera,

It required significant changes to the original v4l2loopback code, making it difficult to backport.

May I know how you plan to use expbuf-dmabuf?

chrisiberg commented 1 year ago

@daijh My plans are to use it for RTSP and NDI streams, decode it via VAAPI to view it in chromium with low latency. It's now working without DMA but is limited in resolution because of the high CPU usage, without DMA I just can use SW-decoding. Is it possible to connect to Intel VAAPI with DMA, or is it just limited to devices as input?

daijh commented 1 year ago

Could you share if any GStreamer command? I could do some experiment on it.

ksquen commented 3 months ago

hi @daijh,

I'm currently use your version of v4l2loopback expbuf-dmabuf with gstreamer.

I can't use this pipeline to use as producer like in the wiki: gst-launch-1.0 videotestsrc ! v4l2sink device=/dev/video1 . Maybe it only support vma ? But ffmpeg use ok ( ffmpeg -re -i h264-hd-30.mp4 -f v4l2 /dev/video3 ) Can you give me some examples on what you use it for and how to use it.

Thanks.