PipeWire shouldn't allocate DMA buffers when spa_data::type is SPA_ID_INVALID
spa_data::type is used to define what type of buffers a client supports. It's described as:
memory type, one of enum spa_data_type, when allocating memory, the type contains a bitmask of allowed types. SPA_ID_INVALID is a special value for the allocator to indicate that the other side did not explicitly specify any supported data types. It should probably use a memory type that does not require special handling in addition to simple mmap/munmap.
DMA buffers sometimes doesn't require any "special handling", but that is by luck, not according to the DMA buffer uapi, which contains the following (from dma-buf.c in the Linux kernel source tree):
There is no special interfaces, userspace simply calls mmap on the dma-buf fd. But like for CPU access there's a need to braket the actual access, which is handled by the ioctl (DMA_BUF_IOCTL_SYNC). Note that DMA_BUF_IOCTL_SYNC can fail with -EAGAIN or -EINTR, in which case it must be restarted.
Thus, DMA buffers require "special handling".
However, as far as I can tell, both the v4l2 and libcamera and source nodes does not respect this. An application would, given the documentation of
spa_data::type, correctly interpret this as not having to deal with DMA buffer SYNC ioctls, if
SPA_ID_INVALID was used, which is not correct.