Commit graph

9971 commits

Author SHA1 Message Date
Leandro Ribeiro
0fe575b4a9 color: move LINPOW/POWLIN to new enum weston_color_curve_parametric_type
This just makes the code more readable and should help us to avoid
mistakes in the future. No behavior changes.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2025-04-10 12:43:00 +00:00
Leandro Ribeiro
46920d8a61 color-lcms: define max number of params for LittleCMS curves
Follow-up of "color: define max number of params for parametric curves
and tf's". Let's do the same for LittleCMS parametric curves.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2025-04-10 12:43:00 +00:00
Leandro Ribeiro
037f2dbff1 color: define max number of params for parametric curves and tf's
Up to now we were using 10 as the max number of params for color curves
and transfer functions. But this came from LittleCMS, whose parametric
curves may contain up to 10 params.

But out color curves and tf's are not tied to LittleCMS, so let's define
constants to help avoid confusion.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2025-04-10 12:43:00 +00:00
Leandro Ribeiro
52262cb06c shared: add weston_assert_uint32_lt_or_eq()
This will be useful in the next commits.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2025-04-10 12:43:00 +00:00
Derek Foreman
d9893c6af2 compositor: Fix a potential crash at shutdown
weston_global_destroy_save() can directly destroy a global if the
compositor state is WESTON_COMPOSITOR_OFFSCREEN.

Make sure we don't try to set_user_data after this has happened.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-04-10 12:02:26 +00:00
Robert Mader
81800294a9 gitlab-ci: Bump image
Signed-off-by: Robert Mader <robert.mader@collabora.com>
2025-04-08 21:53:45 +00:00
Robert Mader
682d420b50 gitlab-ci: Build kernel with udmabuf support
With udmabuf we can write test for dmabuf paths in a similar
manner to shm. It's available by default in most recent distros
and thus works OOTB on developer setups.

Drop vgem as it isn't needed any more and makes the CI use
kms_swrast (instead swrast), which isn't compatible with the
llvmpipe dmabuf implementation yet.
Using swrast also streamlines CI with running tests locally,
making debugging easier.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2025-04-08 21:53:45 +00:00
Robert Mader
57f48ab91c gitlab-ci: Update Mesa for llvmpipe dmabuf support
llvmpipe now supports EGL_EXT_image_dma_buf_import, allowing
us to test zwp_linux_dmabuf_v1 on CI.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2025-04-08 21:53:45 +00:00
Robert Mader
9675ef49f2 gitlab-ci: Update Meson
And clean up accordingly. This is required for the following commit.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2025-04-08 21:53:45 +00: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
Leandro Ribeiro
d3ef4f9576 color: improve code that validates color gamut
First of all, we make it work for NaN CIE xy values.

We also improve the error message a bit. It was only printing that the
color gamut was invalid, but it didn't explain why. This adds the
explanation (out of valid range).

And finally, we make the code a bit shorter.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2025-04-03 17:49:53 +03:00
Leandro Ribeiro
25a10fa2cd color: add WL_EXPORT to param builder functions
The internal API to create parametric color profiles should be available
not only to libweston, but also to frontend. WL_EXPORT was missing from
the functions, so add that.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2025-04-03 17:49:40 +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
d26ab4360d color-lcms: transform_search_param well-formedness
Assert that the search param structure is well-formed, so that there
won't be cache misses due inconsistent fields.

Anything called from inside cmlcms_color_transform_get() can skip
asserting these.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-04-03 17:49:03 +03:00
Pekka Paalanen
ce80a059f1 color-lcms: use alloc/register in profile_from_params
This is a nice clean-up.

The parameter-based color profile is actually fully formed. The problem
of using it is dealt in the next patch.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-04-03 17:48:08 +03:00
Pekka Paalanen
5ef1432195 color-lcms: cmlcms_color_profile_alloc/register()
Split the create function into two parts, allocation and finalization.
All ICC-specific code is moved into callers, so that the parameter-based
profile creation can start using alloc/register too.

cmlcms_color_profile 120 bytes, so it's unlikely we could ever deal with
that allocation failing - don't even try.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-04-03 17:47:32 +03:00
Pekka Paalanen
385334b77a color-noop: improve profile error messages
While no-op does not support these, other color managers might. Change
the wording so that the user does not think that Weston does not support
these at all.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-04-03 17:46:45 +03:00
Marius Vlad
1030268c6d gitlab-ci.yml: Limit gcov and perfetto to just x86 build
This should speed up considerably the other builds / tests.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2025-04-03 07:58:05 +00:00
Michael Olbrich
83053f0ce4 backend-drm: make sure outputs are enabled during plane assignment
drm_output_propose_state() is called during from drm_assign_planes(). At this
point, the output is enabled, but it may be disabled in the current state, that
is copied.

So explicitly enable the output by setting dpms to WESTON_DPMS_ON.
The same thing is already done in drm_output_repaint() but that's to late for
drm_output_propose_state(). Move that to the fallback path when planes are
disabled. It's no longer needed in general and changing the state between the
atomic test and commit is not a good idea anyways.

Without this, the atomic commit may fail, even though the corresponding test was
successful.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2025-04-02 18:02:45 +00:00
Marius Vlad
9aa910c4d4 backend-drm: Fix count page flips on invalid outputs
Slight oversight of counting page flips from within the atomic commit
handler when we don't really have an output. Do that after *after*
checking for a valid output.

