Re: Frame synchronization
Sam Varshavchik <[email protected]> Tue, 19 Feb 2019 07:16:44 -0500
| Newsgroups | gmane.comp.freedesktop.xcb |
|---|---|
| Message-ID | <[email protected]> |
VaL writes: > So let's figure out base sync flow: > > <- When _NET_WM_SYNC_REQUEST is sent, does it mean that the window is > already frozen? > <- XCB_CONFIGURE_NOTIFY sent with new geometry > <- XCB_EXPOSE to expose the window, and it is still frozen, right? > ... We do flush here and update content of the window > -> And send _NET_WM_SYNC_REQUEST_COUNTER back to the WM, and after this the > window _not_ frozen anymore? > > !!!... the problem here, when we do flushing/updating content right here, > the content of the window is jumping, and resizing is not smooth. > Looks like it has wrong/outdated geometry. Does the window have new geometry > or still resizing? _NET_WM_SYNC_REQUEST does not change the core X protocol. As always, ConfigureNotify indicates that the window was resized, and ExposeNotify indicates which parts of the window should be repainted. Your X client may receive ExposeNotify events with or without a preceding ConfigureNotify. Furthermore, as explained in the X protocol specification, there could be one or more ExposeNotify events. Additionally, the window gravity setting also controls which parts of the window are considered to be exposed after the window gets resized. That's the core X protocol behavior. _NET_WM_SYNC_REQUEST does not change that. The only thing that _NET_WM_SYNC_REQUEST brings to the table is that it is sent before the window manager resizes the window. Hence, the application receives it before it receives ConfigureNotify. Furthermore, the window manager will avoid resizing the window again until the application updates the timer, as specified by the synchronization protocol. Whether the application updates the timer before or after it receives an exposure event, or before or after it actually draws the window, it is immaterial as far as the synchronization protocol is concerned. As far as a window manager is concerned, it is waiting for the timer before it continues resizing the window. As a postscriptum, I found that XFCE's window manager sets a moderately short timeout waiting for the app to update the sync timer. About half a second in my estimation. If the application fails to update the timer, the window manager considers the application to be broken and will no longer send it sync request. > <- new _NET_WM_SYNC_REQUEST is sent, does it mean that the window is frozen > again after/before/same time the event is sent? > <- XCB_CONFIGURE_NOTIFY > <- XCB_EXPOSE > -> _NET_WM_SYNC_REQUEST_COUNTER is sent back Nothing is "frozen". There is no such thing as "frozen", here. > So the update of the window is requested after _NET_WM_SYNC_REQUEST_COUNTER > is sent and before new _NET_WM_SYNC_REQUEST is received. The window manager resizes the window after sending the sync request. End of story. The same thing is observed by the client. It receives a _NET_WM_SYNC_REQUEST, followed by ConfigureNotify, and/or any expose events that follow it. Whether or not, in actuality, the window manager resizes the window, in relativistic spacetime, before the client receives the synchronization request, is entirely up to the luck of the draw. It may or may not happen each individual time. Neither the window manager, nor the client, has any means of controlling it. Whether that happens, or not, depends entirely on external factors. Such as whether one or the other – the window manager, or the client – is running locally, or running in a tunneled X connection on the other side of the Earth, or a different planet altogether. All of these factors, and many others, will decide whether or not the window manager ends up actually resizing the window before or after the client receives the _NET_WM_SYNC_REQUEST message. > So the question is: > Is the actual window's geometry being changed strongly after > _NET_WM_SYNC_REQUEST_COUNTER is received by WM and strongly before > _NET_WM_SYNC_REQUEST is sent to the client? Neither. The WM reconfigures the window after it sends a _NET_WM_SYNC_REQUEST message to the client. The End. Furthermore, the WM does not "receive" something called "_NET_WM_SYNC_REQUEST_COUNTER", at any point. "_NET_WM_SYNC_REQUEST_COUNTER" is a property the client sets on its window. The window manager reads it, at some point. That's immaterial as far as the synchronization protocol is concerned. > Is extended frame sync protocol supposed to handle a case with sudden window > updates like this? The extended frame sync protocol is supposed to handle a more sophisticated situation, where the window manager redirects the actual X client window to an off-screen buffer, and this is the means of informing the window manager when it can compose the buffered contents of the window onto the real display. _______________________________________________ Xcb mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/xcb
signature.asc
(application/pgp-signature, 801 B)
-----BEGIN PGP SIGNATURE----- iQIcBAABAgAGBQJca/OsAAoJEGs6Yr4nnb8luLAP/0lxozM0ID5tKF+tobNzff/O tvWV201GW7/T3avEtkUSD2OZSkAOkClw1qAbghyPUXAYDtmQ4d8Eh+ZAi2hhK79s Rgtk/Sp18xrL0rGuKpfuls+w8g36JERCfZvEgeyfAkEZeXiFKQDHJmLxeDt4qexM kDajn9XqCKP1Dr/DYuwFwPX5f+eSVU7r/R/5GfnilY2S8hveMKoXtW0I3rG2XLAg RnJoy0MA13JsYdQwHYHA8QVzI3Qg+By9gvd1WL21J1kQu03HTYsFSjhgovwQcepe iW+QRbL/ge+QlaYbSBYaiPN3wINoaOzBqwktIKxUMuHl/Tdv3G0hf9+nflgzJwXU 9L/2n+p7pwooa1wThUuKcFx0E429bXbKX4e/y5zttmjXnQD55BctGCR0fYziar4L yM1fXJDrwGweof5DH35JEoZviQhkJ/+aOFQqJWzQRwtPUPAZR4sD6QOBVMzwky4i SU1y8G4QTlgOOa/MvggWFKzYutsyM+Y3975D/nb1jXHza1r5LMVpgdN4oj9s+xjf i0I17BUU0jVnIDQuC6AxxtLctt796HySbZjApi6gqUGIc3mSMBNeIVqAz7lyT+MM 3GUxmhV05RwMqUF0NTsjvY0aLko2OpFvieoX8bUjos5lusacCa69eYrZYZ/veJYK tAZKb4ugF9qFGUxOy/M4 =lY1A -----END PGP SIGNATURE-----