stream: Add DRM device negotiation

A DMA buffer from a DRM device are typically accessed using API related
to a DRM device, e.g. Vulkan or EGL. To create such a context for using
with a PipeWire stream that passed DRM device DMA buffers applications
have so far usually guessed or made use of the same context as the
stream content will be presented. This has mostly been the Wayland
EGL/Vulkan context, and while this has most of the time worked, it's
somewhat by accident, and for reliable operation, PipeWire must be aware
of what DRM device a DMA buffer should be accessed using.

To address this, introduce device ID negotation, allowing sources and
sinks to negotiate what DRM device is supported, and what formats and
modifiers are supported by them.

This will allow applications to stop relying on luck or the windowing
system to figure out how to access the DMA buffers. It also paves the
way for being able to use multiple GPUs for different video streams,
depending on what the sources and sinks support.
This commit is contained in:
Jonas Ådahl 2025-11-11 11:02:47 +01:00 committed by Wim Taymans
parent e615f17573
commit 58b958860e
5 changed files with 153 additions and 0 deletions

View file

@ -181,6 +181,8 @@ static const struct spa_type_info spa_type_format[] = {
{ SPA_FORMAT_VIDEO_H264_alignment, SPA_TYPE_Id, SPA_TYPE_INFO_FORMAT_VIDEO_H264_BASE "alignment", NULL },
{ SPA_FORMAT_CONTROL_types, SPA_TYPE_Id, SPA_TYPE_INFO_FORMAT_CONTROL_BASE "types", spa_type_control },
{ SPA_FORMAT_VIDEO_deviceId, SPA_TYPE_Bytes, SPA_TYPE_INFO_FORMAT_BASE "deviceId", NULL },
{ 0, 0, NULL, NULL },
};

View file

@ -144,6 +144,7 @@ enum spa_format {
SPA_FORMAT_VIDEO_H264_alignment, /**< (Id enum spa_h264_alignment) */
SPA_FORMAT_VIDEO_H265_streamFormat, /**< (Id enum spa_h265_stream_format) */
SPA_FORMAT_VIDEO_H265_alignment, /**< (Id enum spa_h265_alignment) */
SPA_FORMAT_VIDEO_deviceId, /**< dev_t identifier (Bytes) */
/* Image Format keys */
SPA_FORMAT_START_Image = 0x30000,