1. 26 Jul, 2016 1 commit
  2. 07 Jun, 2016 1 commit
  3. 09 Mar, 2016 4 commits
  4. 05 Feb, 2016 1 commit
  5. 12 Jan, 2016 2 commits
  6. 06 Nov, 2015 3 commits
  7. 21 Oct, 2015 1 commit
    • Derek Foreman's avatar
      shm: Add shm_buffer ref and shm_pool unref functions · eba83cd5
      Derek Foreman authored
      Sometimes the compositor wants to make sure a shm pool doesn't disappear
      out from under it.
      
      For example, in Enlightenment, rendering happens in a separate thread
      while the main thread can still dispatch events.  If a client is destroyed
      during rendering, all its resources are cleaned up and its shm pools are
      unmapped.  This causes the rendering thread to segfault.
      
      This patch adds a way for the compositor to increment the refcount of the
      shm pool so it can't disappear, and decrement it when it's finished.
      
      The ref/unref are asymmetrical (ref returns the pool) because it's
      possible the buffer itself will be gone when you need to unref the pool.
      Reviewed-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
      Signed-off-by: default avatarDerek Foreman <derekf@osg.samsung.com>
      eba83cd5
  8. 12 Jun, 2015 1 commit
  9. 04 Nov, 2014 1 commit
  10. 11 Sep, 2014 1 commit
  11. 07 Apr, 2014 1 commit
  12. 15 Jan, 2014 1 commit
  13. 16 Nov, 2013 1 commit
  14. 15 Nov, 2013 1 commit
  15. 14 Nov, 2013 1 commit
    • 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
  16. 06 Aug, 2013 1 commit
  17. 09 Jul, 2013 1 commit
  18. 02 Jul, 2013 3 commits
    • Kristian Høgsberg's avatar
      wayland-server: Remove error event posting from wl_resource_create · c82a52a4
      Kristian Høgsberg authored
      The wl_client_add/new_object() functions sends out an NO_MEMORY error if
      the allocation fails.  This was convenient in a couple of places where
      that was all the error handling that was needed.  Unfortunately that
      looks like out-of-memory isn't handled at the call site and set a bad
      precedent for not cleaning up properly or not handling at all.
      
      As we're introducing wl_resource_create() as a replacement for those two
      functions, let's remove the automatic error event posting and require
      the caller to do that if necessary.
      
      This commit also introduces a new helper, wl_client_post_no_memory() to
      make it possible to send NO_MEMORY events from bind where we don't have
      a wl_resource.
      c82a52a4
    • Jason Ekstrand's avatar
      Add wl_resource_create() and a version field to wl_resource · 4917a967
      Jason Ekstrand authored
      A new function, wl_resource_create(), lets the compositor create a
      wl_resource for a given version of the interface.  Passing 0 for the
      object ID will allocate a new ID. The implementation, user data and
      destructor can be set with wl_resource_set_implementation().
      
      These two functions deprecates wl_client_add/new_object and the
      main difference and motivation is the ability to provide a version number
      for the resource.  This lets the compositor track which version of the
      interface a client has created and we'll use that to verify incoming requests.
      Signed-off-by: Jason Ekstrand's avatarJason Ekstrand <jason@jlekstrand.net>
      4917a967
    • Kristian Høgsberg's avatar
      server: Make wl_object and wl_resource opaque structs · d94a8722
      Kristian Høgsberg authored
      With the work to add wl_resource accessors and port weston to use them,
      we're ready to make wl_resource and wl_object opaque structs.  We keep
      wl_buffer in the header for EGL stacks to use, but don't expose it by
      default.  In time we'll remove it completely, but for now it provides a
      transition paths for code that still uses wl_buffer.
      
      Reviewed-by: Jason Ekstrand<jason@jlekstrand.net>
      d94a8722
  19. 21 Jun, 2013 2 commits
  20. 05 Jun, 2013 1 commit
  21. 19 Mar, 2013 1 commit
    • Jason Ekstrand's avatar
      Add wl_resource_init and use it in libwayland implementations of data sharing and SHM · bedc3432
      Jason Ekstrand authored
      This commit adds a wl_resource_init function for initializing wl_resource
      structures similar to wl_client_add_object.
      
      From this commit forward, wl_resource structures should not be initialized
      manually, but should use wl_resource_init.  In the event of a change to the
      wl_resource structure, this allows us to protect against regressions by filling
      in added fields with reasonable defaults.  In this way, while changing
      wl_object or wl_resource still constitutes an ABI break, compositors following
      this rule will only need to be recompiled in order to properly link against the
      new version.
      Signed-off-by: Jason Ekstrand's avatarJason Ekstrand <jason@jlekstrand.net>
      bedc3432
  22. 20 Oct, 2012 1 commit
  23. 16 Aug, 2012 1 commit
  24. 20 Jul, 2012 2 commits
  25. 10 Jul, 2012 1 commit
  26. 09 Jul, 2012 1 commit
  27. 23 May, 2012 1 commit
  28. 22 May, 2012 2 commits
    • Rob Bradford's avatar
      shm: Zero busy count for allocated buffers · 3cc187c7
      Rob Bradford authored
      This avoids a valgrind error like:
      
      ==31496== Conditional jump or move depends on uninitialised value(s)
      ==31496==    at 0x407620: weston_buffer_post_release (compositor.c:928)
      ==31496==    by 0x406AEB: weston_surface_attach (compositor.c:725)
      ==31496==    by 0x409EB8: pointer_attach (compositor.c:2009)
      ==31496==    by 0x34ECE05D63: ffi_call_unix64 (unix64.S:75)
      ==31496==    by 0x34ECE05784: ffi_call (ffi64.c:486)
      ==31496==    by 0x5674C4D: wl_closure_invoke (connection.c:770)
      ==31496==    by 0x566ECCB: wl_client_connection_data (wayland-server.c:255)
      ==31496==    by 0x56722F9: wl_event_source_fd_dispatch (event-loop.c:79)
      ==31496==    by 0x5672C99: wl_event_loop_dispatch (event-loop.c:410)
      ==31496==    by 0x56705FF: wl_display_run (wayland-server.c:1004)
      ==31496==    by 0x40C775: main (compositor.c:2937)
      ==31496==  Uninitialised value was created by a heap allocation
      ==31496==    at 0x4A074CD: malloc (vg_replace_malloc.c:236)
      ==31496==    by 0x5670EA7: shm_pool_create_buffer (wayland-shm.c:113)
      ==31496==    by 0x34ECE05D63: ffi_call_unix64 (unix64.S:75)
      ==31496==    by 0x34ECE05784: ffi_call (ffi64.c:486)
      ==31496==    by 0x5674C4D: wl_closure_invoke (connection.c:770)
      ==31496==    by 0x566ECCB: wl_client_connection_data (wayland-server.c:255)
      ==31496==    by 0x56722F9: wl_event_source_fd_dispatch (event-loop.c:79)
      ==31496==    by 0x5672C99: wl_event_loop_dispatch (event-loop.c:410)
      ==31496==    by 0x56705FF: wl_display_run (wayland-server.c:1004)
      ==31496==    by 0x40C775: main (compositor.c:2937)
      3cc187c7
    • Ander Conselvan de Oliveira's avatar
      ff0d7456
  29. 12 Apr, 2012 1 commit
    • Kristian Høgsberg's avatar
      Switch protocol to using serial numbers for ordering events and requests · 5535f155
      Kristian Høgsberg authored
      The wayland protocol, as X, uses timestamps to match up certain
      requests with input events.  The problem is that sometimes we need to
      send out an event that doesn't have a corresponding timestamped input
      event.  For example, the pointer focus surface goes away and new
      surface needs to receive a pointer enter event.  These events are
      normally timestamped with the evdev event timestamp, but in this case,
      we don't have a evdev timestamp.  So we have to go to gettimeofday (or
      clock_gettime()) and then we don't know if it's coming from the same
      time source etc.
      
      However for all these cases we don't need a real time timestamp, we
      just need a serial number that encodes the order of events inside the
      server.  So we introduce a serial number mechanism that we can use to
      order events.  We still need real-time timestamps for actual input
      device events (motion, buttons, keys, touch), to be able to reason
      about double-click speed and movement speed so events that correspond to user input carry both a serial number and a timestamp.
      
      The serial number also give us a mechanism to key together events that
      are "logically the same" such as a unicode event and a keycode event,
      or a motion event and a relative event from a raw device.
      5535f155