<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/mutter.git/clutter, branch dcvviewer</title>
<subtitle>gitlab.gnome.org: GNOME/mutter.git
</subtitle>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/mutter.git/'/>
<entry>
<title>clutter/stage-cogl: Reschedule update on present</title>
<updated>2019-05-21T16:23:49+00:00</updated>
<author>
<name>Daniel van Vugt</name>
<email>daniel.van.vugt@canonical.com</email>
</author>
<published>2018-10-29T11:05:46+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/mutter.git/commit/?id=4faeb12731b81ce617042973155cc4b5737e1133'/>
<id>4faeb12731b81ce617042973155cc4b5737e1133</id>
<content type='text'>
If an update (new frame) had been scheduled already before
`_clutter_stage_cogl_presented` was called then that means it was
scheduled for the wrong time. Because the `last_presentation_time` has
changed since then. And using an `update_time` based on an outdated
presentation time results in scheduling frames too early, filling the
buffer queue (triple buffering or worse) and high visual latency.

So if we do receive a presentation event when an update is already
scheduled, remember to reschedule the update based on the newer
`last_presentation_time`. This way we avoid overfilling the buffer queue
and limit ourselves to double buffering for less visible lag.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/334

Prerequisite: https://gitlab.gnome.org/GNOME/mutter/merge_requests/520

https://gitlab.gnome.org/GNOME/mutter/merge_requests/281
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If an update (new frame) had been scheduled already before
`_clutter_stage_cogl_presented` was called then that means it was
scheduled for the wrong time. Because the `last_presentation_time` has
changed since then. And using an `update_time` based on an outdated
presentation time results in scheduling frames too early, filling the
buffer queue (triple buffering or worse) and high visual latency.

So if we do receive a presentation event when an update is already
scheduled, remember to reschedule the update based on the newer
`last_presentation_time`. This way we avoid overfilling the buffer queue
and limit ourselves to double buffering for less visible lag.

Closes: https://gitlab.gnome.org/GNOME/mutter/issues/334

Prerequisite: https://gitlab.gnome.org/GNOME/mutter/merge_requests/520

https://gitlab.gnome.org/GNOME/mutter/merge_requests/281
</pre>
</div>
</content>
</entry>
<entry>
<title>clutter/stage-cogl: Damage fb using ceiled scaled sizes</title>
<updated>2019-05-21T08:50:09+00:00</updated>
<author>
<name>Marco Trevisan (Treviño)</name>
<email>mail@3v1n0.net</email>
</author>
<published>2019-03-05T19:05:42+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/mutter.git/commit/?id=02812fb9887f8dadfb5e6c7d05b525ea1309f4e0'/>
<id>02812fb9887f8dadfb5e6c7d05b525ea1309f4e0</id>
<content type='text'>
https://gitlab.gnome.org/GNOME/mutter/merge_requests/469
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
https://gitlab.gnome.org/GNOME/mutter/merge_requests/469
</pre>
</div>
</content>
</entry>
<entry>
<title>clutter/util: Fix styling on functions definitions</title>
<updated>2019-05-21T08:50:09+00:00</updated>
<author>
<name>Marco Trevisan (Treviño)</name>
<email>mail@3v1n0.net</email>
</author>
<published>2019-03-01T19:50:49+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/mutter.git/commit/?id=29211c902017fa8682bc5559d2e50420cfa6a1a7'/>
<id>29211c902017fa8682bc5559d2e50420cfa6a1a7</id>
<content type='text'>
https://gitlab.gnome.org/GNOME/mutter/merge_requests/469
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
https://gitlab.gnome.org/GNOME/mutter/merge_requests/469
</pre>
</div>
</content>
</entry>
<entry>
<title>clutter: Add fribidi dependency and copy deprecated pango functions</title>
<updated>2019-05-17T23:11:43+00:00</updated>
<author>
<name>Marco Trevisan (Treviño)</name>
<email>mail@3v1n0.net</email>
</author>
<published>2019-05-17T23:11:43+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/mutter.git/commit/?id=7a6c7558337c3e24b09bfb3b93a3a7d314c3748b'/>
<id>7a6c7558337c3e24b09bfb3b93a3a7d314c3748b</id>
<content type='text'>
Pango functions pango_unichar_direction() and pango_find_base_dir() have been
deprecated in pango 1.44, since these are used mostly clutter and gtk, copy the
code from pango and use fribidi dependency explicitly.

