Commit Graph

9337 Commits

Author SHA1 Message Date
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
Jeffy Chen
623c7b5202 renderer-gl: Fix wrong stride error when reading pixels
The gl_renderer_do_read_pixels() is expecting stride in bytes.

Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
2024-01-16 22:18:30 +08:00
Derek Foreman
e74f2897b9 libweston: Clip damage to paint node visible region
commit 79212ba9ad fixed a bug by
introducing a new one.

Before that point we could clip paint node damage to stale
visibility data. After that point we post damage for occluded
views, leading to large amounts of pointless drawing.

Add back the clip to visible region, in
weston_output_flush_damage_for_plane(), where we have up to date
visibility region information.

fixes 79212ba9ad

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2024-01-15 14:03:41 +02:00
Colin Kinloch
3f919e3d92 clients/stacking: Fix widget user_data cast type
This used to not be a problem as both `struct stacking` and `struct
window` start with a pointer to `struct display`.

Signed-off-by: Colin Kinloch <colin.kinloch@collabora.com>
2024-01-15 13:57:08 +02:00
Chao Guo
8e0e75999e compositor: improve viewport source validity check
If client changes the buffer transform or size and re-commit the surface
before surface dirtys buffer (weston_surface_attach), the viewport
source validity check may fail. Because the width_from_buffer and
height_from_buffer cannot be updated based on new buffer transform.

Therefore, add the situation of size dirty (WESTON_SURFACE_DIRTY_SIZE) to
source validity check, width_from_buffer and height_from_buffer can be
updated in time when the buffer transform and scale change.

Signed-off-by: Chao Guo <chao.guo@nxp.com>
2024-01-12 13:44:03 +00:00
Zhou Liang
b288e662d6 backend-drm: fix deinit unexpected connector
The `drm_output_deinit` should use the drm device passed by the
function, should not use the `b->drm` device.

Signed-off-by: Zhou Liang <174381115@qq.com>
2024-01-12 12:11:45 +00:00
Zhou Liang
66aaa41074 backend-drm: fix drm add connector to unexpected drm device
If both the head and writeback are not found, then we should add
connectors to the drm device passed by the function, not the b->drm
device.

Signed-off-by: Zhou Liang <174381115@qq.com>
2024-01-12 12:11:45 +00:00
Zhou Liang
8b3becf524 backend-drm: fix drm find wrong connector
In a multi-GPU environment, different cards may contain connectors with the
same ID, and drm_head_find_by_connector just use the connector_id to find
the connector, it may find the wrong connector.
Fix this by find the connector based on the drm device and connector id.

Signed-off-by: Zhou Liang <174381115@qq.com>
2024-01-12 12:11:45 +00:00
Robert Mader
5a2509ffb1 backend-drm: Don't force non-opaque overlays to primary plane
If a view is non-opaque - such as an overlay over a video - we shouldn't
force it to be on the primary plane, as that's where the underlying
content should be placed, such as the video view.

dc0de9ee already mentioned: "This check should be changed in future to
only filter for opaque views, but that's for another time."

Adding "Fixes" at this is arguably a bug fix:
Fixes: dc0de9ee (backend-drm: Move overlay vs. primary plane check earlier)
Fixes: 2538aacc (backend-drm: Construct a zpos candidate list of planes)

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2024-01-11 15:57:09 +01:00
Derek Foreman
2abe4efcf7 libweston/backends: Move damage flush into backends
Currently we flush damage for the "primary plane" every repaint, but this
is folly.

The drm backend may skip rendering entirely if using an all-planes
composition. This could leave the renderer plane in a messy state if a
surface on an overlay plane disappears.

Instead, let the backends flush the primary plane damage when they know
they need to render.

Fixes #864

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2024-01-10 14:13:09 -06:00
Marius Vlad
04d9f7e738 libweston/animation: Remove weston_fade_run unused argument
And with it, bump libweston to next major version, 14. We seems like
we never used that argument so better just removed it.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2024-01-09 13:15:16 +02:00
Jeffy Chen
b074186836 libweston: Avoid double-destroy of animations
The idle_animation_destroy task should be removed when destroying
animations by the other callers such as handle_animation_view_destroy().

Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
2024-01-05 09:08:03 +08:00
Michael Olbrich
d6681cedee ivi-shell: clear seat focus if necessary when a surface is destroyed
Otherwise shseat->focused_ivisurf can point to deleted memory.
This does not happen with the hmi-controller because it explicitly assigns a new
focused surface. But the ivi-shell should not relay on the controller here.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2023-12-18 21:39:24 +00:00
Khem Raj
dbd134ca5a libweston,tools: Include libgen.h for basename signature
Latest musl has removed the declaration from string.h [1] as it only
implements POSIX version alone and string.h in glibc implements GNU
version of basename. This now results in compile errors on musl.

