Commit Graph

852 Commits

Author SHA1 Message Date
Marius Vlad 73138a1943 compositor/main: put remoting/pipewire outputs to the right
Similar to what we have to all other backends/outputs, do the same
for the remoting/pipewire plug-ins and align them to the right.

This way we can move the plug-ins loading after
weston_compositor_flush_heads_changed(), much closer to the other module
loading which seems a more suitable place.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2023-10-12 15:27:30 +03:00
Marius Vlad df493400c1 compositor/main: Re-work plug-in loading to avoid an invalid color manager
Rather than loading the plug-ins when loading the DRM backend, do that
after *all* the other backends have been loaded, and after we made sure
we have at least a no-op color manager.

As the plug-ins enable the outputs on their own this has the side-effect
of enabling the output without having any color manager set-up at that
time.  Moving the plug-in loading a bit later ensures that we have one
set-up (a no-op one).

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2023-10-12 15:27:06 +03:00
Philipp Zabel d1df848d94 compositor, backend-vnc: Allow to disable output resizing
In some use cases the VNC client should not be allowed to resize the VNC
output. Add a boolean option "resizeable" in the VNC [output] section to
control this.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-10-05 11:43:12 +02:00
Marek Vasut bd3de08b13 backend-drm: document additional-devices parameter
Document the --additional-devices parameter to Weston to add secondary
DRM devices that will only be used as outputs, but not for rendering.

Fixes: 3c6cfe6bf4 ("backend-drm: add additional-devices to support multi GPU")
Signed-off-by: Marek Vasut <marex@denx.de>
2023-10-03 12:29:21 +00:00
Philipp Zabel a4f0666659 libweston, compositor: let weston_compositor_load_backend return backend
Let weston_compositor_load_backend() return a backend pointer and remove
the backend pointer from struct weston_compositor.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-09-28 14:02:04 +00:00
Philipp Zabel efe9707ef2 compositor: enable loading multiple backends
Add a new --backends command line option and a backends option to the
configuration file that both take a comma-separated list of backends,
similar to the modules option.
The first backend is the primary backend and provides the renderer.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-09-28 14:02:04 +00:00
Philipp Zabel 69679b271f compositor: per-backend head change listener and output configurator
When multiple backends are loaded simultaneously, they all have
to register their own head change notification listener and
output configuration callback.

To avoid calling output configuration for heads created by other
backends, only iterate over heads that were created from the given
backend by comparing the weston_head::backend pointer to the one
stored in the head change notification listener.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-09-28 14:02:04 +00:00
Philipp Zabel 1d59530e4b libweston: Set the presentation clock in the compositor
Let backends declare the presentation clocks they can use with a
new bitfield weston_backend::supported_presentation_clocks and set
presentation clock after loading the backend in the compositor.

Make weston_compositor_set_presentation_clock() internal and replace
weston_compositor_set_presentation_clock_software() with an exported
weston_compositor_backends_loaded(), which is called by the compositor
after the backend is loaded.

In the future, this can be extended to determine the subset of clocks
supported by all backends.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-08-02 11:51:56 +03:00
Daniel Stone 4a26a28682 frontend: Fix build error when Xwayland disabled
Add another wrapper so we can build with -Dxwayland=false.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Fixes: 388702c181 ("frontend: Explicitly destroy Xwayland from frontend code")
Closes: wayland/weston#779
2023-07-18 11:44:11 +01:00
Philipp Zabel 19a715b348 frontend: Add tls-cert and tls-key config options
Add tls-cert and tls-key config options in the [rdp] and [vnc] sections
in weston.ini. This allows to statically configure the TLS key and
certificate files instead of requiring them to be supplied via command
line arguments.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-07-14 10:45:25 +00:00
Daniel Stone 386dcd904f build: Switch join_paths(foo, bar) to foo / bar
Available since Meson 0.49.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-22 14:31:57 +01:00
Michael Tretter 914be30bc0 backend-drm: change default for required-outputs to any
On a desktop system, the expected behavior during a Weston start is that if any
monitor can be enabled, Weston starts up and enables the monitor. Outputs that
could not be enabled, stay disabled. This helps the user in debugging the failed
outputs.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
2023-06-20 19:46:11 +00:00
Michael Tretter 20508c148e backend-drm: add config option require-outputs
If Weston fails to configure a DRM output for whatever reason, it will fail to
start. Depending on the use-case, this may or may not be the correct behavior.

