mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	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 602aa7d541
			
			
This commit is contained in:
		
							parent
							
								
									17c53577e8
								
							
						
					
					
						commit
						6bf47e0bfa
					
				
					 1 changed files with 2 additions and 2 deletions
				
			
		| 
						 | 
					@ -964,14 +964,14 @@ on_param_changed (void *data, uint32_t id,
 | 
				
			||||||
    uint32_t buffers = CLAMP (16, pwsrc->min_buffers, pwsrc->max_buffers);
 | 
					    uint32_t buffers = CLAMP (16, pwsrc->min_buffers, pwsrc->max_buffers);
 | 
				
			||||||
    int buffertypes;
 | 
					    int buffertypes;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    buffertypes = (1<<SPA_DATA_DmaBuf);
 | 
				
			||||||
    if (spa_pod_find_prop (param, NULL, SPA_FORMAT_VIDEO_modifier)) {
 | 
					    if (spa_pod_find_prop (param, NULL, SPA_FORMAT_VIDEO_modifier)) {
 | 
				
			||||||
      buffertypes = (1<<SPA_DATA_DmaBuf);
 | 
					 | 
				
			||||||
      gst_caps_features_remove (gst_caps_get_features (pwsrc->caps, 0),
 | 
					      gst_caps_features_remove (gst_caps_get_features (pwsrc->caps, 0),
 | 
				
			||||||
          GST_CAPS_FEATURE_MEMORY_SYSTEM_MEMORY);
 | 
					          GST_CAPS_FEATURE_MEMORY_SYSTEM_MEMORY);
 | 
				
			||||||
      gst_caps_features_add (gst_caps_get_features (pwsrc->caps, 0),
 | 
					      gst_caps_features_add (gst_caps_get_features (pwsrc->caps, 0),
 | 
				
			||||||
          GST_CAPS_FEATURE_MEMORY_DMABUF);
 | 
					          GST_CAPS_FEATURE_MEMORY_DMABUF);
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
      buffertypes = ((1<<SPA_DATA_MemFd) | (1<<SPA_DATA_MemPtr));
 | 
					      buffertypes |= ((1<<SPA_DATA_MemFd) | (1<<SPA_DATA_MemPtr));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    GST_DEBUG_OBJECT (pwsrc, "we got format %" GST_PTR_FORMAT, pwsrc->caps);
 | 
					    GST_DEBUG_OBJECT (pwsrc, "we got format %" GST_PTR_FORMAT, pwsrc->caps);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue