| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
| |
Use wl_log in the last few places where we print to stderr. Remove
logging in a couple of places where we properly return an error code.
https://bugs.freedesktop.org/show_bug.cgi?id=73339
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This implements a simple fix for the blocking problem that occurs when
updating a timer event source after the timer expires, but before its
callback is dispatched. This can happen when another event happens during the
same epoll wakeup as the timer event, and causes the read() call in
wl_event_source_timer_dispatch() to block for the updated duration of the
timer.
We never want this read() call to block, so I believe it makes sense for the
timerfd to be non-blocking, and we simply ignore the case where the read fails
with EAGAIN. We still report all other errors as before, and still ignore the
actual value read from the socket.
With this change, the event_loop_timer_updates unit test case I submitted
previously now passes, and weston appears to work as before.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
| |
If a message was too big to fit in the connection buffer, the code
in wl_buffer_put would just write past the end of it.
I haven't seen any real world use case that would trigger this bug, but
it was possible to trigger it by sending a long enough string to the
wl_data_source.offer request.
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=69267
|
| |
|
|
|
|
|
| |
Unused shm space will be automatically reclaimed if unused or can be
explicitly returned by using fallocate FALLOC_FL_PUNCH_HOLE.
https://bugs.freedesktop.org/show_bug.cgi?id=74632
|
| |
|
|
|
| |
Just sort the types and only print unique type names. We avoid using
the GCC pragma.
|
| | |
|
| | |
|
| |
|
|
|
|
| |
In order to set a logging function all the time, the output we get
needs to be useful. Logging about trivial things like the socket
we're using and when clients disconnect doesn't realy help anyone.
|
| | |
|
| |
|
|
|
|
|
| |
In some cases, like Xwayland, stdout and stderr are redirected to
/dev/null, losing us valuable information, while wl_log can be
overridden, allowing us to send it to a log file instead. This
can help debugging immensely.
|
| |
|
|
|
|
|
|
|
| |
The code very intentionally emits a lot of redundant declarations
to simplify the scanner code. Somebody building with -Wredundant-decls
would have compile errors, so emit special pragmas to turn those
warnings off.
These pragmas should be ignored outside of gcc/clang.
|
| |
|
|
|
|
| |
errno is supposed to be positive, not negative. It seems that
everything else that calls display_fatal_error() calls it with
a positive error code, so do it here as well.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
The wl_display events (error and delete_id) need to be handled even
if the default queue doesn't get dispatched for a while. For example,
a busy EGL rendering loop hits wl_display.sync every eglSwapBuffers()
and we need to process the delete_id events to maintain the object ID
data structure.
As it is, that doesn't happen, but with this change we special case
wl_display events. We put them on a custom, private queue and when
dispatching events, we always dispatch display_queue events first.
The wl_display proxy should still be the default_queue, so that objects
created from wl_display requests get assigned to that.
|
| |
|
|
| |
We'll add a new queue next, so rename the default queue first.
|
| |
|
|
|
| |
On the client side we log fatal errors before we exit. If a client doesn't
set a log handler, it's hard to figure out what goes wrong.
|
| |
|
|
| |
Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The previous implementation of the wl_container_of macro was
dereferencing the sample pointer in order to get an address of the
member to calculate the offset. Ideally this shouldn't cause any
problems because the dereference doesn't actually cause the address to
be read from so it shouldn't matter if the pointer is uninitialised.
However this is probably technically invalid and could cause undefined
behavior. Clang appears to take advantage of this undefined behavior
and doesn't bother doing the subtraction. It also gives a warning when
it does this.
The documentation for wl_container_of implies that it should only be
given an initialised pointer and if that is done then there is no
problem with clang. However this is quite easy to forget and doesn't
cause any problems or warnings with gcc so it's quite easy to
accidentally break clang.
To fix the problem this changes the macro to use pointer -
offsetof(__typeof__(sample), member) so that it doesn't need to deref
the sample pointer. This does however require that the __typeof__
operator is supported by the compiler. In practice we probably only
care about gcc and clang and both of these happily support the
operator.
The previous implementation was also using __typeof__ but it had a
fallback path avoiding it when the operator isn't available. The
fallback effectively has undefined behaviour and it is targetting
unknown compilers so it is probably not a good idea to leave it in.
Instead, this patch just removes it. If someone finds a compiler that
doesn't have __typeof__ but does work with the old implementation then
maybe they could add it back in as a special case.
This patch removes the initialisation anywhere where the sample
pointer was being unitialised before using wl_container_of. The
documentation for the macro has also been updated to specify that this
is OK.
|
| |
|
|
| |
POSIX mandates the poll.h header as the standard location of poll(2).
|
| |
|
|
|
|
|
|
| |
In wl_display_add_shm_format(), check the return value from
wl_array_add() before dereferencing it and assigning it a value.
Return the resulting pointer back to the caller.
Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
|
| |
|
|
| |
Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
|
| |
|
|
|
|
|
|
|
| |
Here is the JIRA page of this issue
https://bugs.tizen.org/jira/browse/TIVI-1889
Change-Id: I773a6d2d8f6fd02ff10c92450db1fa8a69544219
Signed-off-by: Chi Ding <chi.ding@mobica.com>
Closes: https://bugs.freedesktop.org/show_bug.cgi?id=65186
|
| |
|
|
|
|
|
|
|
|
|
|
| |
POSIX says to set errno=0 before calling strtol since
the return value alne cannot tell a failure.
on ubuntu armel I get:
../src/wayland-scanner client-header < ../../protocol/wayland.xml > wayland-client-protocol.h
<stdin>:1188: error: invalid integer (2)
Signed-off-by: Adrian Negreanu <adrian.m.negreanu@intel.com>
|
| |
|
|
|
|
| |
Restart the poll() if we take a signal. This is easily triggered in
an application that ends up blocking in eglSwapBuffers(), and causes EGL
to fail to allocate a back buffer.
|
| |
|
|
| |
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
|
| |
|
|
|
|
|
| |
The documentation was about wl_client_get_object(), not about
wl_resource_get_client().
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
This will be useful in order to implement the
EGL_WL_create_wayland_buffer_from_image extension. The buffers created
within Mesa's Wayland platform are created using the the wl_drm object
as a proxy factory which means they will be set to use Mesa's internal
event queue. However, these buffers will be owned by the client
application so they ideally need to use the default event loop. This
function provides a way to set the proxy's event queue back to the
default.
krh: Edited from Neils original patch to just use wl_proxy_set_queue() with
a NULL argument instead of introducing a new function.
|
| |
|
|
| |
https://bugs.freedesktop.org/show_bug.cgi?id=71633
|
| |
|
|
|
|
|
|
| |
Otherwise the tail of fds_in buffer would just shift beyond the beginning.
That confuses the actual request handler and results in a crash further on
due to corrupted tail.
Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
|
| |
|
|
|
|
| |
A bug in Weston's toytoolkit gave me an hour of debugging headaches.
Improve the error messages that we send if a client requests an invalid
global, either by name or by version.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The server requires clients to only allocate one ID ahead of the previously
highest ID in order to keep the ID range tight. Failure to do so will
make the server close the client connection. However, the way we allocate
new IDs is racy. The generated code looks like:
new_proxy = wl_proxy_create(...);
wl_proxy_marshal(proxy, ... new_proxy, ...);
If two threads do this at the same time, there's a chance that thread A
will allocate a proxy, then get pre-empted by thread B which then allocates
a proxy and then passes it to wl_proxy_marshal(). The ID for thread As
proxy will be one higher that the currently highest ID, but the ID for
thread Bs proxy will be two higher. But since thread B prempted thread A
before it could send its new ID, B will send its new ID first, the server
will see the ID from thread Bs proxy first, and will reject it.
We fix this by introducing wl_proxy_marshal_constructor(). This
function is identical to wl_proxy_marshal(), except that it will
allocate a wl_proxy for NEW_ID arguments and send it, all under the
display mutex. By introducing a new function, we maintain backwards
compatibility with older code from the generator, and make sure that
the new generated code has an explicit dependency on a new enough
libwayland-client.so.
A virtual Wayland merit badge goes to Kalle Vahlman, who tracked this
down and analyzed the issue.
Reported-by: Kalle Vahlman <kalle.vahlman@movial.com>
|
| |
|
|
|
|
|
| |
It would be possible to make the compositor leak file descriptors by
passing descriptors of open unmmapable files to it, such as /dev/null.
Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
|
| |
|
|
|
| |
It's not obvious that these functions are needed so it would be good
to have some documentation for them.
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
|
| |
The generated code only support one new-id per request, since the stubs
return the new proxy. It's still possible to send requests with multiple
new-id arguments, but it must be done with
wl_proxy_marshal_array_constructor().
|
| |
|
|
| |
This is now public, stable API, so it seems prudent to actually document it.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Linux will let you mmap a region of a file that is larger than the
size of the file. If you then try to read from that region the process
will get a SIGBUS signal. Currently the clients can use this to crash
a compositor because it can create a pool and lie about the size of
the file which will cause the compositor to try and read past the end
of it. The compositor can't simply check the size of the file to
verify that it is big enough because then there is a race condition
where the client may truncate the file after the check is performed.
This patch adds the following two public functions in the server API
which can be used wrap access to an SHM buffer:
void wl_shm_buffer_begin_access(struct wl_shm_buffer *buffer);
void wl_shm_buffer_end_access(struct wl_shm_buffer *buffer);
The first time wl_shm_buffer_begin_access is called a signal handler
for SIGBUS will be installed. If the signal is caught then the buffer
for the current pool is remapped to an anonymous private buffer at the
same address which allows the compositor to continue without crashing.
The end_access function will then post an error to the buffer
resource.
The current pool is stored as part of some thread-local storage so
that multiple threads can safely independently access separate
buffers.
Eventually we may want to add some more API so that compositors can
hook into the signal handler or replace it entirely if they also want
to do some SIGBUS handling.
|
| |
|
|
|
|
|
| |
We had a mix of inconsistent names, some of which were non-conformant.
Standardize on all-uppercase-and-underscore naming convention.
https://bugs.freedesktop.org/show_bug.cgi?id=70679
|
| |
|
|
|
| |
Print usage if we don't recognize the invocation mode. Also fixes
uninitialized variable warning.
|
| |
|
|
|
|
|
|
|
|
| |
In wl_display_dispatch_queue, if poll fails then it would previously
return immediately and leak a reference in display->reader_count. Then
if the application ignores the error and tries to read again it will
block forever. This can happen for example if the poll fails with
EINTR which the application might consider to be a recoverable error.
This patch makes it cancel the read so the reader_count will be
decremented when poll fails.
|
| |
|
|
| |
Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
|
| |
|
|
|
| |
The errno is set to EAGAIN when there are undispatched events, according
to L1066 of wayland-client.c.
|
| |
|
|
|
| |
Prefer \comment over // in code blocks for consistency's sake and keep
variable definitions separated by a line from the rest of the body.
|
| | |
|
| |
|
|
|
| |
The old description was a bit vague; this commit hopefully improves
describing what is returned.
|
| |
|
|
|
|
| |
This is needed for doxygen to generate output for macro definitions, such
as wl_container_of, that are contained by this file. Classes like
wl_list would be documented regardless.
|
| |
|
|
| |
This commit adds a bit more detail on the lifecycle of a signal.
|
| |
|
|
|
| |
This patch takes Kristian's comments into account, adding a demonstration and
giving a more thorough idea of how wl_listener is used.
|