Add the "require-outputs" option to allow configuring the error behavior on
missing outputs.

Add documentation of the possible options to the man page.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
2023-06-20 19:46:11 +00:00
Michael Tretter 98e398e78b backend-drm: print failing output in error message
Print the name of the failing output to help debugging.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
2023-06-20 19:46:11 +00:00
Daniel Stone 2896a0e9ab text-backend: Don't restart client on exit
When we're shutting down, don't try to restart the IM client.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-19 21:32:47 +01:00
Daniel Stone 52987b0354 frontend: Clean up wet_processes on exit
When we exit, clean up any process we launched.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-19 21:32:47 +01:00
Daniel Stone 388702c181 frontend: Explicitly destroy Xwayland from frontend code
Currently Xwayland is cleaned up by a destroy listener. The problem with
this is that this is true for both libweston's Xwayland support as well
as the frontend's.

Add an explicit destroy step to Xwayland frontend which will cleanly
destroy the process as well as any other resources.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-19 21:32:47 +01:00
Daniel Stone 10f6b99ac0 frontend: Return user-data pointer from Xwayland init
Return a void * from wet_load_xwayland, so we can later pass it back to
explicitly call the cleanup.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-19 21:32:47 +01:00
Daniel Stone 104676ec1f xwayland: Remove process exit status from libweston API
This shouldn't be relevant to the core.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-19 21:32:47 +01:00
Daniel Stone e64232a808 xwayland: Only pass Xwayland wl_client to libweston
Remove all handling of process/PID internals from libweston's Xwayland
launcher, and keep this only in the frontend. libweston now only sees
the wl_client and nothing else.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-19 21:32:47 +01:00
Daniel Stone d5bcc26078 frontend: Factor out wet_process_destroy
Reuse the body of the process cleanup as a separate function.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-19 21:32:47 +01:00
Daniel Stone 991b3fb2e0 frontend: Inline process_handle_sigchld
Now that we have wet_process everywhere, print out the process exit
status in the main handler.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-19 21:32:47 +01:00
Daniel Stone 9a7c88c2e9 frontend: Make wet_client_launch allocate new wet_process
Every time we call wet_client_launch, we now allocate a new wet_process,
which is always cleaned up by the compositor core and not by the users.
In doing this, weston_client_launch is renamed to wet_client_launch,
since wet_ is for the frontend and weston_ is for libweston.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-19 21:32:47 +01:00
Daniel Stone 31dcd987a6 frontend: Allocate new wet_process for Xwayland
Instead of reusing an inline wet_process struct, allocate a new
wet_process every time we go to launch Xwayland.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-19 21:32:47 +01:00
Daniel Stone a72d0c1bb0 frontend: Allow NULL wet_process cleanup handler
Don't call cleanup if we haven't been given anything to call.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-19 21:32:47 +01:00
Daniel Stone c2cd15ed11 frontend: Add data argument to wet_process cleanup
wet_process provides a cleanup function which can be called, but only
passes the process itself. This relies on the process struct being
inlined in something else meaningful, and means that we can't allocate
them on demand.

Add a 'data' argument which allows users to pass meaningful data to
their cleanup handler.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-19 21:32:47 +01:00
Daniel Stone abe893d8ea frontend: Rename weston_client_start to wet_client_start
It's not libweston, so it shouldn't be weston_.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-19 21:32:47 +01:00
Daniel Stone 348465cd7a frontend: Inline wet_watch_process
Now we only have one place we launch processes, we can just inline this
wl_list_insert.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-19 21:32:47 +01:00
Daniel Stone 4326d3c768 frontend: Rename weston_process to wet_process
It's not a libweston thing, it's a part of the frontend.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-19 21:32:47 +01:00
Daniel Stone d8114aa888 frontend: Remove process_info
This is just an empty shell around weston_process.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-19 21:32:47 +01:00
Daniel Stone ca55f0549b frontend: Move path into weston_process
We have this everywhere, so we can move it out of process_info.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-06-19 21:32:47 +01:00
Derek Foreman e8208d21d7 libweston: Use weston_coord in struct weston_output
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-06-12 16:55:22 -05:00
Pekka Paalanen 8ca6c24c8f backend-drm: drop HDR without libdisplay-info
Hardcode the ad hoc EDID parser to always claim that only SDR is
supported. Even though libdisplay-info is not yet asked for HDR
capabilities, it shall be the only way to see them.

