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

@ -0,0 +1,40 @@
/* PipeWire */
/* SPDX-FileCopyrightText: Copyright © 2025 Red Hat */
/* SPDX-License-Identifier: MIT */
#ifndef PIPEWIRE_CAPABILITIESS_H
#define PIPEWIRE_CAPABILITIESS_H
#include <pipewire/utils.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* \defgroup pw_capabilities Capability Names
*
* A collection of capabilities that can be advertised by end points in
* streams.
*
* \addtogroup pw_capabilities
* \{
*/
/**< Link capable of device ID negotiation. The value is either "true" or "false" */
#define PW_CAPABILITY_DEVICE_ID_NEGOTIATION "pipewire.device-id-negotiation"
/**< Link with device ID negotition capability supports negotiating with
* provided list of devices. The value consists of a JSON encoded string array
* of base64 encoded dev_t values. */
#define PW_CAPABILITY_DEVICE_IDS "pipewire.device-ids"
#define PW_CAPABILITY_DEVICE_ID "pipewire.device-id" /**< Link capable of device Id negotation */
/** \}
*/
#ifdef __cplusplus
}
#endif
#endif /* PIPEWIRE_CAPABILITIES_H */

View file

@ -45,6 +45,7 @@ pipewire_headers = [
'type.h',
'utils.h',
'work-queue.h',
'capabilities.h',
]
pipewire_sources = [