Commit graph

61 commits

Author SHA1 Message Date
Derek Foreman
ed77aca2d8 compositor: check repaint_msec with a helper
Validate repaint_msec so it's not longer than a refresh interval.

Negative repaint windows will cause problems for frame scheduling in the
future, so remove them.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-12-16 10:58:01 -06:00
Alyssa Ross
54217f5d88 frontend: don't require XDG_RUNTIME_DIR
Recent versions of libwayland support absolute paths in display names,
and in that case do not require XDG_RUNTIME_DIR to be set.  It's
therefore overly strict for Weston to exit due to XDG_RUNTIME_DIR being
unset when it would work perfectly fine without it.  The messages
displayed for incorrectly set XDG_RUNTIME_DIR are useful though, so keep
them around, but only display them if wl_display_add_socket() fails
i.e. the lack of XDG_RUNTIME_DIR has actually caused a problem.

Signed-off-by: Alyssa Ross <hi@alyssa.is>
2025-12-09 11:46:01 +02:00
Olivier Fourdan
0126a5b4fc backend-headless: Add an option to enable a fake seat
When running headless, weston will not expose a wl_seat.

This was removed with commit a1046adc ("compositor-headless: do not
create a seat").

However, some applications, namely GTK3 based, will log a warning when
there is no wl_seat:

 | gdk_seat_get_keyboard assertion GDK_IS_SEAT(seat) failed

While this is arguably a bug in GTK3 which should not complain with a
legit setup, that breaks the CI of those projects when using Weston,
while most of the other Wayland compositors will create a fake seat when
running headless, making weston the odd ball there.

This changes adds a new option "--fake-seat" that will instruct weston
to create a seat when running headless. The default remains not to
create a seat though, so backward compatibility is preserved.

This partially reverts commit a1046adc66.

See-also: https://gitlab.freedesktop.org/ofourdan/xwayland-run/-/issues/12
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
2025-12-08 11:44:27 +01:00
Kurt Kanzenbach
c6484574a6 frontend: Fix VNC mirror screen rotation
The following config allows to mirror the LVDS output to VNC:

|[output]
|name=LVDS-1
|transform=rotate-270
|
|[output]
|name=vnc
|mirror-of=LVDS-1

However, the current code only takes the scale into account, not the
relative transformation. In case of rotate 90 or 270 the width and height
have to be swapped. Add it.

Closes: https://gitlab.freedesktop.org/wayland/weston/-/issues/1076
Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>
2025-11-17 12:11:42 +00:00
Elliot Chen
bef29b8774 libinput: support ignoring all libinput-based input devices by configuration
For some cases such as remote control, need to disable the interaction
between input device and the weston. It will not affect the use of input
device by other modules or applications.

Signed-off-by: Elliot Chen <elliot.chen@nxp.com>
2025-10-21 12:54:42 +03:00
Derek Foreman
2c7fd792b5 frontend: Add support for forcing a color format
Allow dictating which color format we'd like to use. This introduces the
front-end side and the core parts, leaving the EDID parsing and DRM
connector property for later patches.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2025-10-18 14:02:16 +01:00
Pekka Paalanen
a06ef0f8aa tests: add color-output-parsing
This tests the [output] section key 'color-profile', which is meant for
setting up parametric color profiles. It tests the special names, and
fetching values from EDID. There are also tests for all accepted keys in
a [color-profile] section.

These tests are all positive. Error messages are tested in another
patch.

The test client helper changes are needed for loading the EDID file.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-10-09 16:17:57 +00:00
Leandro Ribeiro
854457524c frontend: allow creating custom param color profiles from .ini
This allow users to specify a fully custom parametric color profile in
weston.ini for a certain output.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Co-authored-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-10-09 16:17:57 +00:00
Pekka Paalanen
4890cd6a3d frontend: create automatic color profiles from .ini
This introduces a new key for outputs in weston.ini, "color-profile".
For starters, implement a pre-defined sRGB profile and an automatic
profile.

Automatic color profiles are created based on the colorimetry-mode and
the eotf-mode of the output. EDID can also be taken into account, but it
is opt-in due to its potential unreliability.

This feature is documented as not fully implemented, because color-lcms
does not yet handle parametric color profiles together with ICC
profiles. Specifically, the stock sRGB profile is still an ICC profile,
and would not be able to be used together with a parametric output
profile.

Co-authored-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-10-07 17:23:35 +03:00
Pekka Paalanen
d7030571c5 frontend,color: print details of the set color profile
It is nice to see the numbers of a parametric color profile when created
from CTA or EDID or just to cross-check with weston.ini.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-09-25 18:03:31 +03:00
Leandro Ribeiro
6fe0cfc2b8 color: introduce output color effects
Output color effects are applied to the whole output scenegraph. It
depends on color-management being disabled, as the color effects are
applied in sRGB content.

For now we added only a few accessibility options: color inversion,
deuteranopia, protanopia and tritanopia CVD correction.

Note that surfaces presented on outputs that contains a color effect
can't be used for direct scanout (i.e. bypass composition and offloading
to KMS overlay planes). The color effect is applied in our GL-renderer.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2025-09-18 12:32:13 -03:00
Elliot Chen
b268b3827c backend-pipewire: support frame rate configuration
Signed-off-by: Elliot Chen <elliot.chen@nxp.com>
2025-09-15 08:20:52 +00:00
Marius Vlad
d2cf5a7ba5 frontend: Explicitly add a check for printing warning
Fixes a minor issue with 28bdcb46be ("frontend: Log when exiting due to
insufficient active outputs") to only print that we have
no outputs enabled but we're allowed to continue when we actually get to
that scenario.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2025-09-12 15:06:22 +01:00
Derek Foreman
cfaa19a292 libweston: Move transform string code into libweston
Pull this out of the frontend.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-09-05 13:34:18 -05:00
Leandro Ribeiro
c594aa22cb backend-drm: offload post-blend color transformation to KMS
In this patch we allow offloading the post-blend color transformation
to KMS.

As KMS currently only supports to offload the transformation in a LUT,
this may result in precision issues. So this introduces the config
option "offload-blend-to-output", which is disabled by default.

This option requires "color-management" to be enabled, otherwise it is
ignored.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2025-09-02 13:34:00 +00:00
Leandro Ribeiro
996ec58ce3 frontend: avoid unecessary call to get_section()
We already get the core section a few lines above, and no other call
get_section() call are made in between.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2025-09-02 13:34:00 +00:00
Derek Foreman
6b1b3d167d xwm: Add command line option to disable window decor
Our window decor uses cairo-xcb. cairo-xcb stores xcb_connection_t
internally and uses them as kind of a hash key for internal bookkeeping.
This needs to be torn down with a cairo_device_finish, when the last
cairo surface is destroyed, and we are not properly handling that.

Because of this weston bug, if the Xwayland server dies, is restarted,
and the weston X window manager gets the same xcb_connection_t pointer
value for a new connection that it had for a previous connection,
cairo-xcb will use stale state and crash.

Weston is used in some places (like Mesa CI) where Xwayland crashes are
more common than one might usually expect, and weston needs to be robust
against these failures. It's ok to have no window frames in xwl in these
cases, because nobody is interacting with the windows.

The '--no-xwm-decorations' command line option will now remove
cairo-xcb from use entirely, so this crash can no longer happen.

We should still fix the bugs in our cairo usage, but I think long term
it's still ok to have a way to disable this and reduce complexity.

Ref #1042

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-08-28 14:35:30 -05:00
Pekka Paalanen
ead6c5b319 frontend: use weston_enum_map for scroll method
Use helpers instead of open-coding.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-08-05 11:51:23 -05:00
Pekka Paalanen
72d2b14e6a frontend: use weston_enum_map for colorimetry modes
Use helpers instead of open-coding.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-08-05 11:51:23 -05:00
Pekka Paalanen
28808401b2 frontend: use weston_enum_map for EOTF modes
Use helpers instead of open-coding.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-08-05 11:51:23 -05:00
Pekka Paalanen
1c14c4ef70 frontend: use weston_enum_map for transforms
Use helpers instead of open-coding.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-08-05 11:51:23 -05:00
Pekka Paalanen
6d2ca22a6c frontend: remove trailing whitespace
My editor always does this, and then I had to manually discard that
change.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-08-05 11:51:23 -05:00
Pekka Paalanen
868c25b591 frontend: use weston_enum_map for requires_outputs_modes
Use helpers instead of open-coding.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-08-05 11:51:23 -05:00
Pekka Paalanen
0787422248 frontend: convert vrr_mode to enum map
Less open-coding is better?

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-08-05 11:51:23 -05:00
Septatrix
28bdcb46be frontend: Log when exiting due to insufficient active outputs
Signed-off-by: Septatrix <24257556+septatrix@users.noreply.github.com>
2025-08-01 14:58:19 +00:00
Marius Vlad
feb4fd1386 compositor, frontend: Allow to configure placeholder-color
This is a trivial change to allow passing a user-defined color to
specify the color for the placeholder.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2025-06-24 16:00:05 +03:00
Marius Vlad
0600265c64 frontend: Make use of the advertised debug scopes
This patch introduces a new cmd line option, namely `--debug-scopes`
(or shorthand `-d`) to limit which debug scopes are being advertised
over the westond-debug protocol.

To avoid tedious work to make this work in the same time as `--debug`, a
boolean type of option which doesn't accept any other entries, I've
decided to have a dedicated string cmd line argument.

If passing `--debug` all debug scopes are advertised by default
(keep the same behaviour). If you'd like to limit which of those scopes are
advertised, use the -d and only that one those scopes be advertised.
Pass these as a command-separated list.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2025-06-04 17:43:47 +03:00
Marius Vlad
2dd870adac weston-log: Add a advertised list of debug scopes
This introduces a new list that is being checked up when advertising
or when the client attempts to bind a debug scope.

This would allow for a way in which the frontend can determine which
debug scopes the weston-debug protocol can advertise or the client
using the protocol can bind to.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2025-06-04 17:43:33 +03:00
Derek Foreman
e91eccd709 lua-shell: Add lua-shell
lua-shell is a new meta-shell for Weston. It does nothing in and of
itself, but is defined to be user-scriptable and configurable. A
supplied Lua script will be interpreted and executed by Weston, allowing
full control over window management in response to events.

This includes a shell.lua example script which behaves as a tiling WM.

Co-authored-by: Michael Tretter <m.tretter@pengutronix.de>
Co-authored-by: Marius Vlad <marius.vlad@collabora.com>
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-06-04 15:47:06 +03:00
Erico Nunes
8f56d03d4b libweston: Vulkan renderer
A Vulkan renderer for weston, based on the GL renderer.
The goal is to impose the least requirements as possible on Vulkan
implementations, as to allow even Vulkan 1.0 (or early development)
drivers to run a Wayland compositor. Any additional features or
extensions are made optional if possible.
Currently supports drm, wayland, x11 and headless backends.
As of this implementation, this is still considered an experimental
renderer.

Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
2025-05-23 20:36:05 +01:00
Derek Foreman
52204f55ea frontend: Fix crash in output resize handler
The output resized signal sends a struct weston_output as the data, not
a struct weston_head.

Fixes 197c5e0084

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-04-24 12:20:53 -05:00
Leandro Ribeiro
cb43a086b5 frontend: improve error message
We have the following error message in parse_color_characteristics():

name=%s: reserved name. Do not use ':' character in the name.

It gets confusing when "name" ends with ':'. So rephrase it to clarify
the error message in such case.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2025-04-03 17:50:02 +03:00
Marius Vlad
c706e1f8c8 flightrecorder: Don't subscribe by default to the drm-backend
As the flight recorder subscribed by default to the drm-backend will
implicily arm the KMS page flip counter. Just use the "log", log scope.

To make this more obvious, with this change we also print the
subscriptions, when we detect that the flight recorder is enabled.

Users can use the provided cmd line args (-f/--flight-rec-scopes) to
adjust those.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2025-03-06 16:09:42 +02:00
Marius Vlad
5f1c43de29 fontend: Arm the surface counter timer only when using debug
Rather than having this timer always fire up & running, do it when we actually
enable debug, with the `--debug` cmd line argument.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2025-03-06 16:09:42 +02:00
Derek Foreman
c7cf87fe85 frontend: Enable VRR from the config file
Allow weston.ini to enable game VRR.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-02-21 06:49:42 +00:00
Marius Vlad
207fed2710 Revert "shared/helpers.h: Migrate helpers.h to libweston"
This is problematic as we don't have namespacing for these and some of
the macros can interfere with other defines.

This reverts commit 8634c7e349.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2025-01-17 10:18:26 +02:00
Marius Vlad
8634c7e349 shared/helpers.h: Migrate helpers.h to libweston
As weston_windowed_output_get_api needs ARRAY_LENGTH() move helpers to a
libweston/ so other users can re-use that instead of re-defining these
all over. Easier for other front-ends to make use of them.

With this change windowed-output-api.h also includes the helpers header.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2024-11-25 11:26:35 +00:00
Derek Foreman
50d92f9d6f libweston: Fix crash with mirror-of
Since c4eb15d453 we keep a copy of
native mode parameters, however we forgot to initialize the
native mode parameters in some situations, which breaks the
output mirroring code when it sees uninitialized data.

Fixes c4eb15d453
Fixes #949

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2024-08-30 08:16:45 -05:00
Lukasz Czechowski
58a0abcb58 vnc: Allow to disable Transport Layer Security
Some VNC clients, i.e. noVNC, do not support TLS encryption.
Add new argument "--disable-transport-layer-security" to
explicitly disable activation of TLS.
This will allow to extend VNC clients compatibility.

Signed-off-by: Lukasz Czechowski <lukasz.czechowski@thaumatec.com>
2024-08-14 07:48:09 +00:00
Marius Vlad
75280d2e40 frontend: Disable client resize for RDP remote outputs
Similar to the VNC backend do the same for the RDP backed, as this would
allow to get a matching output, in dimensions, to the one we are
mirroring.

This also re-works a bit the no-clients-resize to be more inline with
VNC one.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2024-08-12 15:50:13 +00:00
Marius Vlad
f43342cf78 frontend: Disable client resize for VNC remote outputs
As we're mirroring other outputs we shouldn't allow clients to resize
the output.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2024-08-12 15:50:13 +00:00
Marius Vlad
197c5e0084 frontend: Add support for tracking parent/mirror changes
If the DRM native output is changed propagate the changes
to the mirror as well.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2024-08-12 15:50:13 +00:00
Marius Vlad
bd39f7edc1 frontend: Teach remote backends to use the scale from config
PipeWire/RDP/VNC were using by default scale 1, so allow
configuration using the ini config file.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2024-08-12 15:50:13 +00:00
Marius Vlad
d553333da8 frontend: Share a native output using 'mirror-of' keyword
This would allow to screen-share a particular output like the
following:

[output]
name=vnc
same-as=DP-5

[output]
name=rdp-0
same-as=DP-4

[output]
name=pipewire
same-as=eDP-1

Both 'vnc', 'pipewire' 'rdp-0' remote outputs would then be a
screen-share 'DP-5', respectively, 'e-DP1', or the 'DP-4' DRM output.

Currently, this is intended only for VNC, RDP and PipeWire remote outputs.

This patch exports weston_output_set_position(), and uses that for
overlapping a remote output with a native DRM one, rather than using
weston_output_move() as that has a side-effect when reflowing outputs
from shells.

Further more creating this remote output is driven entirely by compositor
signal events such that enabling an DRM native output would enable the
remote output, while disabling the native would have the same outcome
for the remote one.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2024-08-12 15:50:13 +00:00
Marius Vlad
3842c1c737 frontend: Expand simple head function
In order to allow passing additional pre/post callbacks. This allows
further re-use of the simple_head_enable() function instead of
creating a similar dedicated function. We can then re-use the same
function for enabling remote outputs.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2024-08-12 15:50:13 +00:00
Marius Vlad
d88782bf41 frontend/man: Use 'clone-of' instead of 'same-as'
Rather than using the same key entry for the DRM backend to cloned
outputs, rename to 'clone-of'. This means that ini configuration files
will break after this change, but this should be documented with the
next Weston release.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2024-08-12 15:50:13 +00:00
Pekka Paalanen
a16598b038 backend-drm: make libdisplay-info mandatory
Making libdisplay-info a mandatory dependency allows us to drop this old
code.

Future new features will require libdisplay-info to work, and would not
get fallback code anyway.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2024-07-15 14:29:02 +00:00
Marius Vlad
e70d9d47fc frontend: Use simple_heads_changes for head enablement
Similarly to all the other back-ends do the same for the RDP one.

With this change the remote output will be placed, similar to the
VNC/PipeWire on the right side from the native one, when both backends
are loaded.

But ultimately this patch is about having all backends share the same
code path.

Fixes: #820
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2024-06-21 12:43:55 +00:00
Pekka Paalanen
3908e3e345 frontend: remove useless if (section)
If section is NULL, weston_config_section_get_*() will assign the given
default value and return -1 with ENOENT. Hence, checking for NULL
section is unnecessary.

This cleans up only the simple cases.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2024-06-19 17:57:38 +00:00
Pekka Paalanen
b0d5b066c5 tests: add EOTF and colorimetry mode parsing
Essentially ensures that wet_output_set_eotf_mode() and
wet_output_set_colorimetry_mode() work as intended.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2024-05-06 10:39:42 +00:00