After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 743617 - wayland: Commit cached surface state when subsurface goes desynchronized
wayland: Commit cached surface state when subsurface goes desynchronized
Status: RESOLVED FIXED
Product: mutter
Classification: Core
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: mutter-maint
mutter-maint
Depends on:
Blocks: 745655
 
 
Reported: 2015-01-28 04:32 UTC by Jonas Ådahl
Modified: 2015-04-10 01:16 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
wayland: Commit cached surface state when subsurface goes desynchronized (3.27 KB, patch)
2015-01-28 04:32 UTC, Jonas Ådahl
rejected Details | Review
wayland: Apply cached surface state when subsurface goes desynchronized (4.47 KB, patch)
2015-01-29 08:01 UTC, Jonas Ådahl
rejected Details | Review
wayland: Rework synchronized state application semantics (8.66 KB, patch)
2015-03-05 01:05 UTC, Jonas Ådahl
committed Details | Review

Description Jonas Ådahl 2015-01-28 04:32:28 UTC
When a surface goes desynchronized after having been in synchronized
mode, it should apply the cached state as if it was committed as long as
it is not still effectively synchronized. A surface may still be
effectively synchronized even when its subsurface is set to be
desynchronized if its parent surface is a subsurface that is effectivey
synchronized. See is_surface_effctively_synchronized().
Comment 1 Jonas Ådahl 2015-01-28 04:32:38 UTC
Created attachment 295608 [details] [review]
wayland: Commit cached surface state when subsurface goes desynchronized
Comment 2 Jasper St. Pierre (not reading bugmail) 2015-01-28 05:01:15 UTC
Review of attachment 295608 [details] [review]:

What's the rationale for this? What bug does it fix?
Comment 3 Jonas Ådahl 2015-01-28 05:27:16 UTC
It made the weston subsurface work for me.
Comment 4 Jasper St. Pierre (not reading bugmail) 2015-01-28 06:35:28 UTC
It's more complicated than that. I'm of the opinion that the subsurfaces test is broken and violates the spec, but talk to pq about that.

Thanks for the bug report. This particular bug has already been reported into our bug tracking system, but please feel free to report any further bugs you find.

*** This bug has been marked as a duplicate of bug 731494 ***
Comment 5 Jonas Ådahl 2015-01-28 06:51:15 UTC
That is another issue, this had nothing to do with positioning. The issue was that because set_desync didn't cause the content to be drawn, it didn't receive a frame callback, and thus didn't continue drawing.
Comment 6 Jonas Ådahl 2015-01-28 09:00:45 UTC
Unresolving as the bug it was marked as a duplicate of is related to when set_position takes effect; this is about that we didn't comply with the paragraph

"If a surface's parent surface behaves as desynchronized, then
the cached state is applied on set_desync"

in wl_subsurface.set_desync.
Comment 7 Jasper St. Pierre (not reading bugmail) 2015-01-28 17:05:55 UTC
What's wrong with these two lines?

   if (surface->sub.synchronous)
     subsurface_parent_surface_committed (surface);

Shouldn't that make it implement the spec'd behavior?
Comment 8 Jonas Ådahl 2015-01-29 00:09:37 UTC
subsurface_parent_surface_committed would call:

    commit_pending_state (surface, &surface->sub.pending);

which would then enter the block

  if (surface->sub.synchronous)
    {
      move_pending_state (pending, &surface->sub.pending);
      return;
    }

Here we'd move the subsurface->sub.pending to pending, which is subsurface->sub.pending, and obviously that makes no sense.

We'd also apply the pending position state even though, but as the spec dictates; from wl_subsurface.set_position:

	The next wl_surface.commit on the parent surface will reset
	the sub-surface's position to the scheduled coordinates.

meaning set_desync should not apply the positions.

This change would however mean that parent_surface_committed would be called for all the subsurfaces lower in the tree, which is a side effect of this change which probably is not what is supposed to happen.
Comment 9 Jonas Ådahl 2015-01-29 08:01:20 UTC
Created attachment 295726 [details] [review]
wayland: Apply cached surface state when subsurface goes desynchronized

When a surface goes desynchronized after having been in synchronized
mode, it should apply the cached state as if it was committed as long as
it is not still effectively synchronized. A surface may still be
effectively synchronized even when its subsurface is set to be
desynchronized if its parent surface is a subsurface that is effectivey
synchronized. See is_surface_effctively_synchronized().
Comment 10 Jonas Ådahl 2015-01-29 08:02:18 UTC
The above attached patch keeps the old semantics regarding positioning, but fixes the sync -> desync path.
Comment 11 Jonas Ådahl 2015-03-05 01:05:31 UTC
Created attachment 298594 [details] [review]
wayland: Rework synchronized state application semantics

When a parent of a subsurface gets it state applied (either by a
wl_surface.commit, wl_subsurface.set_desync or a recursive
wl_surface.commit on a parent surface), the pending position state
of the subsurface should be applied. If the subsurface is in effective
synchronized mode (i.e. if its in explicit synchronized mode or any of
its parent surfaces is a subsurface in explicit synchronized mode), the
cached state should also be applied at this point, including its
subsurface children, recursively.
Comment 12 Jonas Ådahl 2015-03-05 01:09:03 UTC
The latest patch updates mutter to be compliant according to the clarifications done as part of https://bugs.freedesktop.org/show_bug.cgi?id=88857 . It also fixes bug 731494.
Comment 13 Owen Taylor 2015-04-09 18:41:27 UTC
Review of attachment 298594 [details] [review]:

Looks to properly implement the current spec. Few minor notes, as far as I'm concerned can be committed once these are fixed.

::: src/wayland/meta-wayland-surface.c
@@ +361,3 @@
+ * synchronized or itself is in synchronized mode. */
+static gboolean
+is_surface_effctively_synchronized (MetaWaylandSurface *surface)

should be "effectively"

@@ +507,3 @@
+   * cache the pending surface state until either one of the following two
+   * scenarios happens:
+   *  1) Its parent surface gets it state applied.

gets _its_ state applied

@@ +515,3 @@
+      move_pending_state (&surface->pending, &surface->sub.pending);
+    }
+  else

Style is no braces when all branches are single line
Comment 14 Jonas Ådahl 2015-04-10 01:16:42 UTC
Pushed with the raised issues addressed. Thanks for the review.

Attachment 298594 [details] pushed as 868e142 - wayland: Rework synchronized state application semantics