Commit graph

411 commits

Author SHA1 Message Date
Robert Mader
32f6148afd libweston: Implement color-representation protocol
For now limited to coefficients and ranges that are typically
supported by KMS drivers. We notably leave out alpha modes and
chroma locations for now.

The protocol initialization is guarded by the WESTON_CAP_COLOR_REP
backend capability and thus not enabled anywhere yet.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2025-12-19 17:08:29 +01:00
Derek Foreman
a3f0e97a71 compositor: Support the commit-timing protocol
Introduce support for the commit-timing protocol to allow applications
to attach a presentation time to a content update.

We use the repaint timer to schedule content updates in advance of
the frame time when they should be displayed.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-12-16 10:58:01 -06:00
Derek Foreman
37acb0c0fd compositor: Directly use a timerfd instead of a wl_event_source
In the near future commit-timing + VRR combined will want to have better
than the 1ms precision we're allowed now.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-12-16 10:58:01 -06:00
Derek Foreman
01b7e9d015 compositor: store frame flags from finish frame
These are used to determine if the previous frame was displayed with
tearing, which is useful in determining when the next frame time should
be.

Store these as a step towards breaking the frame time calculations out
of output_finish_frame into a separate function.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-12-16 10:21:43 -06:00
Derek Foreman
f1bcedd089 compositor: Track repaint time and expected presentation time
For the upcoming commit-timing protocol, we're interested in when a
scheduled repaint will be displayed, so let's keep track of both the
repaint time and the anticipated presentation time.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-12-16 10:21:43 -06: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
Derek Foreman
cb97abd4f7 compositor: Add the fifo-v1 protocol
Add support for the fifo protocol, which allows an application to submit
a content update that can only be applied after the previous content
update has been active for a display refresh.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-12-04 14:03:13 -06:00
Derek Foreman
f50296d4e9 compositor: Add a deferred content update framework
Now that we have surface-state application streamlined, it's fairly easy to
add a framework for deferring content updates.

This will be used soon for fifo and commit timing. For now, the
weston_surface_state_ready() call that makes any of this do something
will always return true.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-12-04 14:03:10 -06:00
Derek Foreman
61134fa151 compositor: Track view and surface visibility per output
Keep track of whether a view has any unoccluded pixels on an output,
use this information to add a weston_surface_visibility_mask() function
that we'll use later.

Since the visibility information is calculated at repaint, and invalidated
by some (but not all) state updates, we'll keep track of when the previous
repaint's status is still valid by watching surface status bits.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-12-04 13:55:20 -06:00
Derek Foreman
e4be014f93 compositor: Add an explicit latch point
Latch is the moment when the compositor considers updates for an upcoming
redraw. Nothing that takes place after an output latches for repaint can
change what will be repainted.