To be nicer to experimenters, main.c adds a note that you really need
libdisplay-info if you want to play with HDR.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2023-04-28 16:18:22 +03:00
Daniel Stone 3ac2748021 xwayland: Reuse weston_client_launch
Now that our process-launching internals are identical between the
(still-misnamed) weston_client_launch and the frontend's Xwayland
launcher, we can reuse the internals instead of open-coding it.

As a result, we now additionally prevent Xwayland from inheriting
Weston's signal mask, by clearing SIG_UNBLOCK on all signals. This
should have no observable effect as we do not depend on signal handling
within Xwayland, instead using the displayfd readiness mechanism since
c2f4201ed2.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-04-19 08:28:21 +00:00
Daniel Stone dfda0ca9d2 xwayland: Use an array for CLOEXEC FDs
This gets us closer to the implementation of weston_client_launch, so we
can reuse that instead of open-coding it.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-04-19 08:28:21 +00:00
Daniel Stone 4e6a978e34 xwayland: Don't leak fds on failure
Trivial fixup to not leak socketpairs if we need to exit early in the
function.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-04-19 08:28:21 +00:00
Daniel Stone c0a75ee379 frontend: Split process and client handling
weston_client_start() takes only a single path with no arguments,
forking a process to start that command line, and creating a client from
it.

weston_client_launch(), which was always misnamed and will be renamed in
the next patch, now only handles the child process and nothing else.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-04-19 08:28:21 +00:00
Daniel Stone 11c9ec11fa frontend: Use array for clearing CLOEXEC in child
When we launch a child, we need to clear CLOEXEC on any FDs we want to
survive the exec. Use an array for doing this, so it's more generic and
we can allow callers to pass in their own.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-04-19 08:28:21 +00:00
Daniel Stone 7397030f70 frontend: Don't log when an unknown child process exits
This can happen and it's not an error condition. No reason to shout
about it.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-04-19 08:28:21 +00:00
Daniel Stone 17331a0c7d frontend: Add FDSTR_INIT macro
This initialises fdstr to 'safe' values so we can reliably deinit them.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-04-19 08:28:21 +00:00
Daniel Stone 97421545b4 screenshooter: Use wl_client, not wet_process
See discussion in wayland/weston!951 for the reasoning why: the
screenshooter must only deal with wl_client.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-04-19 08:28:21 +00:00
Daniel Stone 961be270b0 screenshooter: Exit early when screenshot in progress
When we're asked to take a screenshot but are already taking one, just
exit out of the function early.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-04-19 08:28:21 +00:00
Daniel Stone ed35fc7f6a screenshooter: Rename compositor_destroy_listener
Make it more descriptive in order to add a client_destroy_listener.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-04-19 08:28:21 +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
Philipp Zabel 7d2112c713 libweston: pass backend to weston_windowed_output_api::create_head()
Pass the backend instead of the compositor to the windowed 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 <philipp.zabel@gmail.com>
2023-04-17 09:38:50 +02:00
Pekka Paalanen 8a1f56310c compositor: free renderer string
Fixes a leak found by ASan.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2023-04-11 17:48:15 +03:00
Michael Tretter 3c6cfe6bf4 backend-drm: add additional-devices to support multi GPU
Add the --additional-devices parameter to Weston to add secondary drm devices
that will only be used as outputs, but not for rendering.

We can only fail the repaint for the entire backend, but not for single
devices. Thus, if one of the devices fail, we have to fail the repaint for the
entire backend.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
2023-03-03 08:08:46 +00:00
Michael Olbrich 00f08ec79c compositor/text-backend: use xzalloc everywhere
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2023-02-27 16:01:18 +01:00
Derek Foreman aef2da675b libweston: Convert weston_output_move to weston_coord
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-24 18:44:19 +00:00
Derek Foreman 583fbcda3b libweston: Use weston_coord in struct weston_pointer
Convert the bare x,y coordinates into struct weston_coord and update all
users.

We keep the surface position in wl_fixed_t for now so it still exactly
matches the position most recently sent to clients.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2023-02-17 13:51:23 +00:00