Commit Graph

14 Commits

Author SHA1 Message Date
Derek Foreman
f07af89f9c libweston: Move output damage subtraction out of backends
Right now every backend clears output damage from the primary plane when
it repaints. Instead of having this same operation spread across all
the backends, just do it in the core instead.

In the future, we want to remove damage tracking from the primary plane
entirely, and this is a small step in that direction.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-07-11 07:26:43 -05:00
Philipp Zabel
90c11cf40e libweston: move weston_compositor_shutdown call out of backends
If we want to support multiple backends, the compositor must take care
to call this once, at the appropriate moment, so stop letting the
backends handle compositor shutdown themselves.

Move the weston_compositor_shutdown() calls from the backend::destroy
callbacks into weston_compositor_destroy() and the calls in the backend
creation error paths into weston_compositor_load_backend().

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-06-27 12:09:47 +01:00
Philipp Zabel
5b1974fa4f backend-pipewire: add GL renderer support
While the GL renderer is not able to directly render into the PipeWire buffers,
it is possible to read the rendered frame from the fbo into the PipeWire buffer.

Use the automatic download to add support for the GL renderer to the PipeWire
backend.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
2023-06-13 13:02:12 +00:00
Michael Tretter
a9d1b5dc50 backend-pipewire: make renderer initialization depend on renderer
Instead of always initializing the Pixman renderer, make the initialization
dependent on the selected renderer. This makes it easier to add other renderers.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
2023-06-13 13:02:12 +00:00
Michael Tretter
1effba000e backend-pipewire: add local variables for spa_buffer and data
Make it easier to understand where ptr points to by using local variables for
the spa_buffer and spa_data.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
2023-06-13 13:02:12 +00:00
Michael Tretter
b5854ff95d backend-pipewire: move pixman renderbuffer creation to helper
Extract the pixman renderbuffer configuration from the add_buffer function into
a helper function to simplify the addition of the GL renderer.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
2023-06-13 13:02:12 +00:00
Michael Tretter
7155d00929 backend-pipewire: move pixman setup into helper functions
Use helper function for setting up the pixman renderer to simplify the addition
of the GL renderer.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
2023-06-13 13:02:12 +00:00
Michael Tretter
8cf4d79be7 backend-pipewire: remove unused fields from pipewire_frame_data
The output and buffer fields of pipewire_frame_the data are not actually used.
Remove them.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
2023-05-23 10:41:25 +02:00
Michael Tretter
6c20bc5333 backend-pipewire: remove duplicate empty line
There was a sneaky newline. Remove it.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
2023-05-23 10:41:00 +02:00
Philipp Zabel
f154fbba97 libweston: consolidate 'Using GL/Pixman renderer' log message
Consolidates the 'Using GL/Pixman renderer' message emitted by the
PipeWire, RDP, VNC, and X11 backends by moving the weston_log() into
weston_compositor_init_renderer(). Only print the message after
initializing the renderer has succeeded.

This effectively adds the message to the DRM, headless, and Wayland
backends.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-05-04 14:47:49 +02:00
Robert Mader
445ff6728b pipewire-[backend|plugin]: Add timestamps to buffers
In Pipewire and Gstreamer terminology Weston is a "live" source (as we
do not explicitly set PW_KEY_STREAM_IS_LIVE to false).
Such sources, be it compositors, cameras or microphones, usually set
the current system time as timestamps on buffers in order to make life
easier for consumers. Thus let's do so as well.

This notably helps when recording using `gstpipewiresrc` with the
`keepalive-time` property set.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2023-04-20 12:32:49 +00:00
Philipp Zabel
2d3e170955 backend-pipewire: remove linear modifier for now
As of PipeWire version 0.3.69, the gstpipewiresrc element uses the
existence of a modifier as a trigger to select dmabuf memory, failing
caps negotiation as we don't send DMA buffers yet.

Remove the linear modifier for now, to be added back when we add dmabuf
support to the PipeWire backend. This allows testing the PipeWire
backend with current GStreamer + PipeWire.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-04-19 13:56:44 +00:00
Philipp Zabel
dfa821d4c0 backend-pipewire: pass backend to weston_pipewire_output_api::create_head()
Pass the backend instead of the compositor to the PipeWire output API
create_head() method and increment the API version.

That way the backend will not have to find the backend pointer from the
compositor. This is trivial now, but in the multi-backend case would
entail iterating over all backends to find the correct one.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-04-19 13:36:45 +00:00
Philipp Zabel
ebc3a22b09 backend-pipewire: add PipeWire backend
Add a separate PipeWire backend based on the PipeWire plugin. The backend
requires PipeWire 0.3.x.

The PipeWire backend can be used as a standalone-backend backend for streaming
and composing Wayland clients to PipeWire.

The backend supports the on-demand creation of heads via the
weston_pipewire_output_api_v1. It also supports per-output pixel format
configuration via a gbm-format option.

Multiple PipeWire outputs can be created by setting the num-outputs option in
the [pipewire] section.

Co-authored-by: Michael Tretter <m.tretter@pengutronix.de>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
2023-04-18 10:48:50 +00:00