x11: Handle window getting unmapped while frame still pending

Since commit 972134ab we now call
glClientWaitSync for the vendor nvidia driver, to know when a frame
is ready for the compositor to process.

If a surface is hidden while a frame is still being rendered by the GPU,
the surface will never produce the damage event the code relies on to
trigger the call to glClientWaitSync. This leaves the fence dangling,
and the next time the surface is shown, it will start a fresh frame
and blow an assertion since the fence from the last frame is still
hanging around.

This commit ensures a frame gets fully wrapped up before hiding a
surface.

Fixes: #2902
9 jobs for wip/on-the-surface-good-fences-can-make-bad-neighbors in 26 minutes and 3 seconds (queued for 1 second)
Status Job ID Name Coverage
  .Pre
failed #789321
allowed to fail
style-check-diff

00:00:36

 
  Build
failed #789322
fedora-x86_64

00:25:27

passed #789324
win32-ps
msys2-mingw64

00:03:00

passed #789323
release-build

00:09:00

 
  Analysis
skipped #789325
allowed to fail
static-scan
 
  Docs
skipped #789326
reference
 
  Flatpak
skipped #789327
flatpak allowed to fail manual
flatpak-manual:demo
skipped #789329
flatpak allowed to fail manual
flatpak-manual:icon-browser
skipped #789328
flatpak allowed to fail manual
flatpak-manual:widget-factory
 
Name Stage Failure
failed
fedora-x86_64 Build
/builds/GNOME/gtk/_build/testsuite/gsk/compare/*/*/*.png: found 98 matching files 
WARNING: /builds/GNOME/gtk/_build/testsuite/css/output/*/*.syscap: no matching files
Uploading artifacts to coordinator... ok
id=789322 responseStatus=201 Created token=8UuCBo1i
Uploading artifacts...
/builds/GNOME/gtk/_build/report-x11.xml: found 1 matching files

WARNING: /builds/GNOME/gtk/_build/report-wayland.xml: no matching files
WARNING: /builds/GNOME/gtk/_build/report-broadway.xml: no matching files
Uploading artifacts to coordinator... ok
id=789322 responseStatus=201 Created token=8UuCBo1i
ERROR: Job failed: exit code 1
failed
style-check-diff .Pre
                                    context,
G_CONNECT_SWAPPED);
-
}
}
#endif
Running after_script
Uploading artifacts for failed job
ERROR: Job failed: exit code 1