Jan Grulich e1e05afec7 Reland "PipeWire capturer: implement proper DMA-BUFs support""
This is a reland of f2177f6612079ccce9c320ea7e77bc934c684f5c

Original change's description:
> PipeWire capturer: implement proper DMA-BUFs support
>
> Currently both KWin (KDE) and Mutter (GNOME) window managers don't
> use DMA-BUFs by default, but only when client asks specifically for
> them (KWin) or when experimental DMA-BUF support is enabled (Mutter).
> While current implementation works just fine on integrated graphics
> cards, it causes issues on dedicated GPUs (AMD and NVidia) where the
> code either crashes or screensharing is slow and unusable.
>
> To fix this, DMA-BUFs has to be opened using OpenGL context and not
> being directly mmaped(). This implementation requires to use DMA-BUF
> modifiers, as they are now mandatory for DMA-BUFs usage.
>
> Documentation for this behavior can be found here:
> https://gitlab.freedesktop.org/pipewire/pipewire/-/blob/master/doc/dma-buf.dox
>
> Bug: chromium:1233417
> Change-Id: I0cecf16d6bb0f576954b9e8f071cab526f7baf2c
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/227022
> Commit-Queue: Tommi <tommi@webrtc.org>
> Reviewed-by: Tommi <tommi@webrtc.org>
> Reviewed-by: Erik Språng <sprang@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#34889}

Bug: chromium:1233417
Change-Id: I308501d86ec18ab6df9bcee569c4b72df7926549
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/231180
Reviewed-by: Erik Språng <sprang@webrtc.org>
Reviewed-by: Tommi <tommi@webrtc.org>
Commit-Queue: Tommi <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35152}
2021-10-06 10:31:51 +00:00

48 lines
2.0 KiB
Plaintext

// Copyright 2018 The WebRTC project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//------------------------------------------------
// Functions from PipeWire used in capturer code.
//------------------------------------------------
// core.h
int pw_core_disconnect(pw_core *core);
// loop.h
void pw_loop_destroy(pw_loop *loop);
pw_loop * pw_loop_new(const spa_dict *props);
// pipewire.h
void pw_init(int *argc, char **argv[]);
const char* pw_get_library_version();
// properties.h
pw_properties * pw_properties_new_string(const char *args);
// stream.h
void pw_stream_add_listener(pw_stream *stream, spa_hook *listener, const pw_stream_events *events, void *data);
int pw_stream_connect(pw_stream *stream, enum pw_direction direction, uint32_t target_id, enum pw_stream_flags flags, const spa_pod **params, uint32_t n_params);
pw_buffer *pw_stream_dequeue_buffer(pw_stream *stream);
void pw_stream_destroy(pw_stream *stream);
pw_stream * pw_stream_new(pw_core *core, const char *name, pw_properties *props);
int pw_stream_queue_buffer(pw_stream *stream, pw_buffer *buffer);
int pw_stream_set_active(pw_stream *stream, bool active);
int pw_stream_update_params(pw_stream *stream, const spa_pod **params, uint32_t n_params);
// thread-loop.h
void pw_thread_loop_destroy(pw_thread_loop *loop);
pw_thread_loop * pw_thread_loop_new(const char *name, const spa_dict *props);
int pw_thread_loop_start(pw_thread_loop *loop);
void pw_thread_loop_stop(pw_thread_loop *loop);
void pw_thread_loop_lock(pw_thread_loop *loop);
void pw_thread_loop_unlock(pw_thread_loop *loop);
pw_loop * pw_thread_loop_get_loop(pw_thread_loop *loop);
// context.h
void pw_context_destroy(pw_context *context);
pw_context *pw_context_new(pw_loop *main_loop, pw_properties *props, size_t user_data_size);
pw_core * pw_context_connect(pw_context *context, pw_properties *properties, size_t user_data_size);
pw_core * pw_context_connect_fd(pw_context *context, int fd, pw_properties *properties, size_t user_data_size);