1. 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
      end.
      
      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:
      https://github.com/ppaalanen/wesgr
      
      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
        screen?
      - 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>
      b502654b
    • 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
      	weston_surface_set_label_func().
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
      8274d901
  2. 24 Nov, 2014 1 commit
    • Pekka Paalanen's avatar
      desktop-shell: don't crash input-panel if no kbd focus · a4bac9e0
      Pekka Paalanen authored
      If a keyboard exists but it has no current focus, yet something asks the
      input-panel to come up, we would crash here. Check that there is a focus
      before attempting to use it.
      
      Maybe there should not even exist a case where input-panel tries to come
      up without a keyboard focus, but I am not sure there is no race where it
      could happen.
      
      In any case, this fix was brought up by the ivi-shell work, where I
      suppose you can somehow hit it.
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
      Cc: Tanibata, Nobuhiko <ntanibata@jp.adit-jv.com>
      a4bac9e0
  3. 21 Nov, 2014 1 commit
  4. 05 Nov, 2014 1 commit
    • Derek Foreman's avatar
      compositor: Refactor weston_output_mode_switch() · 6ae7bc98
      Derek Foreman authored
      This breaks weston_output_mode_switch() into 3 functions:
      weston_output_mode_set_native()
      weston_output_mode_switch_to_temporary()
      weston_output_mode_switch_to_native()
      
      Differences from previous behaviour:
      SET_NATIVE didn't set current_scale (now it does)
      SET_TEMPORARY could set mode and scale independently - now it can't.
      Signed-off-by: default avatarDerek Foreman <derekf@osg.samsung.com>
      Pekka Paalanen <pekka.paalanen@collabora.co.uk>
      6ae7bc98
  5. 08 Oct, 2014 1 commit
    • Pekka Paalanen's avatar
      compositor: send error for surface role resets · 50b67479
      Pekka Paalanen authored
      With the more accurate definition of wl_surface roles in Wayland,
      enforce the restriction: a role is always set permanently, and
      attempting to change it is a protocol error.
      
      This patch is based on Jasper's patch:
      http://lists.freedesktop.org/archives/wayland-devel/2014-August/016811.html
      
      The difference in this patch compared to his are:
      
      - send role errors on the interface whose request triggers it, not on
        wl_surface
      
      - an interface could have several requests assigning different roles,
        cannot use wl_interface as the unique key; use an arbitary string
        instead
      
      - ensure in window-manager.c that create_shell_surface() ->
        create_common_surface() is never called with surface->configure set,
        to avoid compositor abort
      
      - use wl_resource_post_no_memory() where appropriate instead of
        hand-rolling it with wl_resource_post_error()
      
      Ideally we would not add weston_surface::role_name field, but use
      weston_surface::configure. At the moment this is not possible though,
      because at least shell.c uses several different roles with the same
      configure function. Drag'n'drop uses two configure functions for the
      same role. The configure hook is also reset in several places,
      which is not good for role tracking.
      
      This patch overlooks the wl_surface roles assigned in privileged
      extensions: screensaver, panel, background, lock, input panel.
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
      Reviewed-by: Jasper St. Pierre's avatarJasper St. Pierre <jstpierre@mecheye.net>
      50b67479
  6. 01 Oct, 2014 1 commit
  7. 22 Sep, 2014 1 commit
    • Derek Foreman's avatar
      shell: fix weston_output_mode_switch() usage · 69c6273f
      Derek Foreman authored
      Calling weston_output_mode_switch() with WESTON_MODE_SWITCH_RESTORE_NATIVE
      will result in the mode being set "back" to the passed in mode - so the
      passed mode should be the native mode.
      
      Additionally, weston_output_mode_switch() should be called when
      output->original_mode is non-NULL (which indicates we had a temporary
      mode set).  The comparison to current_mode results in a lot of
      log chatter.
      Acked-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
      69c6273f
  8. 11 Sep, 2014 1 commit
  9. 10 Sep, 2014 2 commits
  10. 05 Sep, 2014 3 commits
  11. 04 Sep, 2014 1 commit
  12. 01 Sep, 2014 1 commit
  13. 28 Aug, 2014 1 commit
    • Pekka Paalanen's avatar
      shell: fix race on desktop-shell exit · 826dc14e
      Pekka Paalanen authored
      The desktop shell plugin registers both a wl_client destroy signal
      listener, and a sigchld handler, when launching weston-desktop-shell.
      However, nothing guarantees in which order do the wl_client destructor
      and the sigchld handler run.
      
      Luckily, the sigchld handler cannot interrupt any code, because we
      handle the signal via signalfd, which means it is handled like any event
      in the compositor's main event loop.
      
      Still, shell.c has a race, that when lost, can cause a crash, as
      described in bug #82957.
      
      If the sigchld handler happens to run first, it will try to launch a new
      weston-desktop-shell without removing the destroy listener from the old
      wl_client first. This leads to list corruption, that may cause a crash
      when the old wl_client gets destroyed.
      
      Simply removing the destroy listener in the sigchld handler is not
      enough, because respawning sets shell->child.client pointer, and if
      the wl_client destructor runs after, it will reset it to NULL.
      
      OTOH, the wl_client destroy handler cannot reset shell->child.process,
      because that would cause the sigchld handler in weston core to not find
      the process tracker anymore, and report that an unknown process exited.
      
      Turns out, that to make everything work, we would need to wait for both
      the wl_client destructor and the sigchld handler to have run, before
      respawn. This gets tricky.
      
      Instead, solve the problem by removing shell->child.process. Use the new
      weston_client_start() which automatically creates and manages the struct
      weston_process. The shell does not need to know about the process exit,
      it only needs to know about the client disconnect. Weston-desktop-shell
      will never attempt to reconnect, and it would not work even if it did,
      so disconnect is equivalent to weston-desktop-shell exiting.
      
      This should permanently solve the race for weston-desktop-shell.
      
      Bug: https://bugs.freedesktop.org/show_bug.cgi?id=82957
      Cc: Boyan Ding <stu_dby@126.com>
      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>
      826dc14e
  14. 27 Aug, 2014 2 commits
  15. 22 Aug, 2014 1 commit
    • Derek Foreman's avatar
      tests: allow running make check without make install · c7210434
      Derek Foreman authored
      desktop shell and weston keyboard both refer to themselves prefixed by
      LIBEXECDIR, however this is only valid once installed.  make check will
      currently either fail or run pre-existing versions.
      
      This patch adds a way to override that location by setting the env var
      WESTON_BUILD_DIR - which is then set by the test env script so make check
      will test the versions in the build directory regardless of whether they're
      installed or not.
      Reviewed-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
      c7210434
  16. 21 Aug, 2014 1 commit
    • Pekka Paalanen's avatar
      xdg-shell: bump experimental protocol version · 71182aed
      Pekka Paalanen authored
      The experimental versioning has not been updated when it was supposed
      to. Let's try to be better at it now, as xdg-shell is close to have its
      first stable version.
      
      Bump the version now to bring the world into the same exact version.
      
      There may be some protocol changes still coming, but we try to land them
      before 1.6 gets out. Those changes will bump the experimental version
      again as needed.
      
      When 1.6.0 is released, the experimental version will no longer be
      bumped, and no incompatible protocol changes will be made. Xdg-shell.xml
      file will move to Wayland in 1.7.0, drop the experimental versioning,
      and become stable.
      
      Cc: Jasper St. Pierre <jstpierre@mecheye.net>
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
      71182aed
  17. 20 Aug, 2014 2 commits
  18. 18 Aug, 2014 2 commits
  19. 08 Aug, 2014 2 commits
  20. 07 Aug, 2014 1 commit
  21. 23 Jul, 2014 1 commit
    • Giulio Camuffo's avatar
      compositor: keep track of the weston_layer a weston_view is in · 412e6a59
      Giulio Camuffo authored
      This introduces a new struct, weston_layer_entry, which is now used
      in place of wl_list to keep the link for the layer list in weston_view
      and the head of the list in weston_layer.
      weston_layer_entry also has a weston_layer*, which points to the layer
      the view is in or, in the case the entry it's the head of the list, to
      the layer itself.
      412e6a59
  22. 17 Jul, 2014 2 commits
    • Jasper St. Pierre's avatar
      shell: Replace set_margin with set_window_geometry · ccf48fb4
      Jasper St. Pierre authored
      Currently, there is a fun flicker when toggling maximization or
      fullscreen on a window in mutter or more sophisicated compositors
      and WMs.
      
      What happens is that the client want so go maximized, so we
      calculate the size that we want the window to resize to (640x480),
      and then add on its margins to find the buffer size (+10 = 660x500),
      and then send out a configure event for that size. The client
      renders to that size, realizes that it's maximized, and then
      says "oh hey, my margins are actually 0 now!", and so the compositor
      has to send out another configure event.
      
      In order to fix this, make the the configure request correspond to
      the window geometry we'd like the window to be at. At the same time,
      replace set_margin with set_window_geometry, where we specify a rect
      rather than a border around the window.
      ccf48fb4
    • Jasper St. Pierre's avatar
      Interpret the size in the configure event as window geometry · bd65e508
      Jasper St. Pierre authored
      The size of the configure event has always been specified as in window
      geometry coordinates, but it was never implemented this way.
      bd65e508
  23. 26 Jun, 2014 1 commit
  24. 23 Jun, 2014 1 commit
  25. 19 Jun, 2014 2 commits
  26. 23 May, 2014 1 commit
  27. 13 May, 2014 4 commits
    • Jasper St. Pierre's avatar
    • Jasper St. Pierre's avatar
      shell: Don't use the helper methods in xdg_shell implementations · 9aa8ce69
      Jasper St. Pierre authored
      With most of the code in send_configure_for_surface, the helper
      methods don't give us that much benefit, so stop using them. We
      can't kill them off, as they're part of the shell interface and
      used by the WM.
      9aa8ce69
    • Jasper St. Pierre's avatar
      shell: Centralize management of sending configure requests · 6458ec34
      Jasper St. Pierre authored
      Currently, there's a giant bug in how xdg-shell state management
      is done. If a client calls set_fullscreen and then set_maximized,
      it will get two configure events:
      
        => set_fullscreen
        <= configure(800, 600, [STATE_FULLSCREEN])
      
        => set_maximized
        <= configure(800, 560, [STATE_FULLSCREEN, STATE_MAXIMIZED])
      
      Since fullscreen takes precedence over maximized, the client will
      render full-screen at 800x600 first, and then 800x560 next. As
      a result, the surface gets the wrong size.
      
      This is because the code that sends out configure requests is
      "immediate" -- when an app calls set_maximized, we immediately
      send out the configure event that would have happened if we
      transitioned immediately into maximized mode.
      
      In wl_shell, this is correct behavior. However, in xdg-shell,
      this is wrong. State needs to be more carefully managed in
      xdg-shell, as states aren't exclusive.
      
      Pull all the code that sends out configure events out and send
      them centrally, based on Weston's on surface state management.
      This should work with both wl_shell and xdg_shell's strategies.
      6458ec34
    • Jasper St. Pierre's avatar
      xdg-shell: Turn "activated" into a state · 973d7879
      Jasper St. Pierre authored
      This drops two events, and makes new window decorations race-free with
      an attach in-flight.
      973d7879