On 2021-12-30 06:20, Michael Clark wrote: > Dear Mesa Developers, > > I have been using GLFW for tiny cross-platform OpenGL demos for some time but > something that has really been bothering me are the visual artifacts when > resizing windows. Over the last year or so I have made multiple attempts at > solving this issue, digging progressively deeper each time, until spending > the last month researching compositor synchronization protocols, reading > compositor code, and writing this demo as a prelude to figuring out how one > might fix this issue in GLFW or even Chrome. > > I decided that first it might be a good idea to come up with the simplest > possible isolated example comprising of a near complete solution without the > unnecessary complexity of layering for all of the cross-platform > abstractions. It seems to me despite the ease this can be solved with Wayland > EGL, it is still useful, primarily for wider compatibility, to be able to > package X11 GLX applications, which is the window system that I typically use > when targeting Linux with GLFW. > > That brings me to _glxsync_ which is an attempt at creating a minimally > correct implementation of explicit frame synchronization using X11, GLX, > XSync and the latest compositor synchronization protocols [1,2], tested to > work with mutter and GNOME on Xorg or Xwayland. > > - https://github.com/michaeljclark/glxsync/ > > _glxsync_ is an X Windows OpenGL demo app using GLX and XSync extended frame > synchronization responding to synchronization requests from the compositor in > response to configuration changes for window resizes. The demo updates > extended synchronization counters before and after frames to signal to the > compositor that rendering is in progress so that buffers read by the > compositor are complete and matches the size in configuration change events. > It also has rudimentary congestion control.
[...] > I have to say there were numerous subtle issues that I found while testing > this code on Ubuntu 21.10 XWayland with an Intel Mesa graphics stack and > Ubuntu 20.04 LTS Xorg with the NVIDIA proprietary graphics stack, so I have > no idea how it will fly with other drivers and am very interested in > feedback. There really is not much sample code that I could find that > addresses this issue. [...] > Is there a place in mesa-demos for a frame synchronization demo? I see > glsync. Is there a compositor sync example that I may have missed? I can > imagine with the addition of WM_MOVERESIZE it could be used for tests. This > is pretty much version 0.0.1. i.e. is clean enough to release. FWIW, GTK4 seems to do a pretty decent job of this (based on casual experimentation with GDK_BACKEND=x11 gtk4-demo i.e. not any kind of scientific investigation). -- Earthling Michel Dänzer | https://redhat.com Libre software enthusiast | Mesa and Xwayland developer