Skip to content
Snippets Groups Projects
  1. Dec 17, 2013
  2. Dec 10, 2013
  3. Dec 09, 2013
  4. Dec 05, 2013
    • Neil Roberts's avatar
      client: Make wl_proxy_set_queue() with NULL revert to default queue · 1521c62a
      Neil Roberts authored
      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.
      1521c62a
  5. Dec 03, 2013
    • Pekka Paalanen's avatar
      cursor: handle running out of buffer space · 3b3e81f4
      Pekka Paalanen authored
      
      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: default avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
      3b3e81f4
    • Pekka Paalanen's avatar
      os: use posix_fallocate in creating sharable buffers · 011b6954
      Pekka Paalanen authored
      
      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: default avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
      011b6954
  6. Nov 23, 2013
  7. Nov 22, 2013
  8. Nov 19, 2013
  9. Nov 16, 2013
    • Kristian Høgsberg's avatar
      client: Introduce functions to allocate and marshal proxies atomically · 853c24e6
      Kristian Høgsberg authored
      
      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: default avatarKalle Vahlman <kalle.vahlman@movial.com>
      853c24e6
    • Pekka Paalanen's avatar
      protocol: add sub-surfaces to the core · 81c57614
      Pekka Paalanen authored
      
      The sub-surface protocol was originally committed into Weston on May
      10th, 2013, in commit 2396aec6. 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: default avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
      81c57614
    • Lubomir Rintel's avatar
      shm: Avoid file descriptor leak upon unsuccessful mmap · 4a196570
      Lubomir Rintel authored
      
      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: default avatarLubomir Rintel <lkundrak@v3.sk>
      4a196570
  10. Nov 15, 2013
  11. Nov 14, 2013
    • Kristian Høgsberg's avatar
      server: Start documenting the server side API · b583b545
      Kristian Høgsberg authored
      This is now public, stable API, so it seems prudent to actually document it.
      b583b545
    • Neil Roberts's avatar
      server: Add API to protect access to an SHM buffer · cf4f5995
      Neil Roberts authored
      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.
      cf4f5995
  12. Oct 25, 2013
    • Peter Hutterer's avatar
      protocol: validate the protocol against a dtd · 05f95c85
      Peter Hutterer authored
      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.
      05f95c85
  13. Oct 23, 2013
  14. Oct 21, 2013
  15. Oct 11, 2013
  16. Oct 09, 2013
  17. Oct 08, 2013
  18. Oct 03, 2013
  19. Sep 25, 2013
    • Neil Roberts's avatar
      client: Fix handling display->reader_count if poll fails · 799ea720
      Neil Roberts authored
      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.
      799ea720
  20. Sep 22, 2013
  21. Sep 21, 2013
    • Marek Ch's avatar
      tests: add wl_resource tests · b99edb8b
      Marek Ch authored
      b99edb8b
    • Marek Ch's avatar
      tests: add unit tests for wl_signal · 6f1569bd
      Marek Ch authored
      Test wl_signal initialization, adding and getting listeners and emitting
      6f1569bd
    • Marek Ch's avatar
      tests: extended message when leak in test is detected · ec08c5c3
      Marek Ch authored
      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.
      ec08c5c3
    • Chang Liu's avatar
      client: fix an inconsistency in documentation · 5cf31443
      Chang Liu authored
      The errno is set to EAGAIN when there are undispatched events, according
      to L1066 of wayland-client.c.
      5cf31443
    • Aaron Faanes's avatar
      doc: Slight tweaks to wl_listener · 5a925532
      Aaron Faanes authored
      Prefer \comment over // in code blocks for consistency's sake and keep
      variable definitions separated by a line from the rest of the body.
      5a925532
    • Aaron Faanes's avatar
      utils: Document wl_container_of · 8267f283
      Aaron Faanes authored
      8267f283
    • Aaron Faanes's avatar
      doc: Create \comment alias for C-style comments · 217909c1
      Aaron Faanes authored
      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>
      217909c1
  22. Sep 17, 2013
Loading