mirror of
https://gitlab.freedesktop.org/wayland/weston.git
synced 2025-12-20 04:40:07 +01:00
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>
This commit is contained in:
parent
9e070c0840
commit
dfa821d4c0
2 changed files with 11 additions and 11 deletions
|
|
@ -33,7 +33,7 @@ extern "C" {
|
|||
#include <libweston/libweston.h>
|
||||
#include <libweston/plugin-registry.h>
|
||||
|
||||
#define WESTON_PIPEWIRE_OUTPUT_API_NAME "weston_pipewire_output_api_v1"
|
||||
#define WESTON_PIPEWIRE_OUTPUT_API_NAME "weston_pipewire_output_api_v2"
|
||||
|
||||
struct pipewire_config {
|
||||
int32_t width;
|
||||
|
|
@ -44,13 +44,13 @@ struct pipewire_config {
|
|||
struct weston_pipewire_output_api {
|
||||
/** Create a new PipeWire head.
|
||||
*
|
||||
* \param compositor The compositor instance.
|
||||
* \param backend The backend.
|
||||
* \param name Desired name for the new head
|
||||
* \param config The pipewire_config of the new head.
|
||||
*
|
||||
* Returns 0 on success, -1 on failure.
|
||||
*/
|
||||
void (*head_create)(struct weston_compositor *compositor,
|
||||
void (*head_create)(struct weston_backend *backend,
|
||||
const char *name,
|
||||
const struct pipewire_config *config);
|
||||
|
||||
|
|
|
|||
|
|
@ -150,9 +150,9 @@ pipewire_output_debug(struct pipewire_output *output, const char *fmt, ...)
|
|||
}
|
||||
|
||||
static inline struct pipewire_backend *
|
||||
to_pipewire_backend(struct weston_compositor *base)
|
||||
to_pipewire_backend(struct weston_backend *base)
|
||||
{
|
||||
return container_of(base->backend, struct pipewire_backend, base);
|
||||
return container_of(base, struct pipewire_backend, base);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -535,10 +535,10 @@ pipewire_destroy(struct weston_backend *base)
|
|||
}
|
||||
|
||||
static void
|
||||
pipewire_head_create(struct weston_compositor *compositor, const char *name,
|
||||
pipewire_head_create(struct weston_backend *backend, const char *name,
|
||||
const struct pipewire_config *config)
|
||||
{
|
||||
struct pipewire_backend *b = to_pipewire_backend(compositor);
|
||||
struct pipewire_backend *b = to_pipewire_backend(backend);
|
||||
struct pipewire_head *head;
|
||||
struct weston_head *base;
|
||||
|
||||
|
|
@ -554,7 +554,7 @@ pipewire_head_create(struct weston_compositor *compositor, const char *name,
|
|||
base->backend = &b->base;
|
||||
|
||||
weston_head_set_connection_status(base, true);
|
||||
weston_compositor_add_head(compositor, base);
|
||||
weston_compositor_add_head(b->compositor, base);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -885,7 +885,7 @@ err_loop:
|
|||
}
|
||||
|
||||
static void
|
||||
pipewire_backend_create_outputs(struct weston_compositor *compositor,
|
||||
pipewire_backend_create_outputs(struct pipewire_backend *backend,
|
||||
int num_outputs)
|
||||
{
|
||||
char name[32] = "pipewire";
|
||||
|
|
@ -894,7 +894,7 @@ pipewire_backend_create_outputs(struct weston_compositor *compositor,
|
|||
for (i = 0; i < num_outputs; i++) {
|
||||
if (num_outputs > 1)
|
||||
snprintf(name, sizeof name, "pipewire-%u", i);
|
||||
pipewire_head_create(compositor, name, &default_config);
|
||||
pipewire_head_create(&backend->base, name, &default_config);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -951,7 +951,7 @@ pipewire_backend_create(struct weston_compositor *compositor,
|
|||
pixel_format_get_info(DRM_FORMAT_XRGB8888),
|
||||
&backend->pixel_format);
|
||||
|
||||
pipewire_backend_create_outputs(compositor, config->num_outputs);
|
||||
pipewire_backend_create_outputs(backend, config->num_outputs);
|
||||
|
||||
return backend;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue