Commit Graph

9415 Commits

Author SHA1 Message Date
Loïc Molinari 343adb2acd tests: Speed up runtime using immediate repaint on capture
The test suite is throttled by the headless backend repaint
timer. This commit uses the headless refresh rate option to speed up
runtime by using the immediate repaint-only-on-capture mode by
default. Tests which don't support that mode yet override the refresh
value to use the highest rate possible.

Fixes #682

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2024-02-22 14:26:32 +00:00
Loïc Molinari 7b2eddf022 backend-headless: Add support to repaint only on captures
Damages and captures both trigger repaints of outputs. Some
configurations don't care about damages and use headless only for
captures. This commit adds a new feature to libweston that lets
outputs repaint only on captures, not on damages. The headless backend
enables that new feature when given a special refresh rate of 0 mHz.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2024-02-22 14:26:32 +00:00
Loïc Molinari 6caeba699d backend-headless: Add support for custom refresh rates
Custom headless refresh rates can be useful to instrument clients
matching different screen configurations. This commit adds support for
that to the headless backend and exposes it to the frontend with the
"--refresh-rate" CLI option. The default refresh value is still 60 Hz.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2024-02-22 14:26:32 +00:00
Leandro Ribeiro 6da5b8a5a5 color-noop: avoid assert hit in cmnoop_destroy()
When we are destroying the color manager, the components referencing
color profiles should have already been destroyed. We have an assert
in cmnoop_destroy() to make sure that the stock profile has refcount
equal to 1.

But we currently have an issue in Weston. While shutting down with
client surfaces alive, we may leak them. So we try to destroy
the color manager with surfaces still alive, and they may be
referencing color profiles.

We already have a workaround for this in our LittleCMS color plugin,
but we've missed that in color-noop. This fixes that, so now we don't
hit the assert anymore.

As we are already dealing with asserts in color-noop, I took the
liberty to replace the last usage of assert with our own wrapper
in this file.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2024-02-22 11:38:22 +00:00
Arnaud Vrac 238d5274a2 fullscreen-shell: do not crash when presenting a null surface
The protocol allows presenting a null surface, in this case we would crash. This
can be reproduced with weston-fullscreen and pressing 'o'.

Signed-off-by: Arnaud Vrac <avrac@freebox.fr>
2024-02-21 18:14:18 +02:00
Arnaud Vrac 373ee4df45 fullscreen-shell: restore focus when output is created
Keyboard focus is lost when the first output is created after a default surface
is picked. This can also happen after all outputs disappear and a new one is
created.

Signed-off-by: Arnaud Vrac <avrac@freebox.fr>
2024-02-21 18:14:18 +02:00
Arnaud Vrac acb1d6721e fullscreen-shell: handle output resize and move signals
Outputs are rendered incorrectly after they are resized or moved, so monitor
those events to reconfigure the output and schedule a repaint in this case.

Signed-off-by: Arnaud Vrac <avrac@freebox.fr>
2024-02-21 18:14:18 +02:00
Arnaud Vrac ccb6413aa1 fullscreen-shell: unregister output created listener on shell destroy
Signed-off-by: Arnaud Vrac <avrac@freebox.fr>
2024-02-21 18:14:18 +02:00
Jeffy Chen 9406664a54 backend-drm: Cleanup output's disable head list when destroying it
Avoid memory use-after-free when the trying to remove entries from an
already freed list later.

Also add missing removal in drm_output_detach_head() and drm_head_destroy().

Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
2024-02-21 11:14:23 +00:00
Diego Nieto 1db0da8c8d compositor/main: warn pipewire-output and remote-output
These warn let to recognize what can be the issue whether
pipewire-output or remote-output has been set but its
mode it is not. Without this log, if mode is not set,
the init just exits

