-
f1cc5d0c
by Simon Ser
at 2021-01-27T18:45:57+01:00
build: re-open master for regular development
-
efab3964
by Tadeo Kondrak
at 2021-01-27T17:49:10+00:00
protocol: Add type attribute to events
This allows specifying events to be destructors, which is useful for
non-C language bindings. It is unused in wayland-scanner.
Signed-off-by: Tadeo Kondrak <me@tadeo.ca>
-
ddf21afa
by Tadeo Kondrak
at 2021-01-27T17:49:10+00:00
protocol: Specify wl_callback::done to be a destructor event
It's the only destructor event in the core protocol, and destructor
events were previously unannotated.
Signed-off-by: Tadeo Kondrak <me@tadeo.ca>
-
70f1c83f
by sheepwall
at 2021-02-22T19:09:08+01:00
server: remove duplicate include
Signed-off-by: August Svensson <a.sve@live.se>
-
727c7903
by Simon Ser
at 2021-02-25T23:49:00+01:00
client: assert queue display matches proxy
In wl_proxy_set_queue, passing a wl_event_queue from a completely
unrelated wl_display could lead to object IDs mismatches.
Add an assertion to catch this case. It's always a user bug if this
happens.
Signed-off-by: Simon Ser <contact@emersion.fr>
-
2b22160f
by Vlad Zahorodnii
at 2021-03-05T09:12:33+00:00
server: add wl_display getter for wl_global
This can be useful if the compositor wants to call wl_global_destroy() with some
delay but it doesn't have the wl_display object associated with the global,
which is needed to get access to the event loop.
Signed-off-by: Vlad Zahorodnii <vlad.zahorodnii@kde.org>
-
3bda3d1b
by Simon Ser
at 2021-03-05T09:15:04+00:00
build: drop autotools
Meson now replaces autotools.
Signed-off-by: Simon Ser <contact@emersion.fr>
-
1349d3d1
by Alex Richardson
at 2021-03-22T14:05:11+00:00
Use MAP_FAILED instead of (void *) -1
While MAP_FAILED is generally defined to that value, we should not be
relying on implementation details of system headers.
Signed-off-by: Alex Richardson <Alexander.Richardson@cl.cam.ac.uk>
Reviewed-by: Simon Ser <contact@emersion.fr>
-
d224e6cc
by Jonas Ådahl
at 2021-03-26T17:24:47+01:00
ci: Use ci-fairy to check for Signed-off-by
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
-
e4659ffb
by Michael Weiss
at 2021-04-02T20:55:15+02:00
meson: Only require expat when building wayland-scanner
This code is only required for building wayland-scanner so it should be
scoped accordingly. libxml-2.0 will only be required if both "scanner"
and "dtd_validation" are set to true.
Signed-off-by: Michael Weiss <dev.primeos@gmail.com>
-
e8819349
by Alex Richardson
at 2021-04-15T07:34:53+00:00
os-wrappers-test.c: Correctly forward arguments to fcntl
We can't just unconditionally read the optional arguments (and also read
it as a void* despite actually being an int).
While this happens to work on most architectures because the first few
variadic arguments are passed in registers, this is non-portable and
causes a crash on architectures that set bounds on variadic function
arguments (for example CHERI-enabled architectures). It could also cause
problems on big-endian architectures that pass variadic arguments on the
stack rather than in registers.
For CHERI-MIPS, reading sizeof(void*) causes a read of 16 bytes from the
bounded varargs capability. This always crashes since even calls with the
optional argument only have 4 bytes available.
Signed-off-by: Alex Richardson <Alexander.Richardson@cl.cam.ac.uk>
Reviewed-by: Simon Ser <contact@emersion.fr>
-
34306efe
by Alex Richardson
at 2021-04-15T07:34:53+00:00
Change wl_os_dupfd_cloexec minfd to be int
The fcntl() argument is defined to be an int and not a long. This does not
matter on most architectures since the value is passed in registers, but
it causes issues on big-endian architectures that pass variadic arguments
on the stack.
Signed-off-by: Alex Richardson <Alexander.Richardson@cl.cam.ac.uk>
Reviewed-by: Simon Ser <contact@emersion.fr>
-
4c210531
by James Hilliard
at 2021-04-16T03:04:56-06:00
meson: only require cpp for tests
Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
-
88f1605a
by James Hilliard
at 2021-04-16T03:45:06-06:00
build: add option to disable tests
When building for a product, tests are not needed.
Besides, one test requires a C++ compiler, which is not always
available.
So, add an option to configure to disable building tests altogether.
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
-
0aebb5b9
by Alexander Dunaev
at 2021-04-27T11:16:17+00:00
cursor: add one more directory to XCURSORPATH
The user may install cursor themes manually, and the desktop environment
may provide a special directory for storing them. For instance, GTK puts
those themes into ~/.local/share/icons, and many Linux distributions suggest
using that directory for user-specific themes. However, users of
libwayland-cursor cannot load these themes using the API provided by the
library because the latter does not look into that directory.
This patch adds ~/.local/share/icons to the search path, so user-specific
themes can be loaded through the API provided by libwayland-cursor.
Signed-off-by: Alexander Dunaev <adunaev@igalia.com>
Reviewed-by: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
Reviewed-by: Simon Ser <contact@emersion.fr>
-
ed554383
by Tobias Stoeckmann
at 2021-05-02T21:35:23+02:00
cursor: fix CVE-2013-2003
The libXcursor fix for CVE-2013-2003 has never been imported into
wayland, leaving it vulnerable to it.
Changing the argument type to an unsigned type is an effective merge of
Ilja Van Sprundel's commit in libXcursor.
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
-
208fc99e
by Nick Diego Yamane
at 2021-05-04T15:26:48+00:00
Document serial param usage in wl_pointer.set_cursor
Serial is supposed to contain the latest wl_pointer.enter value received
by clients but it was not even mentioned in the docs, so add it to avoid
misinterpretations.
Signed-off-by: Nick Diego Yamane <nickdiego@igalia.com>
-
e475decf
by Marius Vlad
at 2021-05-07T11:07:54+03:00
src: Add missing new lines to log messages
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
-
f452e412
by Simon Ser
at 2021-05-10T22:08:45+00:00
build: replace assembly embedding with Python script
This allows Meson to properly track dependencies and re-build the scanner when
editing the dtd. We also stop depending on GNU as' .incbin and make the
embedding less obscure.
Signed-off-by: Simon Ser <contact@emersion.fr>
-
f8bea245
by Simon Ser
at 2021-05-27T10:48:40+02:00
protocol: drop reference to wl_drm
Change the wl_drm reference to linux-dmabuf. wl_drm is a legacy,
private Mesa protocol that shouldn't be used by regular clients.
Signed-off-by: Simon Ser <contact@emersion.fr>
-
abcf1048
by Tobias Stoeckmann
at 2021-06-02T13:46:33+00:00
cursor: fix crash with weird input files
If a cursor file contains multiple images for the same size, this
typically indicates an animation. The compositor weston uses
wl_cursor_frame_and_duration to figure out at which time a specific image
should be shown.
The total delay is the sum of all image delays. But if all images have a
delay of 0, the total delay is 0 as well. The code does not check for this
special condition and triggers a floating point exception by eventually
performing a modulo operation with 0.
This, of course, could also happen if the sum of all image delays
triggers an unsigned int overflow. But since a comment in the code
already indicates that it does not try to "fix" handling of weird files,
I would argue that it's "okay" if that happens. At least the program
won't crash.
Proof of Concept:
install -D ~/.icons/poc/cursors
base64 -d > ~/.icons/poc/cursors/left_ptr << EOF
WGN1chAAAAAAAAEAAgAAAAIA/f8BAAAAKAAAAAIA/f8BAAAAKAAAACQAAAACAP3/AQAAAAEAAAAB
AAAAAQAAAAEAAAABAAAAAAAAAAAAAAA=
EOF
cat > /tmp/weston.ini << EOF
[shell]
cursor-theme=poc
EOF
weston -c /tmp/weston.ini
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
-
ba0c63de
by Simon Ser
at 2021-06-10T14:33:32+00:00
shm: remove wl_shm_buffer.pool NULL checks
wl_shm_buffer.pool is never set to NULL. The only time it's set is
in shm_pool_create_buffer, and the pool is guaranteed to be non-NULL
there.
Signed-off-by: Simon Ser <contact@emersion.fr>
-
3e897faa
by Simon Ser
at 2021-06-11T14:05:27+00:00
protocol: allow immediate wl_buffer.destroy if not re-used
Allow wl_buffer objects to be destroyed without having to wait for
wl_buffer.release if the underlying storage isn't going to be
re-used.
The main motivation for this is to avoid glitches when a client is
torn down. When a client disconnects, all of its objects are destroyed
in arbitrary order. However some compositors will still need to
access the destroyed buffer's underlying storage afterwards, e.g. for
visual effects (fade-out) or for atomic layout updates (wait for other
clients to commit a new buffer before hiding the buffer).
It's still incorrect for clients to destroy a wl_buffer and mutate
the underlying storage without waiting for wl_buffer.release.
Signed-off-by: Simon Ser <contact@emersion.fr>
Closes: https://gitlab.freedesktop.org/wayland/wayland/-/issues/185
-
4f53613e
by Fergus Dall
at 2021-06-22T20:15:32+10:00
connection-test: Encode size in message headers correctly
In these tests, message sizes are inconsistently encoded in either the upper
or lower 16 bits of the second word of the message. Resolve this in favour
of using the upper 16 bits, as this is how messages are supposed to be
encoded, even though that aspect of message decoding isn't being tested
here.
Signed-off-by: Fergus Dall <sidereal@google.com>
-
ccc9612e
by Fergus Dall
at 2021-06-22T20:15:39+10:00
connection: Handle non-nullable strings in wl_connection_demarshal
Currently a null string passed into a non-nullable argument of a message
will decode succesfully, probably resulting in the handler function
crashing. Instead treat it the same way we do non-nullable objects and ids.
Signed-off-by: Fergus Dall <sidereal@google.com>
-
817fdb90
by Simon Ser
at 2021-06-29T11:17:44+02:00
shm: add safety assertions
Catch any API mis-use with an assert. This should abort when the
user calls unreferences the pool more times than it's referenced.
Also change the refcount check to explicitly check for positive
counts. That makes the condition more readable.
Signed-off-by: Simon Ser <contact@emersion.fr>
-
92038fa3
by Pekka Paalanen
at 2021-07-01T16:28:08+03:00
CI: turn on ASan and UBSan
I just noticed that libwayland test suite is ASan and UBSan clean, so
let's turn that on in CI to avoid regressing.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
-
767765d5
by Simon Ser
at 2021-07-06T11:57:39+00:00
protocol: clarify wl_seat.name description
Define the expected properties of the seat name.
Signed-off-by: Simon Ser <contact@emersion.fr>
-
51d336ec
by James Legg
at 2021-07-07T12:11:42+00:00
scanner: Use descriptions in entries
entry may have a description according to the DTD. This is used in
some protocols including xdg-shell.
Fixes the code comment on an enum declaration using the description of
the last enum that had one, adds the descriptions to the comments on
enumerators, and avoids leaking the previously missing descriptions.
Fixes #208
Signed-off-by: James Legg <lankyleggy@gmail.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
-
b7153f22
by James Legg
at 2021-07-07T12:11:42+00:00
tests: Test wayland-scanner with a description in an entry
This previously would have caused a memory leak and incorrect
comments.
Signed-off-by: James Legg <lankyleggy@gmail.com>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
-
8899310f
by Simon Ser
at 2021-07-13T15:52:31+02:00
shm: document wl_shm_buffer
The main motivation is to make it clear when a wl_shm_buffer is
destroyed.
Signed-off-by: Simon Ser <contact@emersion.fr>
-
13ccd1c4
by Pekka Paalanen
at 2021-07-14T07:21:40+00:00
wayland-util: avoid memcpy(NULL) in wl_array_copy()
The problem was found running Weston, with both Weston and Wayland built
with ASan:
../../git/wayland/src/wayland-util.c:150:2: runtime error: null pointer passed as argument 1, which is declared to never be null
../../git/wayland/src/wayland-util.c:150:2: runtime error: null pointer passed as argument 2, which is declared to never be null
This turns out to be caused by copying an empty array into an empty
array.
That seems to be completely valid thing to do, and wl_array_init()
initializes the pointers to NULL and size to zero. Copying initialized
arrays must always be valid.
The error are caused by calling memcpy() with NULL pointers. It doesn't
explode, because also the size is zero.
Fix the problem by calling memcpy() only if size is not zero. This
should keep things like copying an empty array into a non-empty array
work.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
-
ada25fbd
by Manuel Stoeckl
at 2021-07-20T09:20:38+00:00
client: print discarded events in debug log
Before this patch, setting WAYLAND_DEBUG=1 or WAYLAND_DEBUG=client made
a program log all requests sent and events that it processes. However,
some events received are not processed. This can happen when a Wayland
server sends an event to an object that does not exist, or was recently
destroyed by the client program (either before the event was decoded,
or after being decoded but before being dispatched.)
This commit prints all discarded messages in the debug log, producing
lines like:
[1234567.890] discarded [unknown]@42.[event 0](0 fd, 12 byte)
[1234567.890] discarded wl_callback@3.done(34567)
[1234567.890] discarded [zombie]@13.[event 1](3 fd, 8 byte)
The first indicates an event to an object that does not exist; the
second, an event to an object that was deleted after decoding, but
before dispatch; the third, an event to an object that left a
'zombie' marker behind to indicate which events have associated
file descriptors.
Signed-off-by: Manuel Stoeckl <code@mstoeckl.com>
-
80164ef3
by Fergus Dall
at 2021-07-21T11:42:42+00:00
util: Avoid undefined behaviour in for_each_helper
for_each_helper tries to calculate a one-past-the-end pointer for its
wl_array input. This is fine when the array has one or more entries, but we
initialize arrays by setting wl_array.data to NULL. Pointer arithmetic is
only defined when both the pointer operand and the result point to the same
allocation, or one-past-the-end of that allocation. As NULL points to no
allocation, no pointer arithmetic can be performed on it, not even adding 0,
even if the result is never dereferenced.
This is caught by clang's ubsan from version 10.
Many tests already hit this case, but I added an explicit test for iterating
over an empty wl_map.
Signed-off-by: Fergus Dall <sidereal@google.com>
-
f6b78b76
by Fergus Dall
at 2021-07-21T11:42:42+00:00
server: Fix undefined behavior in wl_socket_init_for_display_name
This function constructs a socket path in sun_path using snprintf, which
returns the amount of space that would have been used if the buffer was
large enough. It then checks if this is larger then the actual buffer size
and, if so, returns ENAMETOOLONG. This is correct.
However, after calling snprintf and before checking that the length isn't too
long, it tries to compute a pointer to the part of the path that matches the
input name. It does this by adding the computed path length to the pointer to
the start of the path buffer, which will take it to one-past the null
terminator, and then walking backwards. If the path fits in the buffer, this
will take it at most one-past-the-end of the allocation, which is allowed, but
if the path is longer then the buffer then the pointer addition is undefined behavior.
Fix this by moving the display name computation past the check that the path
length is not too long.
This is detected by the test socket_path_overflow_server_create under ubsan.
Signed-off-by: Fergus Dall <sidereal@google.com>
-
e5c3ac9b
by Fergus Dall
at 2021-07-22T22:27:45+00:00
connection-test: Pad out strings with null bytes
The connection_demarshal test writes a 10 byte string into a wayland message,
but doesn't pad it out to a four byte boundary. This leads to the last 32-bit
word of the message being partially uninitialized, which triggers an msan
violation when the message is written to the socket.
Signed-off-by: Fergus Dall <sidereal@google.com>
-
91d98b62
by Fergus Dall
at 2021-07-22T22:27:45+00:00
os-wrappers-test: Make syscall intercepts work with sanitizers
Sanitizers need to intercept syscalls in the compiler run-time library, as
do these tests. We try to make this work by using dlsym(RTLD_NEXT) to find
the next definition in the chain, but here this approach won't work because
the compiler run-time library is linked into the same elf object as the test
interceptors are.
The sanitizer library supports this by giving the intercept functions a
prefix and making them only weakly alias the real names, so our interceptors
can call the sanitizers interceptors explicitly, which will then use dlsym
to call the real function.
By making our declarations of the sanitizer interceptor function weak we can
handle any combination of intercepts (including none, if there is no
sanitizer). If our declaration is resolves to a NULL pointer, we just use
dlsym.
Signed-off-by: Fergus Dall <sidereal@google.com>
-
2f05ceeb
by Manuel Stoeckl
at 2021-07-31T16:49:54+00:00
connection, client: Avoid locale-dependent float printing
Specifically, in the log formed when WAYLAND_DEBUG is set, this commit
ensures that floating point numbers are formatted using '.' instead of
the locale-specific decimal separator. As the debug logs are not
otherwise localized for end-users, and may be parsed by scripts, it is
better to have consistent output here.
The 24.8 fixed point numbers are now represented with 8 digits after
the decimal, since this is both exact and simpler to compute.
Signed-off-by: Manuel Stoeckl <code@mstoeckl.com>
-
2aa0a83d
by Simon Ser
at 2021-07-31T16:54:57+00:00
connection: print array size
This makes it easier to understand how an xdg_toplevel is configured for
instance.
Signed-off-by: Simon Ser <contact@emersion.fr>
-
7940bbb7
by Daniel Stone
at 2021-08-03T21:10:51+01:00
ci: Add comments, rename build stages
No non-cosmetic changes, just making things more accessible.
Signed-off-by: Daniel Stone <daniels@collabora.com>
-
b88e1d40
by Daniel Stone
at 2021-08-03T21:22:15+01:00
ci: Parameterise and template build
This will make it a lot easier to add other variants later.
Signed-off-by: Daniel Stone <daniels@collabora.com>
-
33767673
by Daniel Stone
at 2021-08-04T18:16:55+01:00
ci: Add AArch64 build
Signed-off-by: Daniel Stone <daniels@collabora.com>
-
c4865c77
by Daniel Stone
at 2021-08-04T18:16:59+01:00
ci: Add ARMv7 build
Signed-off-by: Daniel Stone <daniels@collabora.com>
-
e4deb4dc
by Daniel Stone
at 2021-08-04T18:16:59+01:00
ci: Only run ci-fairy on MRs
This requires adding rules to all the jobs, as it's all or nothing.
Signed-off-by: Daniel Stone <daniels@collabora.com>
-
705154a0
by Daniel Stone
at 2021-08-04T18:16:59+01:00
ci: Use consistent YAML indendation
Signed-off-by: Daniel Stone <daniels@collabora.com>
-
71ff5fe0
by Daniel Stone
at 2021-08-04T18:20:26+01:00
ci: Add release builds
Signed-off-by: Daniel Stone <daniels@collabora.com>
-
0d3e47ab
by Daniel Stone
at 2021-08-04T18:20:27+01:00
ci: Use appropriate concurrency level
The appropriate concurrency level is not necessarily the number of
available CPUs; limit it to what the runners tell us we should be using.
Signed-off-by: Daniel Stone <daniels@collabora.com>
-
7769b631
by Daniel Stone
at 2021-08-04T18:20:27+01:00
ci: Use Werror
No point warning on stuff if we don't make it fail.
Signed-off-by: Daniel Stone <daniels@collabora.com>
-
c4453ce1
by Daniel Stone
at 2021-08-04T18:20:27+01:00
ci: Sanitise build and install paths
No sense in generating enormously long paths. This also happens to fix
artifacts not actually recording anything because we had a mismatch in
artifact paths vs. actual paths.
Signed-off-by: Daniel Stone <daniels@collabora.com>
-
f80879c0
by Olivier Tilloy
at 2021-08-05T17:09:40+02:00
cursor: Try to fall back to a default xcursor theme first
The use case is systems where for some reason the current xcursor theme
cannot be accessed (an application packaged as a strictly confined snap,
for example).
Before falling back to wayland's default cursor theme, it is worth
trying the xcursor theme called "default", which hopefully looks better
than the former.
Fixes: https://gitlab.gnome.org/Community/Ubuntu/gnome-sdk/-/issues/6
Signed-off-by: Olivier Tilloy <olivier.tilloy@canonical.com>
-
2dfa0dcb
by Simon Ser
at 2021-08-05T17:24:02+02:00
cursor: rename load_default_theme to load_fallback_theme
The theme getting loaded by this function is not to be confused
with the theme named "default" located on the filesystem. Instead,
it's a minimal theme directly bundled into libwayland-cursor.
Make this clearer by naming this theme "fallback".
Signed-off-by: Simon Ser <contact@emersion.fr>
-
6ebe3cfe
by Simon Ser
at 2021-08-06T09:26:03+00:00
cursor: remove unused wl_cursor_theme.name
Let's just delete this field since it's not used anywhere and not
exposed in our public API.
Signed-off-by: Simon Ser <contact@emersion.fr>
-
942f1d88
by Derek Foreman
at 2021-08-07T11:53:23+00:00
client: Refactor wl_proxy_destroy critical section
Split wl_proxy_destroy into two pieces, wl_proxy_destroy_unlocked which
performs the critical section code with no locking, and wl_proxy_destroy
which locks before calling that.
We'll use the new unlocked variant later in code that already holds the
lock.
There is a slight functional change - an aborting check is now called
with the lock held. This should be harmless as wl_abort() performs
no locking.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
-
23e4a706
by Derek Foreman
at 2021-08-07T11:53:23+00:00
client: Add new proxy marshalling functions with flags
There's a race when destroying wayland objects in a multi-threaded client..
This occurs because we call:
wl_proxy_marshal(foo);
wl_proxy_destroy(foo);
And each of these functions takes, and releases, the display mutex.
Between the two calls, the display is not locked.
In order to allow atomically marshalling the proxy and destroying the
proxy without releasing the lock, add yet more wl_proxy_marshal_*
functions. This time add flags and jam in all existing warts with the
hope that we can make it future proof this time.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
-
0e0274af
by Derek Foreman
at 2021-08-07T11:53:23+00:00
scanner: Use the new atomic marshal/destroy function
Use the new flagged marshal+destroy function in generated code.
It's intended as a replacement for all existing wl_proxy_marshal_*
functions, so I've used it to replace them all. This results in a large
update to the scanner test files as well.
We now pass the new WL_MARSHAL_FLAG_DESTROY flag when appropriate, so
the race condition in #86 caused by releasing the display mutex between
marshalling the proxy and destroying the proxy is now gone.
Fixes #86
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
-
f736f11f
by Derek Foreman
at 2021-08-09T11:51:58-05:00
connection: Rename wl_buffer
struct wl_buffer has other meaning in wayland, thus making this a pretty
confusing structure name. Function names like wl_buffer_put() just
compound the confusion.
Rename the struct and the associated functions (none of which are called
from outside this file anyway). The struct retains a wl_ prefix, as is
the custom for wayland internal data structures. The function names
have not retained this prefix, as we have many static function that
aren't prefixed.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
-
bf98c1a8
by Derek Foreman
at 2021-08-27T09:56:17-05:00
tests: Destroy custom global object
Destroy our custom global object at end of run so we no longer "leak"
it.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
-
8ec25be6
by Alex Richardson
at 2021-09-10T11:35:54+00:00
os-wrappers-test: Handle fcntl() being declared as a macro
On some systems (e.g. FreeBSD with the latest epoll-shim), fcntl is
declared as a macro instead of a function. Wrap the definition here in
parantheses to avoid function-macro expansion.
Signed-off-by: Alex Richardson <Alexander.Richardson@cl.cam.ac.uk>
-
c65f852f
by Alex Richardson
at 2021-09-10T11:35:54+00:00
Use epoll-shim to emulate epoll(7) on FreeBSD
FreeBSD does not provide epoll(7) and instead requires an external library,
epoll-shim, that implements epoll() using kqueue(2)
Co-authored-by: Jan Beich <jbeich@FreeBSD.org>
Signed-off-by: Alex Richardson <Alexander.Richardson@cl.cam.ac.uk>
-
c260d577
by Alex Richardson
at 2021-09-10T11:35:54+00:00
gitlab-ci: update ci-templates to the latest commit
This is in preparation for adding FreeBSD CI support.
Signed-off-by: Alex Richardson <Alexander.Richardson@cl.cam.ac.uk>
-
3288a076
by Alex Richardson
at 2021-09-10T11:35:54+00:00
gitlab-ci: remove duplicated lines in ci-templates include
The file key can have multiple values, so we don't need another "project"..
Signed-off-by: Alex Richardson <Alexander.Richardson@cl.cam.ac.uk>
-
c0e8990e
by Alex Richardson
at 2021-09-10T11:35:54+00:00
gitlab-ci: Fix copy-paste error in a comment
Signed-off-by: Alex Richardson <Alexander.Richardson@cl.cam.ac.uk>
-
f1552700
by Alex Richardson
at 2021-09-10T11:35:54+00:00
gitlab-ci: add junit reports to the debian builder
Signed-off-by: Alex Richardson <Alexander.Richardson@cl.cam.ac.uk>
-
54b237a6
by Alex Richardson
at 2021-09-10T11:35:54+00:00
Support reading ucred from the socket on FreeBSD
On FreeBSD we have to use getsockopt(fd, SOL_LOCAL, LOCAL_PEERCRED)
instead. This change is based on a downstream patch in FreeBSD ports.
Co-authored-by: Greg V <greg@unrelenting.technology>
Co-authored-by: Koop Mast <kwm@rainbow-runner.nl>
Signed-off-by: Alex Richardson <Alexander.Richardson@cl.cam.ac.uk>
-
5a981ee8
by Alex Richardson
at 2021-09-10T11:35:54+00:00
shm: Add mmap+memmove fallback if mremap() does not exist
Some operating systems (e.g. FreeBSD) do not implement mremap.
In that case we can grow the mapping by trying to map adjacent memory.
If that fails we can fall back to creating a new larger mapping and
moving the old memory contents there.
Co-authored-by: Koop Mast <kwm@rainbow-runner.nl>
Signed-off-by: Alex Richardson <Alexander.Richardson@cl.cam.ac.uk>
-
644efe95
by Alex Richardson
at 2021-09-10T11:35:54+00:00
Use /dev/fd instead of /proc/self/fd
/dev/fd exists on all operating systems I can test (Linux, FreeBSD, macOS),
whereas /proc/self/fd only appears to exist on Linux.
Signed-off-by: Alex Richardson <Alexander.Richardson@cl.cam.ac.uk>
-
bb928288
by Alex Richardson
at 2021-09-10T11:35:54+00:00
test-runner: Implement is_debugger_attached() for FreeBSD
FreeBSD provides a PROC_TRACE_STATUS procctl(2) to detect this directly.
Signed-off-by: Alex Richardson <Alexander.Richardson@cl.cam.ac.uk>
-
42bf011f
by Alex Richardson
at 2021-09-10T11:35:54+00:00
test-helpers: use sysctl() to count open fds on FreeBSD
This allows running the tests on FreeBSD without mounting fdescfs.
Previously you had to run `mount -t fdescfs -o linrdlnk null /dev/fd` to
get file descriptors >=3 listed in /dev/fd.
Signed-off-by: Alex Richardson <Alexander.Richardson@cl.cam.ac.uk>
-
382f368a
by Alex Richardson
at 2021-09-10T11:35:54+00:00
Detect FreeBSD versions with broken MSG_CMSG_CLOEXEC
If we are compiling against a version of FreeBSD where MSG_CMSG_CLOEXEC
does not work, use the fallback directly. This was only fixed recently
(in https://cgit.freebsd.org/src/commit/?id=6ceacebdf52211).
Signed-off-by: Alex Richardson <Alexander.Richardson@cl.cam.ac.uk>
-
ed423b8a
by Alex Richardson
at 2021-09-10T11:35:54+00:00
Allow event-loop signal tests to pass on FreeBSD
On Linux the signal will be immediately visible in the epoll_wait() call.
However, on FreeBSD we may need a small delay between kill() call and the
signal being visible to the kevent() call. This sometimes happens when the
signal processing and kevent processing runs on different CPUs in the
kernel, so becomes more likely when the system is under load (e.g. running
all tests in parallel).
See https://github.com/jiixyj/epoll-shim/pull/32
Signed-off-by: Alex Richardson <Alexander.Richardson@cl.cam.ac.uk>
-
4d473310
by Alex Richardson
at 2021-09-10T11:35:54+00:00
gitlab-ci: add a FreeBSD test job
This uses the new FreeBSD supported added in
https://gitlab.freedesktop.org/freedesktop/ci-templates/-/merge_requests/114
After the latest series of commits, we should be able to compile and
successfully run all tests, so adding this CI job will prevent any future
FreeBSD regressions.
Signed-off-by: Alex Richardson <Alexander.Richardson@cl.cam.ac.uk>
-
7ef305d0
by Simon Ser
at 2021-09-16T08:25:05+00:00
protocol: mention that keymap mapping must be read-only
It may be obvious that the mapping must be established in read-only
mode, but it wasn't specified in the specification text.
Signed-off-by: Simon Ser <contact@emersion.fr>
-
616b4ae6
by Olivier Fourdan
at 2021-09-16T17:31:09+02:00
shm: Relax shm_pool_create_buffer() validity check
shm_pool_create_buffer() can raise a false WL_SHM_ERROR_INVALID_STRIDE
error under some circumstances because of integer division.
Fix this by using a strict comparison operator instead of lower or
equal.
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Demi Marie Obenour <demi@invisiblethingslab.com>
Reviewed-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Closes: https://gitlab.freedesktop.org/wayland/wayland/-/issues/235
-
c6c1bbe4
by Matt Hoosier
at 2021-09-29T09:43:21-05:00
protocol: mention that buffers with alpha are assumed premultiplied
This turns out to be the default assumption by compositors, OpenGL, and the DRM
framework. Let's say it explicitly to avoid misinterpretation.
See https://lists.freedesktop.org/archives/wayland-devel/2021-September/041990.html.
Signed-off-by: Matt Hoosier <matt.hoosier@garmin.com>
-
d564823c
by Damian Hobson-Garcia
at 2021-10-09T13:09:04+00:00
server: stop wl_display event loop from any context
Calling wl_display_terminate() will exit the wl_display event loop
at the start of the next loop iteration. This works fine when
wl_display_terminate() is called after the event loop wakes up
from polling on the added event sources. If, however, it is
called before polling starts, the event loop will not exit until
one or more event sources trigger. Depending on the types of event
sources, they may never trigger (or may not trigger for a long time),
so the event loop may never exit.
Add an extra event source to the wl_display event loop that will trigger
whenever wl_display_terminate() is called, so that the event loop will
always exit.
Fixes #201
Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
-
f00cfda7
by Manuel Stoeckl
at 2021-10-28T12:30:43+00:00
client: handle fcntl error on bad fd in wl_display_connect
This makes wl_display_connect fail immediately instead of
succeeding when the integer provided by WAYLAND_SOCKET does
not refer to a valid file descriptor.
Signed-off-by: Manuel Stoeckl <code@mstoeckl.com>
-
fceabb7e
by Jonas Ådahl
at 2021-10-28T12:39:39+00:00
protocol: Add wl_surface.offset
This is meant to address the issue where the call to 'wl_surface.attach'
is done by e.g. Vulkan, meaning applications cannot affect the values of
the offset passed as the x and y arguments.
The lack of ability to pass these is problematic when using the Vulkan
for e.g. drawing DND surfaces, as the buffer offset is used to implement
the drag icon hotspots.
Closes: https://gitlab.freedesktop.org/wayland/wayland/-/issues/148
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Simon Ser <contact@emersion.fr>
-
0cdd2a5c
by Simon McVittie
at 2021-10-28T12:46:06+00:00
build: Include the Wayland minor version in libraries' ABI versions
The ABI of a shared library on Linux is given by a major version, which
is part of the SONAME and is incremented (rarely) on incompatible
changes, and a minor version, which is part of the basename of the
regular file to which the SONAME provides a symlink.
Until now, the ABI minor version was hard-coded, which means we can't
tell which of a pair of Wayland libraries is newer (and therefore
likely to have more symbols and/or fewer bugs).
libwayland-egl already had ABI major version 1, so we can use the
"marketing" version number as the ABI major.minor version number
directly, so Wayland 1.19.90 would produce
libwayland-egl.so.1 -> libwayland-egl.so.1.19.90.
libwayland-cursor and libwayland-server have ABI major version 0,
and OS distributions don't like it when there's a SONAME bump for no
good reason, so use their existing ABI major version together with
the "marketing" minor version:
libwayland-cursor.so.0 -> libwayland-cursor.so.0.19.90.
If the Wayland major version number is incremented to 2, we'll have to
rethink this, so add some error() to break the build if/when that
happens. Assuming that Wayland 2.0 would involve breaking changes,
the best way would probably to bump all the SONAMEs to
libwayland-foo.so.2.
Resolves: https://gitlab.freedesktop.org/wayland/wayland/-/issues/175
Signed-off-by: Simon McVittie <smcv@collabora.com>
-
aa883215
by Simon Ser
at 2021-10-28T14:03:04+00:00
protocol: add note about wl_output.done in events
Mention that geometry, mode and scale wl_output events are followed
by a done event.
Signed-off-by: Simon Ser <contact@emersion.fr>
-
9c05e6c4
by Simon Ser
at 2021-10-28T14:03:04+00:00
protocol: add wl_output.{name,description}
This is inspired from xdg-output-unstable-v1. This allows clients to
get the name and description without having to use xdg_output. This
should eventually allow us to restrict xdg_output to clients like
Xwayland.
The name is a unique non-persistent user-friendly string that can be
used to refer to an output. This can be used by Wayland clients to
refer to a specific wl_output (e.g. across processes or in CLI
arguments).
The description is a non-unique user-friendly string that can be
displayed to the user.
Signed-off-by: Simon Ser <contact@emersion.fr>
References: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/issues/7
-
ca893075
by Derek Foreman
at 2021-11-02T11:27:51+00:00
debug: Fix printing of new ids
The client side closure traces have incorrect object ids for new server
generated objects. This is because create_proxies() overwrites the id in
'n' type arguments by storing a pointer to the actual object in the 'o'
field of the union.
Getting back to an id from this pointer requires accessing a structure
that isn't visible outside of wayland-client.c.
Add a function pointer to fish the correct value out of the argument and
pass it to wl_closure_print.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
-
ebfc70cd
by Simon Ser
at 2021-11-04T08:53:47+00:00
protocol: wl_shm uses pre-multiplied alpha
Add a note about pre-multiplied alpha for all wl_shm formats.
Include an escape hatch in the spec to allow other protocol
extensions to override this.
Signed-off-by: Simon Ser <contact@emersion.fr>
Closes: https://gitlab.freedesktop.org/wayland/wayland/-/issues/61
-
20fd3b3a
by Duncan McIntosh
at 2021-11-04T09:02:19+00:00
wayland-shm: Check the size of sealed memory if ignoring SIGBUS handlers
In 11623e8f, SIGBUS handlers aren't set if F_SEAL_SHRINK is configured on
the memory. This helps avoid setting up handlers with cooperative clients;
however, if an application gives an incorrect size, the compositor would
access it anyways, figuring SIGBUS is impossible, and crash.
This can be fixed by simply removing the seal-checking logic and always
setting the signal handler. However, it seems that fstat can give the size
of the memfd, so we can check that the size we were told is within the
region. Since it's sealed to shrinking, it must never be shrunk in future,
so we can really (hopefully) ignore SIGBUS.
I was worried that fstat wasn't supported for this, but shm_overview(7) does
mention that it is a possible use.
The best solution would likely be avoiding SIGBUS entirely with
MAP_NOSIGBUS, but that hasn't been merged yet and wouldn't help systems
without it (e.g. with older kernels).
A proof-of-concept of this crash is attached with the merge request. Running
it with this patch gives an invalid-shm error, which is correct.
Signed-off-by: Duncan McIntosh <duncan82013@live.ca>
-
5420619f
by Simon Ser
at 2021-11-04T20:39:22+01:00
build: bump to version 1.19.91 for the alpha release
-
1638dad6
by Manuel Stoeckl
at 2021-11-11T20:15:22-05:00
protocol: sync wl_shm.format with libdrm 2.4.108
The four new formats added (all 16 bpc, RGB colorspace) are very useful
for applications providing high bit depth content and rendering their
buffers on CPU, as computations with 16 bit unsigned integers are often
more efficient than with the (half float, 10 bit) alternative formats.
Signed-off-by: Manuel Stoeckl <code@mstoeckl.com>
-
78590b3a
by Jan Grulich
at 2021-11-15T13:20:41+00:00
protocol: clarify wl_data_offer::selection
Clearly specify that switching focus within the same client
doesn't mean a new selection will be send.
Signed-off-by: Jan Grulich <jgrulich@redhat.com>
-
dcd8a62b
by Simon Ser
at 2021-11-18T16:30:09+01:00
build: bump to version 1.19.92 for the beta release
-
28c2d832
by Simon Ser
at 2021-12-02T20:51:39+01:00
build: bump to version 1.19.93 for the RC1 release
-
ba82e0d8
by Simon Ser
at 2021-12-08T00:27:58+01:00
meson: override dependencies to ease use as subproject
Make it easier to use Wayland as a Meson subproject by overriding
dependencies we define. This allows to easily build Wayland as a
subproject like so:
subproject('wayland', required: false, default_options: ['documentation=false'])
After this statement, the wayland-* dependencies will use the subproject
instead of the system if available.
Signed-off-by: Simon Ser <contact@emersion.fr>
-
75c1a93e
by Simon Ser
at 2021-12-09T17:20:36+01:00
build: bump to version 1.20.0 for the official release