Fixes: cda8de1089, ("backend-drm: Count and display KMS page flips")

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2025-04-02 13:09:45 +00:00
Erico Nunes
ae47d27f06 clients/simple-egl: destroy tearing_manager on exit
Add missing tearing_manager destructor call.

Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
2025-04-02 06:34:13 +00:00
Erico Nunes
4fa4665d7a clients/simple-egl: remove duplicated shader program link
This is unnecessary as the program is already linked at this point.

Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
2025-04-02 06:34:13 +00:00
Loïc Molinari
5a56856866 gl-renderer: Init output borders with transparent pixels
When the 1st frame of the X11 backend is rendered by the GL renderer,
an invalid call to glBindTexture() with a target of 0 is emitted. This
is because the border status of the window renderbuffers are flagged
dirty while the border status of the output state is not. This commit
ensures that the output state and the renderbuffers border status are
dirty by default. It also enforces the creation of output border
textures even though no valid data have (yet) been passed, in which
case the textures are filled with transparent pixels.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2025-04-01 13:55:06 +00:00
Pekka Paalanen
b872c71820 color-lcms: use weston_mat4f for matrix stages
This makes multiply_matrix_stages() handle offset vectors correctly, but
they will not apprear here yet, because
is_matrix_stage_with_zero_offset() forbids merging such matrices.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-04-01 15:59:54 +03:00
Pekka Paalanen
d3561621e3 tests: change BPC to weston_mat4f
Stop using weston_matrix.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-04-01 15:59:54 +03:00
Pekka Paalanen
adfe772db2 tests: replace lcmsMAT3 with weston_mat3f
Replace an ad hoc 3x3 matrix, that was supposed to match LittleCMS matrix
but did not, with our new consistent weston_mat3f API.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-04-01 15:59:54 +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
92d7caa767 tests: add linalg-3 test cases
These are the same as linalg-4 cases, except the matrices have been
generated anew, and checked with Octave that the condition numbers and
determinant values hold.

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
2bbd2e4364 tests: add linalg-4 tests
Ensure our basic computations are correct.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-04-01 15:59:53 +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
Loïc Molinari
6bbc6c1256 gl-renderer: Fix SHM RGB888 and BGR888 endianness
The 24 bpp RGB and BGR SHM formats are meant to be stored little
endian, not big endian.

Fixes a regression in commit 815ccaff.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2025-04-01 12:31:51 +02:00
Marius Vlad
9d841e39e8 compositor: Mark pnode accordingly when buffer type is direct
As we exit early we never have the chance to mark it as is_direct when
the buffer type is direct_display.

This is required as is_direct is never checked in GL attach part we
end up tripping on invalid renderer_private causing it to assert.

Fixes 2db4f17244f, "compositor: re-order paint node placeholder checks"

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2025-03-25 16:16:04 +00:00
Pekka Paalanen
fbf026653b color-lcms: cmsMAT3 is row-major after all
Found out in https://github.com/mm2/Little-CMS/issues/483

This should be a complete no-op change, but there is one difference.
Previously matrix_inf_norm() summed over rows. Now it sums over columns
as it should be. This shouldn't hurt because it is only used to identify
identity matrices. The bug was actually in is_identity_matrix_stage()
because it deliberately passed what was assumed to be a transpose of the
matrix.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-03-25 08:40:32 +00:00
Marius Vlad
f0ee8be804 terminal: Restore SIGPIPE signal handler to oldact (SIG_DFL)
Prior to executing a new command restore the parent process to the
default SIG_DLF handler as we normally use SIG_IGN it to avoid
crashing on pasted input.

As we seem to be hitting a Broken Pipe message when running
certain scripts, it seem we need to restore back the
default handler.

This is similar to what other folks have been doing in
https://github.com/labwc/labwc/issues/1209.

Fixes: #994

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2025-03-13 10:37:08 +02:00
Marius Vlad
46f25304c1 meson.build: Bump libweston to 15
As we had changes like 9ae0a7ec and adeb634c which require a libweston major bump
uprev.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2025-03-07 14:30:20 +00: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
Robert Mader
82c5b386d8 meson: require libdisplay-info >= 0.2.0
We get rid of a little bit of fallback code, but the real reason is that
in the future the frontend will start using libdisplay-info as well, and
this lets us avoid adding fallback code there too.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2025-03-06 18:34:57 +00:00
Robert Mader
9f21128d78 gitlab-ci: Rebuild image with libdisplay-info to 0.2.0
Next we are going to make libdisplay-info 0.2.0 a hard requirement.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2025-03-06 18:34:57 +00:00
Pekka Paalanen
76e659f45e build: make libdisplay-info mandatory
Frontend will be needing it, too, so move it up. In doing so, we make it
a mandatory dependency of Weston. This should be fine, because it was
required by DRM-backend which is the foremost.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-03-06 18:34:57 +00: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
5beca735b0 backend-drm: Explicitly arm/disarm the page flip timer counter
when drm-backend debug scope is set.

This follows-up with the surface counter timer but because this is
buried in the drm-backend we make use the drm-backend scope if there's a
subscription to it and enable and arm the counter as well when that
happens.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2025-03-06 16:09:42 +02:00
Marius Vlad
cda8de1089 backend-drm: Count and display KMS page flips
This patch counts the page flips (either in atomic or legacy page flips)
for DRM outputs and prints them using the drm-backend scope.

Similar to the frame callback timer counter this installs a counter that
periodically computes page flips per a pre-defined interval.

This also includes a perfetto counter to display these in perfetto.

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
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
Erico Nunes
af95899121 gl-renderer: close gbm device fd on destroy
Trivial fix to get a clean valgrind fd report with gl-renderer.

Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
2025-03-04 14:18:27 +00:00
Derek Foreman
9660a4f315 desktop-shell: Use output shell_private data
Replace find_shell_output_from_weston_output with private data.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-03-04 12:30:51 +00:00
Derek Foreman
013c21ec38 desktop-shell: Store struct shell_output in internal structs
Similar to what's just been done to kiosk-shell, use our internal
shell_output instead of directly using weston_output in our internal
structures.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-03-04 12:30:51 +00:00