Signed-off-by: Diego Nieto <diego.nieto.m@outlook.com>
2024-02-21 09:49:23 +00:00
Paul Pu 4eee3c816d Fix segfault when using fullscreen when just hotplugging the display
Set the fullscreen_output to NULL when output gets destroyed. Otherwise,
a use-after-free case can happen, which result in a SEGFAULT crash.

Fixes #766

Signed-off-by: Paul Pu <hui.pu@gehealthcare.com>
2024-02-21 17:22:31 +08:00
Diego Nieto 4261892d77 clients/simple-damage: fix exiting message
Signed-off-by: Diego Nieto <diego.nieto.m@outlook.com>
2024-02-20 10:04:57 +00:00
Leandro Ribeiro 0ade70fb6c tests: add tests for the color management protocol implementation
Exercise the color-management protocol mechanics.

This lacks a few test cases that are a bit harder to have, e.g. testing
that a bad ICC file gets rejected. In the future we plan to add them.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2024-02-14 12:13:04 -03:00
Leandro Ribeiro 67c6d39634 tests: allow to expect protocol errors from unknown objects
wl_display_get_protocol_error() takes a pointer to interface as
parameter and may set it to NULL when the error comes from an unknown
interface.

That can happen when the client destroys the wl_proxy before calling
this function. So when the wl_display.error event comes, it will refer
to an object id that has already been marked as deleted in the
client's object map. So the protocol error interface will be set to
NULL and its id to 0.

In our test suite, expect_protocol_error() ignores such case, and
asserts that a interface != NULL is set. This commit fixes that, and
now callers are able to call expect_protocol_error() when they expect
errors from unknown objects.

In the next commit we add the color-management protocol implementation
tests, and that requires such case to work.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2024-02-14 12:13:04 -03:00
Leandro Ribeiro 39ada71cb3 gitlab-ci: build and install LittleCMS version 2.16
When using some features from LittleCMS in our CI, we are seeing some
crashes on the address sanitizer. Bumping the LittleCMS version fixes
that. So build and install a more recent version of LittleCMS on our CI.

We chose version 2.16 because it introduces the function
cmsGetToneCurveSegment(). We already make extensive use of that in our
codebase, so it is a good idea to have that on our CI as well.

Now color-curve-segments.c will start to get build on the CI, as
HAVE_CMS_GET_TONE_CURVE_SEGMENT will be true. So we also fix a minor
issue in which we were comparing int with uint in this file, what was
caught after experimenting bumping the LittleCMS version.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2024-02-14 12:13:04 -03:00
Leandro Ribeiro 188a3ebd5e libweston: expose color management support
In this patch we enable the color-management protocol support, as long
as the color-manager plugin in use supports it.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2024-02-14 11:15:35 -03:00
Leandro Ribeiro 5706d7e5d2 color: add support to the color-management protocol
In this MR we add support to the majority of the interfaces from the
color-management protocol.

That means that we are able to advertise output's images descriptions to
clients, preferred surface images descriptions, and so on. We also
support clients that wants to create ICC-based images descriptions and
set such descriptions for surfaces.

We still don't support the interface to allow clients to create
image descriptions from parameters, but that should be addressed
in the near future.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2024-02-14 11:15:35 -03:00
Leandro Ribeiro c7d33edd01 color: add color properties helper
Similar to pixel-formats.c, but for color properties. This helper
aggregates the same color properties from different APIs into tables,
and introduce functions to use that.

The idea is that we only use that internally in our libweston struct's,
and pick the specific API value only when necessary.

Preparation for the CM&HDR protocol extension implementation.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2024-02-13 14:15:31 -03:00
Leandro Ribeiro 01b43e5294 protocol: add color-management-v2.xml
This does not implement the protocol, it will simply run the scanner
on the xml to generate the .c and .h files.

This is a variant of the color-management protocol that still didn't
land upstream on the wayland-protocols repository.

