1. 11 Jun, 2015 1 commit
  2. 08 May, 2015 1 commit
    • Giulio Camuffo's avatar
      compositor: send the output_created signal after inserting it in the list · b114715d
      Giulio Camuffo authored
      The compositor's output_created signal used to be sent in weston_output_init()
      which the backend call before putting the output in the output_list.
      This caused problems when creating a new view in a listener to that signal,
      because weston_view_assign_output() doesn't yet know the new output exists.
      To fix this add a new weston_composito_add_output() func which adds the
      output in the list and later sends the signal, and make the backends call
  3. 01 May, 2015 1 commit
  4. 30 Apr, 2015 2 commits
    • Pekka Paalanen's avatar
      compositor: change weston_surface::destroy_signal argument · ca79076b
      Pekka Paalanen authored
      Pass 'this' weston_surface as the data argument to
      weston_surface::destroy_signal listeners. The old &surface->resource was
      really just an offsetted pointer to the weston_surface anyway. And,
      because 'resource' happened to be the first member in struct weston_surface,
      it was actually 'this' weston_surface.
      The argument type was accidentally changed in commit
       from wl_resource* to
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
    • Pekka Paalanen's avatar
      compositor: inert wl_surface objects do not exist · 08d3fb76
      Pekka Paalanen authored
      There is no valid case, where you would actually destroy a
      weston_surface, while leaving the wl_surface protocol object in
      existence. Therefore, inert wl_surface objects do not exist, except
      because of bugs.
      To catch such bugs, check that the resource is really NULL before
      actually destroying the weston_surface.
      We actually used to have this check, but it was removed by:
      	commit 9dadfb53
      	Author: Kristian Høgsberg <krh@bitplanet.net>
      	Date:   Mon Jul 8 13:49:36 2013 -0400
      	    compositor: Eliminate marshalling warning for leave events
      However, the invariant was put back in:
      	commit 0d379744
      	Author: Giulio Camuffo <giuliocamuffo@gmail.com>
      	Date:   Fri Nov 15 22:06:15 2013 +0100
      	    compositor: set weston_surface:resource to NULL when destroyed
      So apparently the issue fixed by 9dadfb53
       was fixed another way later.
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
  5. 07 Apr, 2015 1 commit
  6. 27 Mar, 2015 6 commits
  7. 20 Mar, 2015 4 commits
    • Pekka Paalanen's avatar
      compositor: fix return code from main() · 111c6f9b
      Pekka Paalanen authored
      There were a few cases of 'goto out' in main() that did not set ret to
      EXIT_FAILURE. Shell failing to init is the one I hit when writing tests
      for ivi-shell.
      Rather than adding a few more 'ret = EXIT_FAILURE', make that the
      default and remove the redundant assignments. When Weston exits
      properly ec->exit_code will take care of the exit code.
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
      Reviewed-by: default avatarEmilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
    • Pekka Paalanen's avatar
      compositor: warn about insane repaint delay · 8fd4de45
      Pekka Paalanen authored
      Make the sanity check more explicit and log a warning if it happens.
      Small negative values are ok because it just means the compositor is
      lagging behind, or more likely the user specified a too long repaint
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
      Reviewed-By: default avatarDerek Foreman <derekf@osg.samsung.com>
      Reviewed-by: default avatarBryce Harrington <b.harrington@samsung.com>
    • Pekka Paalanen's avatar
      compositor: add repaint delay timer · 0513a95a
      Pekka Paalanen authored
      This timer delays the output_repaint towards the end of the refresh
      period, reducing the time from repaint to present.
      The length of the repaint window can be set in weston.ini.
      The call to weston_output_schedule_repaint_reset() is delayed by one
      more period.  If we exit the continuous repaint loop (set
      output->repaint_scheduled to false) in finish_frame, we may call
      start_repaint_loop() unnecessarily.  The problem case was actually
      observed with two outputs on the DRM backend at 60 Hz, and 7 ms
      repaint-window. During a window move, one output was constantly falling
      off the continuous repaint loop and introducing additional one frame
      latency, leading to jerky window motion. This code now avoids the
      Changes in v2:
      - Rename repaint_delay_timer to repaint_timer and
      output_repaint_delay_handler to output_repaint_timer_handler.
      - When computing the delay, take the current time into account. The timer
      uses a relative timeout, so we have to subtract any time already gone.
      Note, that 'gone' may also be negative. DRM has a habit of predicting
      the page flip timestamp so it may be still in the future when we get the
      completion event.
      - Do also a sanity check 'msec > 1000'. In the unlikely case that
      something fails to provide a good timestamp, never delay for more than
      one second.
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
      Reviewed-By: default avatarDerek Foreman <derekf@osg.samsung.com>
      Reviewed-by: default avatarBryce Harrington <bryce@osg.samsung.com>
    • Pekka Paalanen's avatar
      compositor, backends: weston_compositor_read_presentation_clock · 662f384e
      Pekka Paalanen authored
      Create a new function weston_compositor_read_presentation_clock() to
      wrap the clock_gettime() call for the Presentation clock.
      Reading the presentation clock is never supposed to fail, but if it
      does, this will notify about it. I have not seen it fail yet, though.
      This prepares for new testing features in the future that might allow
      controlling the presentation clock. Right now it is just a convenience
      function for clock_gettime().
      All presentation clock readers are converted to call this new function
      except rpi-backend's rpi_flippipe_update_complete(), because it gets its
      clock id via a thread-safe mechanism. There shouldn't be anything really
      thread-unsafe in weston_compositor_read_presentation_clock() at the
      moment, but might be in the future, and weston core is not expected to
      need to be thread-safe.
      This is based on the original patch by
      Cc: Derek Foreman <derekf@osg.samsung.com>
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
      Reviewed-By: default avatarDerek Foreman <derekf@osg.samsung.com>
      Reviewed-by: default avatarBryce Harrington <bryce@osg.samsung.com>
  8. 11 Mar, 2015 4 commits
  9. 04 Mar, 2015 2 commits
  10. 26 Feb, 2015 4 commits
  11. 25 Feb, 2015 1 commit
    • Pekka Paalanen's avatar
      compositor: add surface-shooting API · c647ed79
      Pekka Paalanen authored
      This is an optional API that will be implemented by the renderers. It
      allows to fetch the current contents of a surface, essentially the
      buffer contents from a client buffer, converted to an RGBA format.
      This is meant as a debugging API. The implementations may be heavy and
      cause a stall, so they are not intended to be used often during normal
      Renderers are expected to convert whatever data a surface has to a
      single RGBA format.
      Changes in v2:
      - remove stride and format arguments from the API
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
      v1 Tested-by: Nobuhiko Tanibata <NOBUHIKO_TANIBATA@xddp.denso.co.jp>
      Reviewed-by: Daniel Stone's avatarDaniel Stone <daniels@collabora.com>
  12. 24 Feb, 2015 2 commits
    • Pekka Paalanen's avatar
      compositor: turn weston_view boundingbox into masked · 25c0ca57
      Pekka Paalanen authored
      weston_view::transform.boundingbox is made to include the layer mask,
      which removes the need for masked_boundingbox.
      The following were using boundingbox when they should have used
      - drm_output_prepare_overlay_view() uses boundingbox to compute overlay
        position, source and destination coordinates.
      - drm_assign_planes() uses boundingbox for view overlap checks.
      - is_view_not_visible() uses boundingbox, but nothing will show outside
        the layer mask.
      - weston_surface_assign_output() intersects boundingbox with output
        region to choose the primary output for a surface.
      - weston_view_assign_output() intersects boundingbox with output region
        to pick the outputs the view is on.
      This patch essentially changes all those cases to use the masked
      Therefore there are no cases which would need the boundingbox without
      the layer mask, and we can convert boundingbox into masked and remove
      the left-over member.
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
      [v2: don't move the decl of 'mask' in weston_view_update_transform]
      Reviewed-By: default avatarGiulio Camuffo <giuliocamuffo@gmail.com>
    • Pekka Paalanen's avatar
      compositor: turn weston_view::transform.opaque into masked · 8844bf2a
      Pekka Paalanen authored
      Turns out there were no users of weston_view::transform.opaque,
      everything was already using transform.masked_opaque. Therefore
      repurpose transform.opaque as masked_opaque, and remove masked_opaque
      Now this opaque region in global coordinates is clipped by the layer
      mask, if set. There are no cases where you would need the opaque region
      without the effect of layer mask.
      Also add a note in compositor.h, that changing view's layer counts as
      changing geometry, which requires calling weston_view_geometry_dirty()
      to let all derived state update.
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
      Reviewed-By: default avatarGiulio Camuffo <giuliocamuffo@gmail.com>
  13. 19 Feb, 2015 1 commit
  14. 18 Feb, 2015 1 commit
  15. 21 Jan, 2015 2 commits
    • Pekka Paalanen's avatar
      compositor, drm: set per-surface Presentation feedback flags · bf0e031e
      Pekka Paalanen authored
      PRESENTATION_FEEDBACK_KIND_ZERO_COPY is a flag that needs to be set for
      each surface separately. Some surfaces may be zero-copy (as defined by
      Presentation feedback) while some are not.
      A complication with Weston is that a surface may have multiple views on
      screen. All copies (views) of the surface are required to be zero-copy
      for the ZERO_COPY flag to be set.
      Backends set per-view feedback flags during the assing_planes hook, and
      then Weston core collects the flags from all views of a surface.
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
      Reviewed-by: Mario Kleiner's avatarMario Kleiner <mario.kleiner.de@gmail.com>
      Tested-by: Mario Kleiner's avatarMario Kleiner <mario.kleiner.de@gmail.com>
    • Pekka Paalanen's avatar
      compositor: set presentation.presented flags · 363aa7bc
      Pekka Paalanen authored
      Change weston_output_finish_frame() signature so that backends are
      required to set the flags, that will be reported on the Presentation
      'presented' event. This is meant for output-wide feedback flags. Flags
      that vary per wl_surface are subject for the following patch.
      All start_repaint_loop functions use the special private flag
      PRESENTATION_FEEDBACK_INVALID to mark, that this call of
      weston_output_finish_frame() cannot trigger the 'presented' event. If it
      does, we now hit an assert, and should then investigate why a fake update
      triggered Presentation feedback.
      Page flip is always vsync'd, and always gets the completion timestamp
      from the kernel which should correspond well to hardware. Completion is
      triggered by the kernel/hardware.
      Vblank handler is only used with the broken planes path, therefore do
      not report VSYNC, because we cannot guarantee all the planes updated at
      the same time. We cannot set the INVALID, because it would abort the
      compositor if the broken planes path was ever used.  This is a hack that
      will get fixed with nuclear pageflip support in the future.
      No vsync, update done by copy, no completion event from hardware, and
      completion time is totally fake.
      No real output to update.
      Guessing that maybe no vsync, fake time, and copy make sense (pixels
      sent over network). Also no event that the pixels have been shown?
      Presumably Dispmanx updates are vsync'd. We get a completion event from
      the driver, but need to read the clock ourselves, so the completion time
      is somewhat unreliable. Zero-copy flag not implemented though it would
      be theoretically possible with EGL clients (zero-copy is a per-surface
      flag anyway, so in this patch).
      No information how the host compositor is doing updates, so make a safe
      guess without assuming vsync or hardware completion event. While we do
      get some timestamp from the host compositor, it is not the completion
      time. Would need to hook to the Presentation extension of the host
      compositor to get more accurate flags.
      No idea about vsync, completion event, or copying. Also the timestamp is
      a fake.
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
      Reviewed-by: Mario Kleiner's avatarMario Kleiner <mario.kleiner.de@gmail.com>
      Tested-by: Mario Kleiner's avatarMario Kleiner <mario.kleiner.de@gmail.com>
      Acked-by: Mario Kleiner's avatarMario Kleiner <mario.kleiner.de@gmail.com>
  16. 15 Dec, 2014 1 commit
  17. 08 Dec, 2014 2 commits
    • Pekka Paalanen's avatar
      compositor: Implement JSON-timeline logging · b502654b
      Pekka Paalanen authored
      Logging is activated and deactivated with the debug key binding 't'.
      When activated, it creates a new log file, where it records the events.
      The log file contains events and detailed object information entries in
      JSON format, and is meant to be parsed in sequence from beginning to the
      The emitted events are mostly related to the output repaint cycle, like
      when repaint begins, is submitted to GPU, and when it completes on a
      vblank. This is recorded per-output. Also some per-surface events are
      recorded, including when surface damage is flushed.
      To reduce the log size, events refer to objects like outputs and
      surfaces by id numbers. Detailed object information is emitted only as
      needed: on the first object occurrence, and afterwards only if
      weston_timeline_object::force_refresh asks for it.
      The detailed information for surfaces includes the string returned by
      weston_surface::get_label. Therefore it is important to set
      weston_timeline_object::force_refresh = 1 whenever the string would
      change, so that the new details get recorded.
      A rudimentary parser and SVG generator can be found at:
      The timeline logs can answer questions including:
      - How does the compositor repaint cycle work timing-wise?
      - When was the vblank deadline missed?
      - What is the latency from surface commit to showing the new content on
      - How long does it take to process the scenegraph?
      v2: weston_surface::get_description renamed to get_label.
      v3: reafctor a bit into fprint_quoted_string().
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
    • Pekka Paalanen's avatar
      compositor: add weston_surface_set_label_func() · 8274d901
      Pekka Paalanen authored
      When printing out logs from Weston's actions, mainly for debugging, it
      can be very difficult to identify the different surfaces.  Inspecting
      the configure function pointer is not useful, as the configure functions
      may live in modules.
      Add vfunc get_label to weston_surface, which will produce a short,
      human-readable description of the surface, which allows identifying it
      better, rather than just looking at the surface size, for instance.
      Set the label function from most parts of Weston, to identify cursors and
      drag icons, and panels, backgrounds, screensavers and lock surfaces, and
      the desktop shell's application surfaces.
      v2: renamed 'description' to 'label', so we get
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
  18. 28 Nov, 2014 2 commits
  19. 21 Nov, 2014 2 commits