1. 27 May, 2020 1 commit
    • verdre's avatar
      clutter/text: Also queue relayout if the actor has no valid allocation · 0b6a3166
      verdre authored
      In clutter_text_queue_redraw_or_relayout() we check whether the size
      of the layout has changed and queue a relayout if it did, otherwise we
      only queue a redraw and save some resources.
      The current check for this also queues a redraw if the actor has no
      valid allocation. That seems right on the first glance since the actor
      will be allocated anyway, but we actually want to call
      clutter_actor_queue_relayout() again here because that also invalidates
      the size cache of the actor which might have been updated and marked
      valid in the meantime.
      So make sure the size cache is always properly invalidated after the
      size of the layout changed and also call clutter_actor_queue_relayout()
      in case the actor has no allocation.
      This fixes a bug where getting the preferred width of a non-allocated
      ClutterText, then changing the string of the ClutterText, and then
      getting the preferred width again would return the old cached width (the
      width before we changed the string).
      The only place where this bug is currently happening is in the overview,
      where we call get_preferred_width() on the unallocated ClutterText of
      the window clone title: When the window title changes while the
      ClutterText is unallocated the size of the title is going to be wrong
      and the text might end up ellipsized or too large.
  2. 26 May, 2020 32 commits
    • Jonas Ådahl's avatar
      wayland: Drive frame callbacks from stage updates · 066bc598
      Jonas Ådahl authored
      Don't tie frame callbacks to actor painting, as it may end up in
      situations where we miss sending frame callbacks when we should have. An
      example of this is when a surface is partially off screen, and then
      reports damage that is fully off screen. When this happen, we are likely
      not to repaint anything, thus we won't send any frame callbacks even
      though it's "suitable" for rendering again, as the surface is not on a
      separate workspace or fully obscured.
      Closes: #817
      Closes: #1152
    • Jonas Ådahl's avatar
      wayland/compositor: Pass backend when constructing · e8b09df8
      Jonas Ådahl authored
      This is so that it can be retrieved later without going via the global
    • Jonas Ådahl's avatar
      Reshuffle Wayland initailization · 1571f807
      Jonas Ådahl authored
      Move Wayland support (i.e. the MetaWaylandCompositor object) made to be
      part of the backend. This is due to the fact that it is needed by the
      backend initialization, e.g. the Wayland EGLDisplay server support.
      The backend is changed to be more involved in Wayland and clutter
      initialization, so that the parts needed for clutter initialization
      happens before clutter itself initialization happens, and the rest
      happens after. This simplifies the setup a bit, as clutter and Wayland
      init now happens as part of the backend initialization.
    • Jonas Ådahl's avatar
      surface-actor: Move out some X11-ism to X11 subclass · 510cbef1
      Jonas Ådahl authored
      On X11 we don't update the texture in certain circumstances, such as if
      the surface is a fullscreen unredirect, or doesn't have a Pixmap. On
      Wayland we only want to avoid updating the texture if there is no
      texture, but as this is handled implicitly by MetashapedTexture, we
      don't need to try to emulate the X11-y conditions in the generic layer
      and instead just have the implementations handle update processing
      This doesn't have any functional changes, but removes a vfunc from
    • Jonas Ådahl's avatar
      clutter/stage: Make clutter_stage_schedule_update() public API · 99c9a14b
      Jonas Ådahl authored
      It's effectively used by mutter by abusing a ClutterTimeline to scedule
      updates.  Timelines are not really suited in places that is done, as it
      is really just about getting a single new update scheduled whenever
      suitable, so expose the API so we can use it directly.
    • Jonas Ådahl's avatar
      clutter/stage: Make clutter_stage_schedule_update() always schedule · b8003807
      Jonas Ådahl authored
      We could call clutter_stage_schedule_update() and it wouldn't actually
      schedule anything, as the master frame clock only tries to reschedule if
      1) there is an active timeline, 2) there are pending relayouts, 3) there
      are pending redraws, or 4) there are pending events. Thus, a call to
      clutter_stage_schedule_update() didn't have any effect if it was called
      at the wrong time.
      Fix this by adding a boolean state "needs_update" to the stage, set on
      clutter_stage_schedule_update() and cleared on
      _clutter_stage_do_update(), that will make the master clock reschedule
      an update if it is TRUE.
    • verdre's avatar
      clutter/stage-cogl: Use view fb instead of onscreen fb for debug-drawing · 8e1bd64e
      verdre authored
      We need to use the framebuffer of the view instead of the onscreen
      framebuffer when painting the damage region, otherwise the redraw clips
      on rotated monitors won't be shown correctly.
    • Jonas Ådahl's avatar
      clutter/stage-cogl: Remove unneeded helper · 5aa56aa7
      Jonas Ådahl authored
      The helper called a single function; lets just call it directly instead.
    • Jonas Ådahl's avatar
      clutter/stage-view: Add tile based shadow damage detection · c2c4f749
      Jonas Ådahl authored
      Compare, tile by tile, whether actual damage actually changed any
      pixels. While this requires mmap():ing DMA buffers and comparing their
      content, we should only ever use shadow buffers when we're using the
      software renderer, meaning mmap() is cheap as it doesn't involve any
      This works by making the shadow framebuffer double buffered, while
      keeping track of damage history. When we're about to swap the onscreen
      buffer, we compare what part of the posted damage actually changed,
      records that into a damage history, then given the onscreen buffer age,
      collect all actual damage for that age. The intersection of these tiles,
      and the actual damage, is then used when blitting the shadow buffer to
      the onscreen framebuffer.
      Closes: #1157
    • Jonas Ådahl's avatar
      cogl/dma-buf: Add mmap/munmap helpers · f8daa6bc
      Jonas Ådahl authored
      Avoids dealing directly with mmap() and munmap().
    • Jonas Ådahl's avatar
      cogl/dma-buf: Add API to synchronize reading · 5b07ccd0
      Jonas Ådahl authored
      Used before and after accessing DMA buffer content using mmap().
    • Jonas Ådahl's avatar
      clutter/stage-cogl: Extract damage history logic · ae4d2994
      Jonas Ådahl authored
      Move the damage history tracking to a new ClutterDamageHistory helper
      type. The aim is to be able to track damage history elsewhere without
      reimplementing the data structure and tracking logic.
    • Jonas Ådahl's avatar
      clutter/stage-view: Only blit the damage part of the shadow buffer · 87983254
      Jonas Ådahl authored
      This fixes the last "copy everything" paths when clutter doesn't
      directly paint onto the onscreen framebuffer. It adds a new hook into
      the stage view called before the swap buffer, as at this point, we have
      the swap buffer damag regions ready, which corresponds to the regions we
      must blit according to the damage reported to clutter.
    • Jonas Ådahl's avatar
      clutter/stage-cogl: Only construct damage array if it'll be used · 9e340287
      Jonas Ådahl authored
      It's only used when we actually swap buffers, which we only do if the
      target framebuffer is an onscreen.
    • Jonas Ådahl's avatar
      clutter/stage-view: Only paint redraw clip from offscreen · 258f859e
      Jonas Ådahl authored
      The rest didn't change, so only actually paint the part of the offscreen
      that was composited as part of the stage painting. In practice, this
      means that, unless a shadow buffer is used, we now only paint the
      damaged part of the stage, and copy the damage part of the offscreen to
      the onscreen.
    • Jonas Ådahl's avatar
      clutter/stage-cogl: Use buffer age when view monitor is rotated · 9d3e4fd4
      Jonas Ådahl authored
      We failed to use the buffer age when monitors were rotated, as when they
      are, we first composite to an offscreen framebuffer, then later again to
      the onscreen. The buffer age checking happened on the offscreen, and an
      offscreen being single buffered, they can't possible support buffer
      Instead, move the buffer age check to check the actual onscreen
      framebuffer. The offscreen to onscreen painting is still always full
      frame, but that will be fixed in a later commit.
    • Jonas Ådahl's avatar
      region-utils: Make transform util const correct · 03c65b93
      Jonas Ådahl authored
      The input should be const, as it will not be altered.
    • Jonas Ådahl's avatar
      clutter/stage-view: Simplify painting of offscreen slightly · db975bd2
      Jonas Ådahl authored
      We will only ever have an "offscreen" if we're painting transformed in
      some way, so the 'can_blit' checking is unnecessary. Remove it.
    • Jonas Ådahl's avatar
      clutter/stage-view: Always use cogl_blit_framebuffer() from shadowfb · 4e27a4ea
      Jonas Ådahl authored
      It should only be used when direct blitting is supported, so there is no
      reason we should have to deal with pipelines etc when blitting from the
      shadow buffer to the onscreen.
    • Jonas Ådahl's avatar
      renderer/native: Only enable shadowfbs if we can blit · 346caded
      Jonas Ådahl authored
      There is no point in enabling shadow buffers if we can't as that'd be
      even slower than not having them at all.
    • Jonas Ådahl's avatar
      cogl: Make private BLIT_FRAMEBUFFER feature public · f60c4851
      Jonas Ådahl authored
      Will be a requirement for enabling shadow buffers.
    • Jonas Ådahl's avatar
      clutter/stage-view: Change set_dirty..() API to invalidate..() · 19550c28
      Jonas Ådahl authored
      The manual "cleaning" of the viewport and projection state is removed,
      and we only ever try to invalidate the state so that it'll be updated
      next time. Change the API used to reflect this.
    • Jonas Ådahl's avatar
      clutter/stage-view: Move fb viewport and projection setting to here · c4949b55
      Jonas Ådahl authored
      The stage would fetch the front framebuffer and set the viewport and
      projection matrix, but if we are going to more than one front buffer,
      that won't work, so let the stage just pass the viewport and projection
      matrix to the view and have the view deal with the framebuffer(s).
    • Jonas Ådahl's avatar
      clutter/stage-view: Move shadowfb struct fields into anonymous struct · 675a2d13
      Jonas Ådahl authored
      With the aim to collect shadow buffer related things in one place, place
      them in an anonymous struct.
    • Jonas Ådahl's avatar
      renderer-native: Move shadow fb construction to the stage view · f4d9953b
      Jonas Ådahl authored
      The stage view will need a more involved approach to shadow buffers, in
      order to implement things such double buffered shadow buffers and damage
    • Jonas Ådahl's avatar
      clutter/stage-view: Add name property · 6db94a0b
      Jonas Ådahl authored
      Will be used for logging to identify what view a log entry concerns. For
      the native and nested backend this is the name of the output the CRTC is
      assigned to drive; for X11 it's just "X11 screen", and for the legacy
      "X11 screen" emulation mode of the nested backend it's called "legacy
    • Jonas Ådahl's avatar
      output: Add name getter · 9bf6faf6
      Jonas Ådahl authored
      This will return the name of the connector, e.g. DP-2.
    • Jonas Ådahl's avatar
      cogl/dma-buf-handle: Pass more metadata to handle constructor · 4434a17d
      Jonas Ådahl authored
      Could be useful would one want to mmap the dmabuf and deal with its
      content manually in CPU space.
    • verdre's avatar
      wayland/actor-surface: Don't notify geometry-changed on mapped changes · c65f63b6
      verdre authored
      There's no reason to notify the surface that its geometry changed when
      the visibility of the actor changes. This is only needed to update the
      outputs of the surface, so do that directly instead.
    • verdre's avatar
      wayland/actor-surface: Factor in mapped clones in mapped check · 79d981aa
      verdre authored
      We started listening to notify::mapped with commit
      5eb5f724 in order to emit
      wl_surface.leave events consistently when a surface gets hidden. This
      caused a problem with the ClutterClones used in the overview, since
      those temporarily map and unmap the windows for painting, spamming
      wl_surface.leave and enter events to all surfaces.
      We can easily fix that by also treating mapped clones as mapped, which
      means the surface should also be on a wl_output when the overview is
      Fixes #1141
    • verdre's avatar
      clutter/actor: Make has_mapped_clones() factor in parent actors · 2791f5b4
      verdre authored
      All existing users of clutter_actor_has_mapped_clones() actually want to
      know whether the actor is being cloned by a visible clone, it doesn't
      matter to them if that clone is attached to an actor somewhere else in
      the tree or to the actor itself.
      So make clutter_actor_has_mapped_clones() a bit more convenient to use
      and also check the clones of the parent-actors in that function.
    • verdre's avatar
      wayland/actor-surface: Don't listen to notify::position signal · e68bb27d
      verdre authored
      We started listening to "notify::position" on surface actors with commit
      08e4cb54. This commit was done to fix a regression from commit cf1edff9,
      which forgot to handle some cases like the actual WindowActor and not
      the SurfaceActor (which is a child of the WindowActor) moving (that was
      fixed by listening to MetaWindows "position-changed" signal). Also that
      commit introduced meta_wayland_surface_update_outputs_recursively(),
      which updates the outputs of all (sub-)surfaces in case any position
      changed and made sure subsurfaces also get their outputs updated in case
      the parent actor moved.
      Connecting to the "notify::position" signal, which the above commit also
      did is now superflous though because position changes will queue a
      relayout and the actors allocation will change during the next
      allocation cycle, notifying the "allocation" property which we also
      listen to.
      So save some resources and stop listening to that signal.
  3. 23 May, 2020 1 commit
    • verdre's avatar
      clutter/actor: Use priv->allocation instead of get_allocation_box() · e12b2c41
      verdre authored
      The comment in _clutter_actor_get_allocation_clip() explicitely notices
      that it doesn't need the behavior of doing an immediate relayout as
      clutter_actor_get_allocation_box() does. The comment is also still valid
      since the code calling _clutter_actor_get_allocation_clip() checks for
      priv->needs_allocation just before.
      So let's just use the allocation directly here instead of going through
      that function.
  4. 22 May, 2020 6 commits
    • Jonas Ådahl's avatar
      native: Return an error if no drm devices are found · 0fbda366
      Jonas Ådahl authored
      Without this, we'll end up segfaulting when trying to log the
      non-existing error.
    • Florian Müllner's avatar
      backend/xcursor: Support a "blank" cursor type · 106d332c
      Florian Müllner authored
      We don't have enough Xlib code in mutter ...
      Joking aside, it can be useful to make the cursor invisible
      without hiding it, for example for replacing the actual cursor
      with an actor in gnome-shell; the real cursor should still
      update the focus surface in that case, and not sneak into
      screenshots or -casts.
    • verdre's avatar
    • verdre's avatar
    • Jonas Ådahl's avatar
      screen-cast-src: Notify about the stream being closed after dispatch · c8e12ead
      Jonas Ådahl authored
      We're iterating inside the PipeWire loop when detecting PipeWire errors,
      and shouldn't destroy the PipeWire objects mid-iteration. Avoid this by
      first disabling the stream src (effectively stopping the recording),
      then notifying about it being closed in an idle callback. The
      notification eventually makes the rest of the screen cast code clean up
      the objects, including the src and the associated PipeWire objects, but
      will do so outside the PipeWire loop iteration.
      Closes: #1251
    • Jonas Ådahl's avatar
      stage-x11: Move view management to renderer · 8a541c08
      Jonas Ådahl authored
      In the native backend, the MetaRenderer manages the view by creating one
      per CRTC, but until now the MetaStageX11 managed the view for the X11
      backend. This caused some issues as it meant meta_renderer_get_views()
      not returning anything, and that the view of the X11 screen not being a
      MetaRendererView, while in the other backends, all views are.
      Fix this by moving the view management responsibility to
      MetaRendererX11Cm, and have MetaStageX11 only operate on it via
      meta_renderer_x11_cm_*() API. The MetaRendererX11Cm takes care of making
      sure the view is always added to the list in the renderer, and turning
      X11 screen sizes into "layouts" etc.