This might be a warning with older compilers but it is error with
Clang-17+ as it treats -Wimplicit-function-declaration as error

Switch the use in backlight_init function to use POSIX version

[1] https://git.musl-libc.org/cgit/musl/commit/?id=725e17ed6dff4d0cd22487bb64470881e86a92e7

Signed-off-by: Khem Raj <raj.khem@gmail.com>
2023-12-18 21:13:52 +00:00
Pekka Paalanen
336f7fabec Rename compositor/ to frontend/
"Frontend" is a much more descriptive name for the code that is in the
directory called "compositor".

Fixes: https://gitlab.freedesktop.org/wayland/weston/-/issues/633

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2023-12-18 15:34:26 +00:00
Pekka Paalanen
c36bbad8e2 tests: remove unnecessary weston.h includes
Looks like these don't actually need it.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2023-12-18 15:34:26 +00:00
Pekka Paalanen
b84ad9e34c libweston: drop weston_output_init() test workaround
This was added in 4def21c196.

0c1ab2ad76 removed all uses of NULL
weston_compositor, making the workaround unnecessary.

Drop the workaround, it's dead code.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2023-12-15 14:15:22 +02:00
Philipp Zabel
b72785e1f6 libweston-desktop: Work around crash when opening popup menu
Fix a crash when right-clicking on a weston-terminal, where
weston_desktop_seat_popup_grab_add_surface() is called with
seat->popup_grab.keyboard.keyboard == NULL in case there is
no keyboard connected.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-12-11 16:58:01 +01:00
Colin Kinloch
785f904142 clients/stacking: Allow windows to be closed
Signed-off-by: Colin Kinloch <colin.kinloch@collabora.com>
2023-12-08 17:36:20 +02:00
Derek Foreman
128a461b8f clients/simple-egl: Allow setting the swapinterval
eglSwapInterval() is intended to allow capping the frame rate to a divisor
of the display rate. This may not work if the GL library simple-egl is
using doesn't support it well.

It's still useful to test, so add a way to set it.

Signed-off-by: Derek Foreman <derekf.foreman@collabora.com>
2023-12-06 11:27:03 -06:00
Daniel Stone
a5c5702112 touch-calibrator: Regularise surface/view mapping
Manually mark the surface as mapped exactly once - in the committed
handler where we have our content, and assert that it's correct when we
want to use the surface by instantiating a view.

The view handling can be made much more simple by simply using the new
view helpers.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-12-06 12:16:27 +00:00
Daniel Stone
61c7afd520 fullscreen-shell: Don't leak outputs
Fixes a memory leak.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-12-06 12:16:27 +00:00
Daniel Stone
f6a9c3e69c fullscreen-shell: Properly map surfaces
Surfaces are mapped when they have content, and not when they don't. Try
to apply this rule consistently.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-12-06 12:16:27 +00:00
Daniel Stone
16825359c7 input: Use surface/view helpers for drag surfaces
Use the helpers we have to map and position drag icons.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-12-06 12:16:27 +00:00
Daniel Stone
6a44272d01 kiosk-shell: Remove unnecessary is_mapped assignment
Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-12-06 12:16:27 +00:00
Daniel Stone
7f62fe817a input: Use surface/view helpers to map
Use the helpers to map a weston_surface and weston_view, rather than
manually manipulating the internals.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-12-06 12:16:27 +00:00
Daniel Stone
1f9e0ce9ad input: Use helpers to map surfaces/views
When working on tablet tools, use the weston_surface and weston_view
helpers to manipulate their cursors, instead of manually setting various
members.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2023-12-06 12:16:27 +00:00
Philipp Zabel
ddf4327116 man: Document VNC --address argument
Add missing documentation for the --address command-line argument
that lets the VNC backend listen only on a specified IP address.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
2023-12-06 10:19:32 +01:00
Loïc Molinari
309a546165 gl-renderer: Improve clipper documentation
Add clipper_clip() documentation and improve comments a tiny bit.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
2023-12-05 10:54:39 +00:00