We are using that to experiment with the protocol, but we'll
completely drop this eventually, when the official protocol
lands.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2024-02-13 14:15:31 -03:00
Leandro Ribeiro a84806a88e libweston: add unique id generator
This is preparation for the CM&HDR protocol implementation. It requires
us to give a unique id to each color-profile, so let's do that.

In this commit we introduce a generic id generator to libweston, and
its first user: the color-profile.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2024-02-13 14:08:38 -03:00
Leandro Ribeiro ba1561946f shared: include missing header to weston-assert
We forgot to include stdbool to weston-assert.h, but this was not
causing issues because callers of weston_assert_true() themselves
include stdbool.

Add stdbool to weston-assert, as this is the right thing to do.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2024-02-13 08:59:57 -03:00
Leandro Ribeiro a2f99828fe color: always set HAVE_LCMS when LittleCMS dependency is found
Up to now, HAVE_LCMS would be set only when users would build Weston
with the deprecated cms-static enabled. But we'll start using this in
libweston in the next commits, independently of cms-static being enabled
or not. So always set HAVE_LCMS when the LittleCMS dependency is found.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2024-02-13 08:59:57 -03:00
Leandro Ribeiro bac9060d54 tests: make use of helpers to create unique filenames
Start to use the helpers introduced in "tests: add helpers to create
unique filenames".

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>

Pekka: Dropped program name from output_filename_for_test_case() calls
as it is already added automatically.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2024-02-12 14:10:44 +00:00
Leandro Ribeiro d29f904bec tests: add helpers to create unique filenames
With such helpers we are able to create unique filenames for a test
program, a fixture or specific test cases.

This help us to avoid accidents related to using files from other
tests or overriding them.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2024-02-12 14:10:44 +00:00
Leandro Ribeiro ac3e416402 tests: move functions that create ICC profiles to lcms_util.c
We'll need to craft ICC profiles in the CM&HDR protocol implementation
tests. So move it from color-icc-output-test.c to the LittleCMS helper
in our test suite.

This also removes some unused headers from color-icc-output-test.c, as
we've moved a bunch of code to the LittleCMS helper.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2024-02-12 14:10:44 +00:00
Morgane Glidic 0de497f868
libweston/desktop: Update my Copyright
Signed-off-by: Morgane Glidic <sardemff7+git@sardemff7.net>
2024-02-11 19:07:39 +01:00
Loïc Molinari 5516527f2b tests: Add box32 quad clipper tests
Add a few tests ensuring the box32 quad clipping wrapper works as
expected.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2024-02-06 09:21:11 +00:00
Loïc Molinari e82ce8032c gl-renderer: Fix quad clipper non-zero area check
The non-zero area check of clipper_quad_clip() is incorrect for quads
initialized with a polygon starting with a vertical edge. In order to
handle polygons starting with an horizontal edge and polygons starting
with a vertical one, it must check opposite vertices for equality.

The test previously described as "Box intersects entire smaller
aligned quad" is now described as "Clockwise winding and top/left
initial vertex". This test keeps the same values as before but all
combinations of winding order and first edge orientations are
also tested. The QUAD() macro isn't used anymore to do so.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2024-02-06 09:21:11 +00:00
Loïc Molinari 1f9637ec8e tests: Add quad clipper tests
Add quad clipping tests checking intersections at all edges and
corners of axis-aligned and unaligned quads with negative and positive
values.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2024-02-06 09:21:11 +00:00
Loïc Molinari 60877f5f55 tests: Improve general purpose clipper tests
Simplify box and quad declarations using dedicated macros.

Hard-coded literals are used instead of preprocessor constants for the
sake of brevity and because, as several new tests will be added, it
appears to be easier to understand those when values are inlined.

Descriptions have been revised to better understand the intent of each
test. Previous descriptions used a coord system with Y pointing up,
new descriptions use Y pointing down in order to improve consistency
with the rest of the code base and to have a common ground when
talking about winding order.

