1. 18 Jun, 2013 1 commit
  2. 17 Jun, 2013 1 commit
    • Kristian Høgsberg's avatar
      client: Add wl_display_prepare_read() API to relax thread model assumptions · 3c7e8bfb
      Kristian Høgsberg authored
      The current thread model assumes that the application or toolkit will have
      one thread that either polls the display fd and dispatches events or just
      dispatches in a loop.  Only this main thread will read from the fd while
      all other threads will block on a pthread condition and expect the main
      thread to deliver events to them.
      
      This turns out to be too restrictive.  We can't assume that there
      always will be a thread like that.  Qt QML threaded rendering will
      block the main thread on a condition that's signaled by a rendering
      thread after it finishes rendering.  This leads to a deadlock when the
      rendering threads blocks in eglSwapBuffers(), and the main thread is
      waiting on the condition.  Another problematic use case is with games
      that has a rendering thread for a splash screen while the main thread
      is busy loading game data or compiling shaders.  The main thread isn't
      responsive and ends up blocking eglSwapBuffers() in the rendering thread.
      
      We also can't assume that there will be only one thread polling on the
      file descriptor.  A valid use case is a thread receiving data from a
      custom wayland interface as well as a device fd or network socket.
      The thread may want to wait on either events from the wayland
      interface or data from the fd, in which case it needs to poll on both
      the wayland display fd and the device/network fd.
      
      The solution seems pretty straightforward: just let all threads read
      from the fd.  However, the main-thread restriction was introduced to
      avoid a race.  Simplified, main loops will do something like this:
      
      	wl_display_dispatch_pending(display);
      
      	/* Race here if other thread reads from fd and places events
      	 * in main eent queue.  We go to sleep in poll while sitting on
      	 * events that may stall the application if not dispatched. */
      
      	poll(fds, nfds, -1);
      
      	/* Race here if other thread reads and doesn't queue any
      	 * events for main queue. wl_display_dispatch() below will block
      	 * trying to read from the fd, while other fds in the mainloop
      	 * are ignored. */
      
      	wl_display_dispatch(display);
      
      The restriction that only the main thread can read from the fd avoids
      these races, but has the problems described above.
      
      This patch introduces new API to solve both problems.  We add
      
      	int wl_display_prepare_read(struct wl_display *display);
      
      and
      
      	int wl_display_read_events(struct wl_display *display);
      
      wl_display_prepare_read() registers the calling thread as a potential
      reader of events.  Once data is available on the fd, all reader
      threads must call wl_display_read_events(), at which point one of the
      threads will read from the fd and distribute the events to event
      queues.  When that is done, all threads return from
      wl_display_read_events().
      
      From the point of view of a single thread, this ensures that between
      calling wl_display_prepare_read() and wl_display_read_events(), no
      other thread will read from the fd and queue events in its event
      queue.  This avoids the race conditions described above, and we avoid
      relying on any one thread to be available to read events.
      3c7e8bfb
  3. 14 Jun, 2013 3 commits
  4. 07 Jun, 2013 1 commit
  5. 05 Jun, 2013 9 commits
  6. 28 May, 2013 2 commits
    • Alexander Larsson's avatar
      protocol: Modes are specified in HW pixels · b6930889
      Alexander Larsson authored
      Modes are mainly meant to be used in coordination with fullscreen in
      DRIVER mode, by e.g. games. For such games what they generally want
      is to match some hardware mode and resize their window for that. We
      don't really need to complicate this with the scaling. So, we
      keep the resolutions in HW pixels, and drop the SCALED flag (as it
      is now useless).
      
      This lets you just create e.g an 800x600 buffer of scale 1 and
      fullscreen that, ignoring the output scaling factor (although you can
      of course also respect it and create a 400x300 surface at scale 2).
      Conceptually the mode change is treated like a scaling which overrides
      the normal output scale.
      
      The only complexity is the FILL mode where it can happen that the user
      specifies a buffer of the same size as the screen, but the output has scale
      2 and the buffer scale 1. Just scanning out this buffer will work, but
      effectively this is a downscaling operation, as the "real" size of the surface
      in pels is twice the size of the output. We solve this by allowing FILL to
      downscale (but still not upscale).
      b6930889
    • Alexander Larsson's avatar
      protocol: Use signed int for scale values · e782dbec
      Alexander Larsson authored
      We usually use signed ints for things like this, to avoid
      issues C sign coersion.
      e782dbec
  7. 22 May, 2013 3 commits
    • Alexander Larsson's avatar
      protocol: Support scaled outputs and surfaces · d68c7d8a
      Alexander Larsson authored
      This adds the wl_surface.set_buffer_scale request, and a wl_output.scale
      event. These together lets us support automatic upscaling of "old"
      clients on very high resolution monitors, while allowing "new" clients
      to take advantage of this to render at the higher resolution when the
      surface is displayed on the scaled output.
      
      It is similar to set_buffer_transform in that the buffer is stored in
      a transformed pixels (in this case scaled). This means that if an output
      is scaled we can directly use the pre-scaled buffer with additional data,
      rather than having to scale it.
      
      Additionally this adds a "scaled" flag to the wl_output.mode flags
      so that clients know which resolutions are native and which are scaled.
      
      Also, in places where the documentation was previously not clear as to
      what coordinate system was used this was fleshed out.
      
      It also adds a scaling_factor event to wl_output that specifies the
      scaling of an output.
      
      This is meant to be used for outputs with a very high DPI to tell the
      client that this particular output has subpixel precision. Coordinates
      in other parts of the protocol, like input events, relative window
      positioning and output positioning are still in the compositor space
      rather than the scaled space. However, input has subpixel precision
      so you can still get input at full resolution.
      
      This setup means global properties like mouse acceleration/speed,
      pointer size, monitor geometry, etc can be specified in a "mostly
      similar" resolution even on a multimonitor setup where some monitors
      are low dpi and some are e.g. retina-class outputs.
      d68c7d8a
    • Alexander Larsson's avatar
      protocol: Allow output changes to be treated atomically · 911c0684
      Alexander Larsson authored
      This add a wl_output.done event which is send after every group
      of events caused by some property change. This allows clients to treat
      changes touching multiple events in an atomic fashion.
      911c0684
    • Peng Wu's avatar
      protocol: Fix documentation typo · 5144cf62
      Peng Wu authored
      5144cf62
  8. 08 May, 2013 1 commit
  9. 07 May, 2013 1 commit
    • Kristian Høgsberg's avatar
      Remove input structs · e920572e
      Kristian Høgsberg authored
      Looking at the functionality in the server library, it's clear (in
      hindsight) that there are two different "things" in there: 1) The IPC
      API, that is, everything that concerns wl_display, wl_client,
      wl_resource and 2) and half-hearted attempt at sharing input code and
      focus logic that leaves a lot of problematic structs in the API
      surface, only to share less than 1000 lines of code.
      
      We can just move those input structs and helper functions into weston
      and cut libwayland-server down to just the core server side IPC API.
      In the short term, compositors can copy those structs and functions
      into their source, but longer term, they're probably better off
      reimplementing those objects and logic their native framework
      (QObject, GObject etc).
      e920572e
  10. 29 Apr, 2013 1 commit
  11. 18 Apr, 2013 2 commits
  12. 16 Apr, 2013 2 commits
  13. 04 Apr, 2013 7 commits
  14. 03 Apr, 2013 6 commits
    • Kristian Høgsberg's avatar
      477dcd84
    • Kristian Høgsberg's avatar
      configure.ac: Fix publican version check · c42b09b4
      Kristian Høgsberg authored
      This sure is ugly - we feed output of publican -v into bc to compare
      against minimum required version, 2.8.  That's bad enough, but when
      publican suddenly report 3.0.0, bc starts complaining...
      
      Use sed to filter out 3.0 from the 'version=3.0.0' output from publican
      instead.  Seem a little more robust, but it's just a matter of time before
      something else breaks this flaky setup.
      
      Hey, publican, how about shipping .pc files?
      c42b09b4
    • Peter Hutterer's avatar
      doc: rename "Wayland" to "publican" · 9d296fc7
      Peter Hutterer authored
      This directory was called Wayland during my early tries with publican where
      the source layout was different and it needed to be set to the same name as
      the publican output directory. This reason doesn't exist anymore, so re-name
      it to publican to make it more obvious what's hiding in here.
      Signed-off-by: Peter Hutterer's avatarPeter Hutterer <peter.hutterer@who-t.net>
      9d296fc7
    • Peter Hutterer's avatar
      doc: generate man pages from doxygen · 8ccab1ba
      Peter Hutterer authored
      Create client-side and server-side man pages from doxygen. The doxygen
      config options are virtually the same as for the XML output, but we do pass
      in the specific options via stdin.
      
      WL_EXPORT is predefined to the empty string, it makes the man page look
      confusing and provides no value here anyway. This applies for both xml and
      man output.
      
      JAVADOC_AUTOBRIEF is disabled for man pages, the formatting in the resulting
      man page is IMO hard to read.
      
      Most of the server man pages are virtually empty, there's just not enough
      documentation in the source files.
      
      Interesting issue: the usage of @code in the protocol to reference the
      parameter breaks the expansion of WL_EXPORT, thus leaving us with WL_EXPORT
      in all the man pages.
      Presumably this is an issue with doxygen interpreting this as a @code
      command, but I already wasted enough time narrowing this down.
      Signed-off-by: Peter Hutterer's avatarPeter Hutterer <peter.hutterer@who-t.net>
      8ccab1ba
    • Peter Hutterer's avatar
      protocol: fix two protocol description 'typos' · e5202f76
      Peter Hutterer authored
      Remove "mice, for example", it's described in the wl_pointer interface in
      detail. And remove space before the full stop.
      Signed-off-by: Peter Hutterer's avatarPeter Hutterer <peter.hutterer@who-t.net>
      e5202f76
    • Peter Hutterer's avatar
      protocol: document wl_pointer, wl_keyboard, wl_touch · 9c0357af
      Peter Hutterer authored
      Most of this should be clear, but let's spell a few things out.
      Signed-off-by: Peter Hutterer's avatarPeter Hutterer <peter.hutterer@who-t.net>
      9c0357af