Commit graph

385 commits

Author SHA1 Message Date
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
Pekka Paalanen
98becedfcd libweston: publish eotf and colorimetry mode to string
Frontend wants to print these sometimes.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-04-03 17:49:20 +03:00
Pekka Paalanen
3fefb5ba44 libweston, clients, tests: implement weston_matrix in terms of weston_mat4f
This converts weston_matrix and weston_vector to use linalg-types
internally. All direct accesses to members had to be converted
everywhere, mostly in the simplest form possible which leaves some
trivially reducable code around.

The intention is that we can now gradually migrate away from
weston_matrix in the future.

Look like one trailing space got accidentally annihilated in
compositor.c.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-04-01 15:59:54 +03:00
Pekka Paalanen
e8b7ade58b libweston: add linalg-3.h
3x3 matrices, a straight-forward copy of libalg-4.h.

Useful for color computations and 2-D geometry.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-04-01 15:59:54 +03:00
Pekka Paalanen
f0567654d6 libweston: introduce linalg.h
linalg-types.h can be used from e.g. libweston.h so that structures can
embed linalg types but without forcing every user of libweston.h to
compile all the inline functions.

weston_mat4f implements most of weston_matrix, and some more. This is
just for starters. Implementing weston_mat3fwill be essentially a copy
of all this.

The matrix inversion is a copy from weston_matrix with a little bit of
clean-up.

The goal is to create a more intuitive libear algebra API, that is easy
to extend to 3x3 matrices and 3-vectors, eventually superseding all
existing matrix code: weston_matrix, calls to LittleCMS matrix
routines (plugin API), and ad hoc matrix code in tests/.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-04-01 15:59:53 +03:00
Marius Vlad
1a2c25116b libweston: Rename LED_* to WESTON_LED*
This is required to avoid a namespace collision for LED_COMPOSE key
code and was introduced with c112760368, "input: Add support for
LED_COMPOSE and LED_KANA".

If not already done this requires a libweston major version bump.

Fixes: #997
Fixes: c112760368, "input: Add support for LED_COMPOSE and LED_KANA
USB HID LEDs"

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2025-03-07 14:30:20 +00: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
Marius Vlad
bbe0b74ebd libweston: Add also painted frame rate counters
Rather than using wl_surface::commit to count the frame rate, use the
painted frames for each paint node, and implictly the surface.

This happens in the output repaint paint node list parsing, and includes
also a perfetto counter to display it.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2025-03-06 16:09:39 +02:00
Marius Vlad
e850e97ab7 libweston: Add frame commit frame rate counting
This is a continuation of work from
https://gitlab.freedesktop.org/wayland/weston/-/merge_requests/24

This patch adds a surface callback frame rate counter to the scene-graph
debug scope.

The timer interval is set by default to 1 second. This use a timer to
periodically compute the current frame callback commits in that interval
as the surface frame rate per timer interval.  Note that is solely based on
wl_surface::commit call.

Together with this, this patch also adds perfetto counter that stores
the same computed frame rate. This means the counter will be updated on
the next interval timer when the timer is armed/fired such that that
perfetto drawings will show up in a window period of time (interval).

Helpful to identify what frame rates clients achieve to debug
performance issues as to provide an objective common group. Using the
debug-scope aggregates all surfaces at the same place. This is not based
on the GPU whatsoever so it can also work on SHM type of buffers.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Signed-off-by: Changwoo Cho <changwoo.cho@lge.com>
2025-03-06 15:14:12 +02:00
Marius Vlad
ad3957ddf8 timeline-perfetto: Store disambiguator globally
This way we can use the same ID when for perfetto counters to allow
to identify clients much easier.

Also, renamed "surface" with "unlabelled surface" when get_label function
is not set.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2025-03-06 15:14:12 +02:00
Derek Foreman
77dcbe381f libweston: Add shell_private data
Shells need to find their own internal structures for weston_outputs.
Let's make that process trivial instead of a list walk.

Add a getter and setter for this private data and use it from the kiosk
shell.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-03-04 12:30:51 +00:00
Robert Mader
9124a98aec color: update color-management protocol to wp-v1
For a list of changes that got squashed into this commit see
https://gitlab.freedesktop.org/rmader/weston/-/commits/color-management-protocol-wp-v1-bkp

Co-authored-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Signed-off-by: Robert Mader <robert.mader@collabora.com>
Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2025-02-26 10:09:43 -03:00
Derek Foreman
8e26bf1ce9 libweston: Add VRR capabilities
Add functions to query output VRR capabilities and set the current VRR
mode.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-02-21 06:49:42 +00:00
Derek Foreman
85d1ca7fab drm-backend: Set VRR_ENABLED property based on output configuration
Set up the VRR_ENABLED instead of always clearing it to 0.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-02-21 06:49:42 +00:00
Derek Foreman
c321cc3020 drm-backend: Add Variable Refresh Rate modes
Query the vrr_capable property for heads, and expose it to frontends.