This is the same strategy used by Gtk.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/583
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Pango functions pango_unichar_direction() and pango_find_base_dir() have been
deprecated in pango 1.44, since these are used mostly clutter and gtk, copy the
code from pango and use fribidi dependency explicitly.

This is the same strategy used by Gtk.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/583
</pre>
</div>
</content>
</entry>
<entry>
<title>clutter/stage-cogl: Don't skip over the next frame</title>
<updated>2019-05-16T22:13:54+00:00</updated>
<author>
<name>Daniel van Vugt</name>
<email>daniel.van.vugt@canonical.com</email>
</author>
<published>2018-11-02T07:47:58+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/mutter.git/commit/?id=45244852acc214a7a9d01dc96896ad0c079b437c'/>
<id>45244852acc214a7a9d01dc96896ad0c079b437c</id>
<content type='text'>
The `last_presentation_time` is usually a little in the past (although
sometimes in the future depending on the driver). When it's over 2ms
(`sync_delay`) in the past that would trigger the while loop to count up so
that the next `update_time` is in the future.

The problem with that is for common values of `last_presentation_time`
which are only a few milliseconds ago, incrementing `update_time` by
`refresh_interval` also means counting past the next physical frame that
we haven't rendered yet. And so mutter would skip that frame.

**Example**

Given:
```
  last_presentation_time = now - 3ms
  sync_delay = 2ms
  refresh_interval = 16ms
  next_presentation_time = last_presentation_time + refresh_interval
                         = now + 13ms

          -3ms now        +13ms           +29ms           +45ms
        ----|--+------------|---------------|---------------|----
            :               :
  last_presentation_time  next_presentation_time
```

Old algorithm:
```
  update_time = last_presentation_time + sync_delay
              = now - 1ms
  while (update_time &lt; now)
        (now - 1ms   &lt; now)
    update_time = now - 1ms + 16ms
  update_time = now + 15ms
  next_presentation_time = now + 13ms
  available_render_time = next_presentation_time - max(now, update_time)
                        = (now + 13ms) - (now + 15ms)
                        = -2ms  so the next frame will be skipped.

          -3ms now        +13ms           +29ms           +45ms
        ----|--+------------|-+-------------|---------------|----
            :               : :
            :               : update_time (too late)
            :               :
  last_presentation_time  next_presentation_time (a missed frame)

```

New algorithm:
```
  min_render_time_allowed = refresh_interval / 2
                          = 8ms
  max_render_time_allowed = refresh_interval - sync_delay
                          = 14ms
  target_presentation_time = last_presentation_time + refresh_interval
                           = now - 3ms + 16ms
                           = now + 13ms
  while (target_presentation_time - min_render_time_allowed &lt; now)
        (now + 13ms - 8ms &lt; now)
        (5ms &lt; 0ms)
    # loop is never entered
  update_time = target_presentation_time - max_render_time_allowed
              = now + 13ms - 14ms
              = now - 1ms
  next_presentation_time = now + 13ms
  available_render_time = next_presentation_time - max(now, update_time)
                        = (now + 13ms) - now
                        = 13ms  which is plenty of render time.

          -3ms now        +13ms           +29ms           +45ms
        ----|-++------------|---------------|---------------|----
            : :             :
            : update_time   :
            :               :
  last_presentation_time  next_presentation_time
```

