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 754711 - tests: Don't rely on latency for actually showing Wayland windows
tests: Don't rely on latency for actually showing Wayland windows
Status: RESOLVED FIXED
Product: mutter
Classification: Core
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: mutter-maint
mutter-maint
Depends on:
Blocks:
 
 
Reported: 2015-09-08 08:11 UTC by Jonas Ådahl
Modified: 2015-12-23 07:32 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
tests: Don't rely on latency for actually showing Wayland windows (2.85 KB, patch)
2015-09-08 08:11 UTC, Jonas Ådahl
none Details | Review
tests: Don't rely on latency for actually showing Wayland windows (2.52 KB, patch)
2015-09-24 04:12 UTC, Jonas Ådahl
committed Details | Review

Description Jonas Ådahl 2015-09-08 08:11:32 UTC
The test runner sends a "show" command to the test clients and assumes
this was enough work done by the client to enable the compositor to map
the window. On Wayland this is not enough; the client also needs to
actually paint something for a window to be mappable.

So, to in order to continue relying on "show" to be enough to actually
show a window, let the test client wait until it has drawn the first
frame.

This makes the tests using Wayland clients test non-flaky.
Comment 1 Jonas Ådahl 2015-09-08 08:11:38 UTC
Created attachment 310875 [details] [review]
tests: Don't rely on latency for actually showing Wayland windows
Comment 2 Owen Taylor 2015-09-08 17:16:32 UTC
Review of attachment 310875 [details] [review]:

Thanks for the trying this out and tracking down the problem! Change:

 "On Wayland this is not enough; the client also needs to actually paint something for a window to be mappable."

To:

 "Now that we wait to show a Wayland window until the first buffer is attached (see bug 750552), we need to make sure that we attach a buffer before assuming that we have the final stacking order"

Otherwise it looks like I landed the tests without making sure that they work ;-) I'd also change the subject message to something to something like "tests: make sure that we attach buffers for Wayland windows"

In terms of the implementation, my first reaction to this was "no way - everything but 'wait' is async - the handling for this needs to be in 'wait'"

But we do have the idea that when you show a window, GTK+ is supposed to deterministically proceed on and paint the first frame (X11) / attach a buffer (Wayland) without waiting for any events back from the window system, so this could conceivably fit the idea that the commands are "async" - we're still not waiting for Mutter to do anything - we're just letting GTK+ get to the point where it will attach the buffer. So I'm OK with the patch, and an alternative would be considerably more complex.

::: src/tests/test-client.c
@@ +45,2 @@
 static void
+on_window_painted  (GdkFrameClock *clock, GdkWindow     *window)

a) parameter alignment.
b) the name looks like you've changed strategies? use on_after_paint as the name.

@@ +153,3 @@
+
+      /* When a Wayland client, we cannot be really sure that the window has
+       * been mappable until after we have painted. So, in order to have the

Is "mappable" a concept in Wayland? If not, I'd be more specific and say "Mutter will not show a Wayland window until we've painted and attached the first frame"

@@ +161,3 @@
+      g_signal_connect (frame_clock, "after-paint",
+                        G_CALLBACK (on_window_painted), gdk_window);
+      g_main_loop_run (loop);

I'd rather you just allocated a local loop here and passed that as the user data.
Comment 3 Jonas Ådahl 2015-09-24 04:12:06 UTC
Created attachment 311994 [details] [review]
tests: Don't rely on latency for actually showing Wayland windows

The test runner sends a "show" command to the test clients and assumes
this was enough work done by the client to enable the compositor to map
the window. Now that we wait to show a Wayland window until the first
buffer is attached (see bug 750552), we need to make sure that we attach
a buffer before assuming that we have the final stacking order.

So, to in order to continue relying on "show" to be enough to actually
show a window, let the test client wait until it has drawn the first
frame.

This makes the tests using Wayland clients test non-flaky.
Comment 4 Jonas Ådahl 2015-12-23 07:32:25 UTC
Attachment 311994 [details] pushed as 5054b2a - tests: Don't rely on latency for actually showing Wayland windows