All the tests keep the same input values with the exception of the
last 2 tests with (new) descriptions: "Rotated quad with edges
adjacent to box corners" and "Rotated quad with edges cutting out box
corners". These tests had a different winding order and have been
modified so that all tests use a clockwise order (new axis
convention). The last test also gets a counter-clockwise version in
order to ensure the opposite winding order is correctly supported too.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2024-02-06 09:21:11 +00:00
Loïc Molinari aca0b69a0a tests: Improve clipper test function
When the first vertex passed to the clipper is clipped into two
vertices, the second vertex can sometimes be emitted as the first
clipped vertices while the first vertex is emitted as the last one. A
new utility function assert_vertices() is added to handle that
case. The function also checks the number of clipped vertices and the
clipped vertices in one go.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2024-02-06 09:21:11 +00:00
Jeffy Chen 5dbf96fb6c desktop-shell: Avoid using maximized size in fullscreen state
The fullscreen should take precedence if the client requests both
window states at the same time.

Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
2024-02-02 19:44:31 +08:00
Marius Vlad 18eebe8af3 compositor/main: Warn out if started over tty/pts
A possible solution to warn out users that messages will be dropped
otherwise.

Fixes: #858

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2024-02-01 11:09:31 +00:00
Pierre Le Marre 8aa14f0d39 simple-im: Fix modifiers
There is a typo in the call to `zwp_input_method_context_v1_modifiers`:
the `mods_latched` and `mods_locked` arguments have wrong values.

Fixed by forwarding the correct masks.

Signed-off-by: Pierre Le Marre <dev@wismill.eu>
2024-01-30 17:29:39 +00:00
Pekka Paalanen f880732004 backend-drm: rename eotf_list to str
I want re-use this variable for printing the colorimetry mode list as
well in a future patch, so a generic name is less confusing.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2024-01-29 15:22:33 +02:00
Pekka Paalanen fc0a74a4c9 backend-drm: skip EDID parsing if no change
Performance-wise this is moot, but since we are detecting if the raw
EDID data changed, might as well use it.

Now we have a path where the head's device_changed is almost guaranteed
since EDID changed, and that's useful for the next patch.

We can only do this, because the core initializes a head with values
that we would be setting anyway when EDID is missing, e.g. disconnected
head on compositor start-up.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2024-01-29 15:22:27 +02:00
Pekka Paalanen 2c0a9c064a backend-drm: store EDID data
Store the EDID data as-is, so that we can tell when the EDID blob has
changed. This is not too useful yet, because all the weston_head_set_*()
API raises the device_changed flag only if the information actually
changes. However, I want to expose the libdisplay-info di_info structure
through weston_head, and those cannot be (as) easily compared.

We need to know when the EDID blob changes, so we can call
weston_head_set_device_changed() appropriately when updating di_info.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2024-01-29 15:20:04 +02:00
Pekka Paalanen 4a028ade32 tests: conditionally skip part of alpha-blending
One of the three fixture setups of alpha-blending test requires
color-lcms.so. If color-lcms.so is not built, that fixture fails.

Make it skip as necessary, making the test suite pass with
color-management-lcms=false build option.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2024-01-26 14:31:35 +02:00
Pekka Paalanen f18455c3a8 tests: remove color-manager test
This is very trivial test, which does not skip correctly when built with
color-management-lcms=false. It fails instead.

Since alpha-blending test already covers everything that color-manager
test did, remove color-manager test.

My editor eliminated a stray whitespace, too.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2024-01-26 14:19:12 +02:00
Nicholas Niro ab747b7c79 man: Document the new 'command input' feature
Added an entry with examples into the man page and also
into frontend/main.c for the '--help' interface.

Signed-off-by: Nicholas Niro <blowfist@xroutine.net>
2024-01-26 09:32:46 +00:00
Nicholas Niro 288f552275 compositor: Add support for a command input.
This command is being executed in parallel with the westen instance,
just like the autolaunch config.

I recently came across the kiosk-shell and found out I could start a program exclusive
weston instance using it and that opened my eyes to new possibilities.

