summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2013-12-17scanner: set errno=0 before strtolHEADmasterAdrian 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-16configure.ac: Bump version to 1.3.91 for the alpha releaseKristian Høgsberg1-1/+1
2013-12-09client: 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-04client: 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-02cursor: 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-02os: 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-21connection: 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-15client: 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-15protocol: 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-15shm: 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>
2013-11-15Add documentation for wl_shm_buffer_begin/end_accessNeil Roberts2-1/+66
It's not obvious that these functions are needed so it would be good to have some documentation for them.
2013-11-15scanner: Add location to elements so we can give better errors/warningsKristian Høgsberg1-7/+25
2013-11-15scanner: Make fail() function use va_list and elaborate a few errorsKristian Høgsberg1-7/+14
2013-11-15scanner: Introduce struct location for tracking source locationsKristian Høgsberg1-20/+26
2013-11-15scanner: Warn about requests with more than one new-id and don't generate stubsKristian Høgsberg1-0/+14
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().
2013-11-13server: Start documenting the server side APIKristian Høgsberg1-0/+130
This is now public, stable API, so it seems prudent to actually document it.
2013-11-13server: Add API to protect access to an SHM bufferNeil Roberts2-0/+137
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.
2013-10-25protocol: validate the protocol against a dtdPeter Hutterer4-2/+47
The scanner is not very forgiving if the protocol doesn't match it's expectations and crashes without much of a notice. Thus, validate the protocol against a DTD. Move the protocol subdir forward so we validate first before trying anything else, and install the DTD so we can validate weston's protocols as well.
2013-10-23configure.ac: Bump version to 1.3.90 for the master branchKristian Høgsberg1-1/+1
2013-10-21wayland: Be consistent about #include-guard namesKristian Høgsberg4-8/+8
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
2013-10-11protocol: Fix typo in documentation1.3José Bollo1-1/+1
2013-10-09configure.ac: Bump version to 1.3Kristian Høgsberg1-2/+2
2013-10-07scanner: Handle unrecognized invocation modeKristian Høgsberg1-1/+3
Print usage if we don't recognize the invocation mode. Also fixes uninitialized variable warning.
2013-10-02configure.ac: Bump version to 1.2.92Kristian Høgsberg1-1/+1
2013-09-25client: Fix handling display->reader_count if poll failsNeil Roberts1-1/+3
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.
2013-09-22configure.ac: Bump version to 1.2.91Kristian Høgsberg1-1/+1
2013-09-21Export the Wayland protocol XML fileJason Ekstrand3-1/+5
Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
2013-09-21tests: add wl_resource testsMarek Ch2-1/+170
2013-09-21tests: add unit tests for wl_signalMarek Ch2-1/+117
Test wl_signal initialization, adding and getting listeners and emitting
2013-09-21tests: extended message when leak in test is detectedMarek Ch1-3/+14
When memory or fd leak is detected, print how many blocks of memory were allocated and not freed, respectively how many files were opened/unclosed.
2013-09-21client: fix an inconsistency in documentationChang Liu1-1/+1
The errno is set to EAGAIN when there are undispatched events, according to L1066 of wayland-client.c.
2013-09-21doc: Slight tweaks to wl_listenerAaron Faanes1-4/+6
Prefer \comment over // in code blocks for consistency's sake and keep variable definitions separated by a line from the rest of the body.
2013-09-21utils: Document wl_container_ofAaron Faanes1-0/+35
2013-09-21doc: Create \comment alias for C-style commentsAaron Faanes1-1/+1
Since /* */ do not nest, documentation is forced to either use C++ style // comments or some other foreign notation. This commit provides an alias that allows C-style comments to be introduced in code blocks that support aliases. It should be noted that this macro will not work within \code blocks, as Doxygen commands are ignored there. Instead, Doxygen's fenced code blocks (created via ~~~) must be used for proper output. To demonstrate: ~~~ struct example_node { int id; \comment{Other members ...} }; ~~~ will roughly yield the following HTML (excluding syntax highlighting): <pre> struct example_node { int id; /* Other members ... */ }; </pre>
2013-09-16doc: Include wayland-util.* for doxygen outputAaron Faanes1-0/+6
This commit creates a shared file list that is included by both the client and the server for the XML Makefile targets, as classes within util are used by both the client and the server.
2013-09-16wayland-server: Improve wording for wl_signal_get's docAaron Faanes1-1/+1
The old description was a bit vague; this commit hopefully improves describing what is returned.
2013-09-16utils: Add doxygen for wayland-util.hAaron Faanes1-0/+5
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.
2013-09-16utils: Reference some useful methods in wl_signal's doxygenAaron Faanes1-1/+6
This commit adds a bit more detail on the lifecycle of a signal.
2013-09-16wayland-server: Document wl_listenerAaron Faanes1-0/+45
This patch takes Kristian's comments into account, adding a demonstration and giving a more thorough idea of how wl_listener is used.
2013-09-11gitignore: add ./compileChang Liu1-0/+1
./compile is a GNU autotools helper script and should be ignored by git
2013-09-11wayland-server: Add a wl_resource_for_each_safe macroRob Bradford1-0/+8
A version of wl_resource_for_each that is safe for iteration when items in the list are removed.
2013-09-11utils: tweak wl_list for better doxygen outputAaron Faanes1-2/+3
2013-09-11wayland-server: Document wl_signalAaron Faanes1-0/+37
2013-09-11wayland-server: Fix a uninitialized warning from clangAaron Faanes1-1/+1
This warning is unnecessary, since the pointer in question is only used for pointer arithmetic, but setting it explicitly to NULL doesn't hurt.
2013-08-30configure.ac: Bump version to 1.2.90 for master branchKristian Høgsberg1-1/+1