The reason nobody noticed these missed frames very often was because
mutter has some accidental workarounds built-in:

 * Prior to 3.32, the offending code was only reachable in Xorg sessions.
   It was never reached in Wayland sessions because it hadn't been
   implemented yet (till e9e4b2b72).

 * Even though Wayland support is now implemented the native backend
   provides a `last_presentation_time` much faster than Xorg sessions
   (being in the same process) and so is less likely to spuriously enter
   the while loop to miss a frame.

 * For Xorg sessions we are accidentally triple buffering (#334). This
   is a good way to avoid the missed frames, but is also an accident.

 * `sync_delay` is presently just high enough (2ms by coincidence is very
   close to common values of `now - last_presentation_time`) to push the
   `update_time` into the future in some cases, which avoids entering the
   while loop. This is why the same missed frames problem was also noticed
   when experimenting with `sync_delay = 0`.

v2: adjust variable names and code style.

Fixes: https://bugzilla.gnome.org/show_bug.cgi?id=789186
       and most of https://gitlab.gnome.org/GNOME/mutter/issues/571

https://gitlab.gnome.org/GNOME/mutter/merge_requests/520
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The `last_presentation_time` is usually a little in the past (although
sometimes in the future depending on the driver). When it's over 2ms
(`sync_delay`) in the past that would trigger the while loop to count up so
that the next `update_time` is in the future.

The problem with that is for common values of `last_presentation_time`
which are only a few milliseconds ago, incrementing `update_time` by
`refresh_interval` also means counting past the next physical frame that
we haven't rendered yet. And so mutter would skip that frame.

**Example**

Given:
```
  last_presentation_time = now - 3ms
  sync_delay = 2ms
  refresh_interval = 16ms
  next_presentation_time = last_presentation_time + refresh_interval
                         = now + 13ms

          -3ms now        +13ms           +29ms           +45ms
        ----|--+------------|---------------|---------------|----
            :               :
  last_presentation_time  next_presentation_time
```

Old algorithm:
```
  update_time = last_presentation_time + sync_delay
              = now - 1ms
  while (update_time &lt; now)
        (now - 1ms   &lt; now)
    update_time = now - 1ms + 16ms
  update_time = now + 15ms
  next_presentation_time = now + 13ms
  available_render_time = next_presentation_time - max(now, update_time)
                        = (now + 13ms) - (now + 15ms)
                        = -2ms  so the next frame will be skipped.

          -3ms now        +13ms           +29ms           +45ms
        ----|--+------------|-+-------------|---------------|----
            :               : :
            :               : update_time (too late)
            :               :
  last_presentation_time  next_presentation_time (a missed frame)

```

New algorithm:
```
  min_render_time_allowed = refresh_interval / 2
                          = 8ms
  max_render_time_allowed = refresh_interval - sync_delay
                          = 14ms
  target_presentation_time = last_presentation_time + refresh_interval
                           = now - 3ms + 16ms
                           = now + 13ms
  while (target_presentation_time - min_render_time_allowed &lt; now)
        (now + 13ms - 8ms &lt; now)
        (5ms &lt; 0ms)
    # loop is never entered
  update_time = target_presentation_time - max_render_time_allowed
              = now + 13ms - 14ms
              = now - 1ms
  next_presentation_time = now + 13ms
  available_render_time = next_presentation_time - max(now, update_time)
                        = (now + 13ms) - now
                        = 13ms  which is plenty of render time.

          -3ms now        +13ms           +29ms           +45ms
        ----|-++------------|---------------|---------------|----
            : :             :
            : update_time   :
            :               :
  last_presentation_time  next_presentation_time
```

The reason nobody noticed these missed frames very often was because
mutter has some accidental workarounds built-in:

 * Prior to 3.32, the offending code was only reachable in Xorg sessions.
   It was never reached in Wayland sessions because it hadn't been
   implemented yet (till e9e4b2b72).

 * Even though Wayland support is now implemented the native backend
   provides a `last_presentation_time` much faster than Xorg sessions
   (being in the same process) and so is less likely to spuriously enter
   the while loop to miss a frame.

 * For Xorg sessions we are accidentally triple buffering (#334). This
   is a good way to avoid the missed frames, but is also an accident.

 * `sync_delay` is presently just high enough (2ms by coincidence is very
   close to common values of `now - last_presentation_time`) to push the
   `update_time` into the future in some cases, which avoids entering the
   while loop. This is why the same missed frames problem was also noticed
   when experimenting with `sync_delay = 0`.

v2: adjust variable names and code style.

Fixes: https://bugzilla.gnome.org/show_bug.cgi?id=789186
       and most of https://gitlab.gnome.org/GNOME/mutter/issues/571

https://gitlab.gnome.org/GNOME/mutter/merge_requests/520
</pre>
</div>
</content>
</entry>
<entry>
<title>clutter/actor: Fix a wrong comment</title>
<updated>2019-05-15T20:38:28+00:00</updated>
<author>
<name>Jonas Dreßler</name>
<email>verdre@v0yd.nl</email>
</author>
<published>2019-02-04T20:15:35+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/mutter.git/commit/?id=a48b6cc9ca9a17e99a677be09f642440649767c5'/>
<id>a48b6cc9ca9a17e99a677be09f642440649767c5</id>
<content type='text'>
https://gitlab.gnome.org/GNOME/mutter/merge_requests/547
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
https://gitlab.gnome.org/GNOME/mutter/merge_requests/547
</pre>
</div>
</content>
</entry>
<entry>
<title>clutter/input-device: Replace device check with assertion</title>
<updated>2019-05-15T20:38:28+00:00</updated>
<author>
<name>Jonas Dreßler</name>
<email>verdre@v0yd.nl</email>
</author>
<published>2019-02-04T21:22:48+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/mutter.git/commit/?id=786305f7d687c4523504f98b2e60c8d90c1e7920'/>
<id>786305f7d687c4523504f98b2e60c8d90c1e7920</id>
<content type='text'>
We only call _clutter_input_device_update with devices that are not
Keyboard devices. Also passing a Keyboard device to a function whose
primary purpose is picking should be considered a bug in the caller.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/547
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We only call _clutter_input_device_update with devices that are not
Keyboard devices. Also passing a Keyboard device to a function whose
primary purpose is picking should be considered a bug in the caller.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/547
</pre>
</div>
</content>
</entry>
<entry>
<title>clutter/stage-cogl: Fix a comment-typo</title>
<updated>2019-05-15T20:38:28+00:00</updated>
<author>
<name>Jonas Dreßler</name>
<email>verdre@v0yd.nl</email>
</author>
<published>2019-04-19T10:55:15+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/mutter.git/commit/?id=30a2483e6e5e8170569bf48ea46b1452d7110b94'/>
<id>30a2483e6e5e8170569bf48ea46b1452d7110b94</id>
<content type='text'>
https://gitlab.gnome.org/GNOME/mutter/merge_requests/547
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
https://gitlab.gnome.org/GNOME/mutter/merge_requests/547
</pre>
</div>
</content>
</entry>
<entry>
<title>clutter/stage: Move a comment to a more appropriate place</title>
<updated>2019-05-15T20:38:28+00:00</updated>
<author>
<name>Jonas Dreßler</name>
<email>verdre@v0yd.nl</email>
</author>
<published>2019-04-19T10:54:38+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/mutter.git/commit/?id=f5f0aa1023c6f1d21ec1d568c53ea1c969c8a5cd'/>
<id>f5f0aa1023c6f1d21ec1d568c53ea1c969c8a5cd</id>
<content type='text'>
https://gitlab.gnome.org/GNOME/mutter/merge_requests/547
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
https://gitlab.gnome.org/GNOME/mutter/merge_requests/547
</pre>
</div>
</content>
</entry>
<entry>
<title>clutter/stage: Avoid unnecessary call to add_redraw_clip</title>
<updated>2019-05-15T20:38:28+00:00</updated>
<author>
<name>Jonas Dreßler</name>
<email>verdre@v0yd.nl</email>
</author>
<published>2019-04-19T10:48:40+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/mutter.git/commit/?id=b86fba2f3c08223614d6025acd98261d42f00eb4'/>
<id>b86fba2f3c08223614d6025acd98261d42f00eb4</id>
<content type='text'>
We're bailing out of clutter_stage_cogl_add_redraw_clip() early without
doing anything if we're ignoring redraw clips, so no need to call it if
we already know that will be the case.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/547
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We're bailing out of clutter_stage_cogl_add_redraw_clip() early without
doing anything if we're ignoring redraw clips, so no need to call it if
we already know that will be the case.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/547
</pre>
</div>
</content>
</entry>
</feed>
