summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2014-03-20pkg-config: scanner isn't arch-independentrpi-1.4.0Daniel Stone1-2/+1
$(datadir) rather than $(libdir), is for architecture-independent data. pkg-config files should only be installed there if they're shareable across architectures, e.g. headers/data only, which wayland-scanner is not. Move it to $(libdir) with the other pkg-config files. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2014-02-18build: Move protocol/ Makefile.am into toplevel Makefile.amupstream-1.4.0Kristian Høgsberg3-4/+5
A small step towards non-recursive build system for wayland too.
2014-02-18build: Stop using xmllint to validate protocol filesKristian Høgsberg2-16/+0
Same reason as commit cd31275f28b0a04d2ec5426dc81e875197b47e52 from weston: The scanner needs to be good enough. If it crashes or fails to report invalid input, that needs to get fixed.
2014-02-18connection: Use wl_log to report errorsJasper St. Pierre1-18/+18
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.
2014-02-18scanner: Add GCC pragmas to disable -Wredundant-declsJasper St. Pierre1-1/+3
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.
2014-02-18wayland-client: Set a proper errnoJasper St. Pierre1-3/+3
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.
2014-02-10protocol: when buffer transform and scale changePekka Paalanen1-0/+9
Clarify when the pending and current buffer transform and scale values change, and what exactly happens on commit. This matches what Weston currently does. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-02-08client: Queue display events on private queue and always dispatchKristian Høgsberg1-4/+21
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.
2014-02-08client: Rename display->queue to default_queueKristian Høgsberg1-8/+9
We'll add a new queue next, so rename the default queue first.
2014-02-07Make default log handler print to stderrKristian Høgsberg1-2/+4
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.
2014-02-06Rename wl_debug to debug_server/clientJason Ekstrand2-10/+10
Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
2014-02-06Don't deref the sample pointer in the wl_container_of macroNeil Roberts3-19/+15
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.
2014-01-31protocol: Fix buildJasper St. Pierre1-3/+4
"data" is the name of the void* argument in the implementation. While we probably shouldn't use such an easily-collidable name, just rename the callback's argument to callback_data for now.
2014-01-31protocol: Fix documentation for the parameter of wl_callbackJasper St. Pierre1-1/+5
The parameter here is an opaque integer, rather than the event serial. The "frame" callback uses this to pass the current time of day in milliseconds.
2014-01-31protocol: Fix the name of the registry argumentJasper St. Pierre1-1/+1
A simple copy-paste typo.
2014-01-24configure.ac: Bump version to 1.4Kristian Høgsberg1-2/+2
2014-01-20resources-test: Don't send invalid eventKristian Høgsberg1-3/+0
Even if nothing receives the even, the arguments still need to be valid. The test is sending out event 0 from the wl_display interface, which is the error event. This requires arg 0 to be a valid object and arg 2 to be a non-null string. The test just leaves that undefined, causing intermittent test failures. As it is, the resource destroy test doesn't need to send an event to validate the various resource destroy hooks, so we can just remove the call to wl_resource_post_event() alltogether. Thanks to Matt Turner <mattst88@gmail.com> for pointing out the failure.
2014-01-20protocol: Clarify semantics of wl_subsurface.set_positionJonas Ådahl1-0/+4
Make it clear that multiple requests before commit are allowed and how it is handled. Signed-off-by: Jonas Ådahl <jadahl@gmail.com> Reviewed-by: Jasper St. Pierre <jstpierre@mecheye.net>
2014-01-20protocol: Clarify semantics of sub-surface placement requestsJonas Ådahl1-2/+3
Clarify some semantics of wl_subsurface.place_below and wl_subsurface.place_below that were not specified. Signed-off-by: Jonas Ådahl <jadahl@gmail.com> Reviewed-by: Jasper St. Pierre <jstpierre@mecheye.net>
2014-01-20configure.ac: Bump version to 1.3.93Kristian Høgsberg1-1/+1
This is the release candidate.
2014-01-19Revert "xwayland: Add .gitignore"Kristian Høgsberg1-4/+0
I accidentally committed Jaspers xserver patch to wayland. This reverts commit 8a781aef0ebf8d5be4116fa40d9155af4ba61257.
2014-01-17client: Include poll.h instead of sys/poll.hJonas 'Sortie' Termansen1-1/+1
POSIX mandates the poll.h header as the standard location of poll(2).
2014-01-15add_shm_format: check wl_array_add return value before derefU. Artie Eoff2-5/+11
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>
2014-01-15xcursor: don't proceed if XcursorImageCreate failedU. Artie Eoff1-0/+2
Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
2014-01-15cursor: check for memory allocation errorsU. Artie Eoff1-1/+13
Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
2014-01-15cursor: free theme->name tooU. Artie Eoff1-0/+1
Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
2014-01-15resources-test: assert non-NULL return valuesU. Artie Eoff1-0/+1
Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
2014-01-15queue-test: assert non-NULL return valuesU. Artie Eoff1-0/+3
Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
2014-01-15os-wrappers-test: assert closure is not NULL before invoking itU. Artie Eoff1-0/+1
Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
2014-01-15event-loop-test: assert non-NULL resultsU. Artie Eoff1-0/+5
Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
2014-01-15connection-test: assert closure is not NULL before invoking itU. Artie Eoff1-0/+1
Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
2014-01-15array-test: assert wl_array_add result is not NULLU. Artie Eoff1-0/+3
Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
2014-01-15shm: assert sigbus_data is not NULL before member accessU. Artie Eoff1-1/+1
Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
2014-01-10xwayland: Add .gitignoreJasper St. Pierre1-0/+4
2014-01-09Fix buffer overflow when serializing a closure objectchi ding1-8/+83
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
2013-12-17scanner: set errno=0 before strtolAdrian Negreanu1-0/+1
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>
2013-12-17configure.ac: Bump version to 1.3.91 for the alpha releaseKristian Høgsberg1-1/+1
2013-12-10client: Handle EINTR in wl_display_dispatch_queue()Kristian Høgsberg1-1/+5
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.
2013-12-09doc: Fix spelling of parametersJonas Ådahl1-2/+2
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2013-12-09doc: Remove incorrect docmentationJonas Ådahl1-11/+0
The documentation was about wl_client_get_object(), not about wl_resource_get_client(). Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2013-12-05client: Make wl_proxy_set_queue() with NULL revert to default queueNeil Roberts1-1/+4
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.
2013-12-03cursor: handle running out of buffer spacePekka Paalanen1-16/+51
If posix_fallocate is available, use it to detect when we are running out of buffer space. Propagate the failure properly through the various functions, stopping loading cursors but keeping the cursors that were already successfully loaded. This may result in an animated cursor not having all of its images, or a cursor theme not having all of its cursors. When that happens, the failure is NOT communicated to the application. Instead, the application will get NULL from wl_cursor_theme_get_cursor() for a cursor that was not loaded successfully. If an animated cursor is missing only some images, the animation is truncated but the cursor is still available. This patch relies on the commit "os: use posix_fallocate in creating sharable buffers" for defining HAVE_POSIX_FALLOCATE. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2013-12-03os: use posix_fallocate in creating sharable buffersPekka Paalanen2-2/+19
If posix_fallocate is available, use it instead of ftruncate. Unlike ftruncate, when posix_fallocate succeeds, it guarantees that you cannot run out of disk space, when later writing to the mmap()'ed file. With posix_fallocate, if os_create_anonymous_file() succeeds, the program cannot get a SIGBUS later from accessing this file via mmap. If there is insufficient disk space, the function fails and errno is set to ENOSPC. This is useful on systems, that limit the available buffer space by having XDG_RUNTIME_DIR on a small tmpfs. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2013-11-23Add -pthread to AM_CFLAGS to do the right thing when using threadsKristian Høgsberg1-1/+1
https://bugs.freedesktop.org/show_bug.cgi?id=71633
2013-11-22connection: Error out if file descriptor was not receivedLubomir Rintel1-0/+9
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>
2013-11-19wayland-server: Improve error messages for bad globalsJasper St. Pierre1-3/+7
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.
2013-11-19Update .gitignore for protocol/Jasper St. Pierre1-0/+1
2013-11-16client: Introduce functions to allocate and marshal proxies atomicallyKristian Høgsberg4-75/+189
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>
2013-11-16protocol: add sub-surfaces to the corePekka Paalanen1-0/+217
The sub-surface protocol was originally committed into Weston on May 10th, 2013, in commit 2396aec6842c709a714f3825dbad9fd88478f2e6. The design for the protocol had started in the beginning of December 2012. I think it is high time to move this into the core now. This patch copies the sub-surface protocol as it was in Weston on Nov 15th, 2013, into Wayland. Weston gets a patch to remove the protocol from there. Sub-surface is a wl_surface role. You create a wl_surface as usual, and assign it the sub-surface role and a parent wl_surface. Sub-surfaces are an integral part of the parent surface, and stay glued to the parent. For window management, a window is the union of the top-level wl_surface and all its sub-surfaces. Sub-surfaces are not clipped to the parent, and the union of the surface tree can be larger than the (top-level) wl_surface at its root. The representative use case for sub-surfaces is a video player window. When the video content is given its own wl_surface, there is no need to modify the video frame contents after decoding or copy them into a whole window sized buffer before submitting it to the compositor. This allows efficient, zero-copy video presentation paths, where video decoding hardware produces a (YUV) buffer, which eventually ends up in a (YUV-capable) hardware overlay and is scanned out directly. This can also be used for zero-copy presentation of windowed OpenGL content, where the OpenGL rendering engine does not need to draw or avoid window decorations. Sub-surfaces allow mixing different buffer types into the same window, e.g. software-rendered decorations in wl_shm buffers, and live content in EGL-based buffers. However, the sub-surface extension does not offer clipping or scaling facilities, or accurate presentation timing. Those are topics for additional extensions. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2013-11-16shm: Avoid file descriptor leak upon unsuccessful mmapLubomir Rintel1-1/+1
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>