From 6bf47e0bfab081b6c1521421af57723bd7ca0df9 Mon Sep 17 00:00:00 2001 From: Robert Mader Date: Wed, 11 Jan 2023 22:48:36 +0100 Subject: [PATCH] pipewiresrc: Always advertise support for DmaBuf Quoting https://docs.pipewire.org/page_dma_buf.html section "v4l2": ``` It's the the responsibility of the producer while the add_buffer event to choose DMA-BUF as the used buffer type even though no modifier is present, if it can guarantee, that the used buffer is mmapable. ``` As Gstreamer internally can mmap dmabufs just fine, support this case. This enables dmabuf support with V4L2 and libcamera. This was also tested against Gnome-Shell, which correctly handles this case and only chooses DmaBuf if the negotiated format has a modifier, i.e. if the Gstreamer peer supports the format with `GST_CAPS_FEATURE_MEMORY_DMABUF`. Fixes 602aa7d541e2d --- src/gst/gstpipewiresrc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gst/gstpipewiresrc.c b/src/gst/gstpipewiresrc.c index 069991158..f023456e0 100644 --- a/src/gst/gstpipewiresrc.c +++ b/src/gst/gstpipewiresrc.c @@ -964,14 +964,14 @@ on_param_changed (void *data, uint32_t id, uint32_t buffers = CLAMP (16, pwsrc->min_buffers, pwsrc->max_buffers); int buffertypes; + buffertypes = (1<caps, 0), GST_CAPS_FEATURE_MEMORY_SYSTEM_MEMORY); gst_caps_features_add (gst_caps_get_features (pwsrc->caps, 0), GST_CAPS_FEATURE_MEMORY_DMABUF); } else { - buffertypes = ((1<caps);