This needs a more explicit treatment now that upcoming transactional
protocols require things to happen immediately after the latch (ie:
when it's too late to change the upcoming render).

Add an explicit latch point, a signal to tap for testing, and some asserts
to make sure nothing can violate the inevitability of the current render
state.

Note that currently latch is tied to repaint such that we only claim to
have latched when a repaint will happen. In a future commit this will lead
to forcing the repaint loop to fire without damage when the fifo protocol
needs something to happen after a latch. This could be an area for
future improvement.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-12-04 12:38:17 -06:00
Derek Foreman
b700c7cbee compositor: Add flow id into surface state
We're going to be adding protocols (commit-timing, fifo, syncobj) that
allow deferred surface content updates.

It makes sense to start the perfetto flow ids from the surface state so
we can track a flow from creation (ie:commit) to presentation.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-12-04 12:38:17 -06:00
Marius Vlad
9215a537e0 compositor: Move repaint_status out of weston_output
To accommodate some future CI bump to Trixie (doxygen/breathe issue)
move out the anonymous enum out of weston_output object.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2025-12-02 17:25:14 +02:00
Derek Foreman
b44cf1b6af animation: Change how we seed the initial time
With the addition of the weston_output_set_ready() call, the shell fade
animation is now started during the very first repaint. The first repaint
doesn't have an accurate frame_time for the previous repaint, as none has
occurred yet.

Since we set the time base for an animation based on the output's frame
time the second time the animation is run, we end up setting the shell fade
start time to 0, and the first real repaint advances the timer to the real
time, generating a warning and truncating the animation.

Instead of tracking the number of animation frames, let's just continue to
reset the time base until we finally get a non-zero time.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-11-24 12:29:15 -06:00
Marius Vlad
881ac6a5cf compositor: De-couple paint node ordered list from the view build list
This de-couples the compositor view build list from the paint node
ordered list to allow a more finer grain over what lists we need to
rebuild upon repaints.

As a consequence to that this avoids a trip over from the compositor
when paint nodes are destroyed and no longer re-created upon rebuilding
the view list.

Fixes: #1070
Fixes: abfe874a ("core: Don't rebuild view list on surface-local changes")

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2025-11-19 15:47:13 +02:00
Derek Foreman
0bfcb700b9 compositor/shells: Require shells to flag outputs as ready to allow repaint
We've added a curtain to the shells so at startup we have something to
render, but this causes a flicker if someone is trying to have a seamless
transition from boot to weston.

Add a ready flag that allows the shell to indicate repaints are safe, so
we can remove the curtains and have no wasted frames at startup.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-10-27 05:55:51 +00:00
Derek Foreman
6070dd8069 compositor: Add a WESTON_PAINT_NODE_BUFFER_PARAMS_DIRTY
This already existed for surface, so it is trivial to add.

This will let the upcoming plane state reuse code notice a format change.

This is handy because a client might respond to dmabuf feedback by changing
formats, with the expectation that doing so would land content on a plane.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-10-23 16:22:00 +01:00
Pekka Paalanen
120b88aa0a color: run vec3 through weston_color_curve_sample()
Future development will need to evaluate pipelines with curves and
matrices. Such pipelines naturally operate on vec3, as matrices cannot
be operated one channel at a time. Make weston_color_curve_sample()
operate on arrays of vec3.

Its currently only caller, weston_color_curve_to_3x1D_LUT(), is modified
to employ a temporary array for the API impedance mismatch. This
workaround will be removed later as weston_color_curve_to_3x1D_LUT()
itself will be converted to operate on vec3 arrays.

weston_v3f_array_to_planar() documentation was generated with AI.

weston_color_curve_sample() is restructured a little bit, attempting to
make it simpler to read.

color-operations.h gets the #includes needed to make it self-standing.

Assisted-by: Github Copilot (Claude Sonnet 3.5)
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-10-21 14:23:37 +03: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
Daniel Stone
0664d5bdc1 output: Record paint_node_changes during repaint
When we're going through assign_planes and repaint, give the backend an
opportunity to see what's changed during this repaint.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2025-10-17 13:51:05 -05:00
Daniel Stone
7f8c5f984e paint-node: Expose weston_paint_node_status
Expose the dirty status as public API so we can use it as a part of
weston_output.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2025-10-17 13:51:04 -05:00
Pekka Paalanen
360eef9663 color: add weston_color_profile_param_builder_set_target_primaries_named()
The protocol does not carry target primaries by enumeration, but in
weston.ini I want to be able to use a name rather than raw values.
Adding this API makes that possible.

main.c cannot look up the enumeration itself, because color-properties.h
is private. As it should be.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-10-09 16:17:57 +00:00
Pekka Paalanen
fe85ed48fc shared: implement weston_parse_space_separated_list()
This will be useful for parsing config file entries that have several
items on key, like x,y coordinates or a list of flags. Code reading
custom color profiles from weston.ini will use this.

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
Robert Mader
07a5ec8157 output-capture: Add output_get_writeback_formats helper
And implement it in the DRM backend. This will be used by the next
commit.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2025-09-25 11:26:21 +02: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
Derek Foreman
eac3d78bc6 compositor: Remove view->visible
This is not what any sensible person would expect it to be. It was updated
by a walk of all the paint nodes on the output most recently repainted,
so if a view spanned outputs the visible region would only make sense
within the most recently painted output's region.

It's basically a scratchpad for a mid-repaint operation. Instead of making
it a view member, put it in the paint node, which are always per-output.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-09-05 15:23:08 -05:00
Derek Foreman
ed1edb7b5c compositor: replace surface_state->buffer with a buffer_ref
Use a buffer_ref here to allow us to remove the subsurface
cached_buffer_ref and keep it in the surface state struct instead.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-09-05 10:01:42 -05:00
Derek Foreman
8479772d2d compositor: drop has_cached_data subsurface bit
We don't use it anymore, we just casually commit and expect that
applying clean state is harmless.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-09-05 10:01:42 -05:00
Derek Foreman
1326428f41 compositor: track subsurface effective sync status
Keep track of subsurface effective sync status when it changes instead of
figuring it out when we need to know it.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-09-05 10:01:42 -05:00
Derek Foreman
ee90650c8c compositor: Make subsurface->synchronized a bool
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-09-05 10:01:42 -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
3cad1c7716 libweston: remove set_gamma()
The plugins cms-static and cms-colord have been deprecated and removed
from our code. They were the only thing holding set_gamma() from being
removed. So remove set_gamma() from the code.

Users can have the same results tweaking the output color profile that
they use.

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
72ed2c12d8 color-lcms: parametric to parametric transformations
This implements the basic color transformation from parametric to
parametric image description. The colorimetric rendering intents are
implemented. The perceptual and saturation rendering intents are
equivalent to media-relative + BPC rendering intent, subject to be
implemented better later.

Things missing:
- handling target color volumes
- perceptual dynamic range mapping

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-07-28 17:32:11 +03:00
Pekka Paalanen
3b3fa61c31 color: add Bradford matrix computation
This function is required for media-relative rendering intents.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-07-28 13:14:01 +03:00
Pekka Paalanen
b32f353003 color: add NPM computation
This function is required for producing color transformations from
parametric image descriptions.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-07-28 13:13:38 +03: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
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
cf44b691c6 compositor: Add weston_view_move_before_layer_entry
Add a function to move a view in front of a layer entry, so we can easily
add this functionality to lua-shell in a future commit.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-06-04 15:39:03 +03:00
Derek Foreman
a124b19a01 compositor: Remove weston_view_damage_below()
It has no more callers, and hasn't done what its name implies for a very
long time.

Remove it.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-05-30 11:38:47 +00:00
Daniel Stone
816e4180bc libweston: Remove weston_surface_damage()
There is no valid reason for anyone to call this.

True surface damage is already handled when surfaces are committed. View
damage is already handled through any per-view manipulation which would
generate damage. There is thus no reason for anyone to ever call this.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2025-05-28 16:45:43 +01:00
Daniel Stone
9a5b4087c8 libweston: Remove weston_surface_damage() from subsurface commit
When we change the subsurface order, the surface itself has not received
any damage: what's been damaged is the views. Place the damage where it
should be, as the act of moving the view within the view list is where
the damage originates from.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2025-05-28 16:45:10 +01: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
Erico Nunes
ad4746101a tests: Remove gl_ suffix from force_full_upload
This will also be used for Vulkan-renderer tests.

Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
2025-05-23 20:36:05 +01:00
Robert Mader
d24caf5f32 gl-renderer: Add gl_force_import_yuv_fallback test quirk
Forcing the fallback paths for YUV formats. This will allow us
to test these paths on CI now that llvmpipe supports all tested
formats natively.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2025-05-15 15:08:18 +03:00
Pekka Paalanen
42059ce258 libweston: move stuff into colorimetry.h
Add a new header for colorimetry stuff. Adding more things in
libweston.h doesn't feel good, they drown in the sea of everything.

Pure refactoring, no changes.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-04-30 16:11:58 +03:00
Pekka Paalanen
eadc3d32ce libweston: add C++ braces to linalg headers
Forgot to add these. Looks like all public headers should have them.

Fixes: e8b7ade58b

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-04-30 16:11:58 +03:00
Pekka Paalanen
e837179f14 build: install linalg-3.h
Forgot.

Fixes: e8b7ade58b

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-04-30 16:11:58 +03:00