With the desktop-shell, it is necessary to set up quite a few options like the panel launchers,
the background image/color and a few other things and that indeed make the configuration file mandatory.

With the kiosk-shell all you really care about is the underlying program,
the vast majority of the configuration file options are not relevant for that shell.
That made me wonder how convenient it would be to forego the configuration file
and implement the autolaunch option directly in the weston program. That indeed worked pretty
well and that is why I decided to propose this merge request.

I think this avenue opens up a different set of uses cases for weston where rather than just have one
"big" desktop-shell instance, we could have multiple smaller and potentially specific usage instances.
Yes, it can be done with configuration files currently. But what it boils down to is convenience.
Maybe this convenience will enable other people to start more than just one weston instance
in the future. For instance, to quickly watch an image or opening up a pdf file.

This patch was made in a matter that is meant to be consistent with the intuitive
way other programs accept a command input, like so :

weston <some options> -- some_command option1 ... optionN

Further work would be necessary to remove the requirement for the '--'
option. To do that, we would need to check if the option is a valid command
and not just a mistyped option.

There may be some conflict with the current autolaunch implementation.
I'm not sure if both 'command' and 'autolaunch' could be used at the
same time using this implementation. I think it would be necessary to
have a distinct watch and pid variable in the 'wet' context variable
for the command to support this.

Signed-off-by: Nicholas Niro <blowfist@xroutine.net>
2024-01-26 09:32:46 +00:00
Nicholas Niro 10a455f2ba option-parser: Add support for the '--' options
This toggles parse_options to ignore the rest of the remaining
options.

Signed-off-by: Nicholas Niro <blowfist@xroutine.net>
2024-01-26 09:32:46 +00:00
Dylan Aïssi 7e150101ba man: fix typos
Signed-off-by: Dylan Aïssi <dylan.aissi@collabora.com>
2024-01-25 21:43:24 +01:00
Dylan Aïssi 0f260b4f78 backend-rdp: fix typo: chunck -> chunk
Signed-off-by: Dylan Aïssi <dylan.aissi@collabora.com>
2024-01-25 21:42:49 +01:00
Dylan Aïssi 884b4a8c9a clients: fix typo: intialized -> initialized
Signed-off-by: Dylan Aïssi <dylan.aissi@collabora.com>
2024-01-25 21:41:34 +01:00
Robert Mader e34e027515 backend-drm: Sort planes by faked zpos
Just like we already do for planes with proper zpos. Otherwise we'll
often end up choosing the primary plane instead of an overlay one
in `drm_output_find_plane_for_view()`.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2024-01-22 17:16:19 +01:00
Ray Smith 885c616589 backend-drm: fix confused fallback format handling
This seems to think formats needs to be NULL terminated, but it doesn't
and gl_renderer_get_egl_config asserts that all formats_count elements
are not NULL.

This happens when EGL_KHR_no_config_context is not supported.

Signed-off-by: Ray Smith <rsmith@brightsign.biz>
2024-01-22 09:29:01 +00:00
Robert Mader e37454a262 linux-dmabuf: Add support for protocol version 5
It adds the followig paragraph:
```
Starting from version 5, the invalid_format protocol error is sent if
all planes don't use the same modifier.
```

We already assumed this in some places and, most importantly, it's
required by the kernel. Thus alter `dmabuf_attributes.modifier` to make
it clear that different modifiers for multi-planar dmabufs were never
supported.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2024-01-19 18:59:22 +01:00
Robert Mader be201fc204 gitlab-ci.yml: Bump wayland-protocols to 1.33
Signed-off-by: Robert Mader <robert.mader@collabora.com>
2024-01-19 18:59:22 +01:00
Jeffy Chen e454de5af3 renderer-gl: Fix segfault when reading pixels
We should use the actual stride to create tmp pixmap.

Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
2024-01-16 22:18:30 +08:00