Currently we only support game mode VRR, but expose VRR capabilities as
an enum in anticipation of supporting QMS VRR in the future.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-02-21 06:49:42 +00:00
Martin Rys
c112760368 input: Add support for LED_COMPOSE and LED_KANA USB HID LEDs
Also bump up the xkbcommon dependency to a newer, 10 year old version,
to be able to remove very old ifdefs.

Signed-off-by: Martin Rys <martin@rys.rs>
2025-02-12 17:04:06 +02:00
Derek Foreman
0be4403f65 timeline: Add flow ids for surfaces
We add a flow_id when we touch a surface that has no flow id, and clear
it when we flush damage, so a flow line will be drawn connecting any
operations on a surface and terminating in its damage clear.

This is less useful for surfaces that never receive explicit damage after
they're set up, such as background images and the panel, as they might
never show up as a damage track, and have an unterminated flow line.

For surfaces that do show up on a damage track, we can follow them back to
the commit that caused them to update.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-01-24 12:22:13 +00:00
Derek Foreman
485cb4ab12 timeline: Add the TL_POINTs into perfetto data
Try to roughly achieve feature parity with WESGR by processing the same
timepoint data and feeding it into perfetto, with output and surface
specific tracks.

We can't match the way WESGR draws this information, because perfetto has
a different display paradigm, but we can try to at least make sure all the
same information is visible in an understandable way.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-01-24 12:22:13 +00:00
Leandro Ribeiro
9dcc5f20f8 color: adjust a few error codes in our parametric creator API
If a certain feature is unsupported, return UNSUPPORTED instead of
BAD_TF, BAD_PRIMARIES, etc.

Also, up to now cm->get_color_profile_from_params() would return
UNSUPPORTED. But this is different from the other UNSUPPORTED usages, so
return a new error.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2025-01-20 09:30:46 +00:00
Leandro Ribeiro
0ed8294881 color: add weston_color_profile_param_builder_set_primary_luminance()
This follows a recent change in the CM&HDR protocol (more specifically,
v4 of the experimental version). Now users of the API can set luminance
parameters for the primary color volume.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2025-01-20 09:30:46 +00:00
Leandro Ribeiro
9ae0a7ec05 color: accept max_fall and max_cll even for tf different from PQ
The CM&HDR protocol extension spec relaxed the requirements for the
max_fall and max_cll setters. Now we accept such values even when the
transfer function is not PQ.

This also fixes an issue in which we'd not accept target_luminance
for transfer function different from PQ, which was not on the spec.

INCONSISTENT_SET is not being used in any other errors, so remove that
from enum weston_color_profile_param_builder_error.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2025-01-20 09:30:46 +00:00
Leandro Ribeiro
1082ef328a color: rename luminance to target luminance
In the experimental color-management protocol v3
(xx-color-management-v3), we had only the luminance parameters that were
defining the luminance range targeted by the image description. But in
v4 a way to specify luminance parameters for the primary color volume
has been added.

In order to avoid confusion, rename existent luminance variables to
target luminance.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2025-01-20 09:30:46 +00:00
Marius Vlad
43f7b7b3bb windowed-output-api.h: Provide ARRAY_LENGH() for windowed-output-api
We need this common helper as we don't have access to shared helper, so
just define one in-situ.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2025-01-17 10:18:28 +02: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
dae61f3321 windowed-output-api.h: Do an explicit cast to avoid C++ build failure
Address the following build issue:

error: invalid conversion from ‘const void*’ to ‘const
weston_windowed_output_api*’ [-fpermissive] return
weston_plugin_api_get(compositor, api_names[type],
~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
const void* sizeof(struct weston_windowed_output_api));

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2024-11-25 11:26:35 +00: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
Marius Vlad
a501acd291 libweston/matrix: Fix narrow conversion with C++
Fixes the following C++ narrow conversion:

/include/libweston-14/libweston/matrix.h: In function ‘weston_coord
weston_coord_truncate(weston_coord)’:
/include/libweston-14/libweston/matrix.h:212:39: error: narrowing
conversion of ‘(int)in.weston_coord::x’ from ‘int’ to ‘double’
[-Werror=narrowing] 212 |         return (struct weston_coord){
	(int)in.x, (int)in.y };
      |                                       ^~~~~~~~~
/home/mvlad/install-new/include/libweston-14/libweston/matrix.h:212:50:
error: narrowing conversion of ‘(int)in.weston_coord::y’ from ‘int’ to
‘double’ [-Werror=narrowing] 212 |         return (struct weston_coord){
	(int)in.x, (int)in.y };

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2024-10-18 20:40:56 +03:00