Re: Frame synchronization
Sam Varshavchik <[email protected]> Wed, 20 Feb 2019 07:04:50 -0500
| Newsgroups | gmane.comp.freedesktop.xcb |
|---|---|
| Message-ID | <[email protected]> |
VaL writes: > If there is no any more resizing, > you increment the counter, render your frame, increment again and wait for > _NET_WM_FRAME_DRAWN, > but it is not sent, there is no more _NET_WM_FRAME_DRAWN events? As best as I can understand the extended synchronization protocol: you're getting _NET_WM_FRAME_DRAWN in response to you incrementing the counter to indicate a drawn frame. You expect to get it in response to every drawn frame, and this is independent of whether or not the window is being resized; and you have to wait until you get the message before you increment the counter indicating that you're drawing the next frame. The whole purpose of the previous counter's update was to tell the window manager to proceed and compose your finished frame, and you won't touch the frame buffer until that's done. You're waiting until that's done, and you get a _NET_WM_FRAME_DRAWN, then you can draw the next frame. When _NET_WM_SYNC_REQUEST enters the picture, it tells you the specific counter value you must set after you receive configure and exposure events that you have coming, and, presumably, after drawing the frame using the new window configuration. You may get a _NET_WM_SYNC_REQUEST before or after getting the last frame's _NET_WM_FRAME_DRAWN. Clearly you can get it after. You drew the last frame, and got it's _NET_WM_FRAME_DRAWN. There is no law that requires you to draw the next frame immediately. You might decide to take a coffee break and not draw anything. Thirty seconds later your window's getting resized, so you get a _NET_WM_SYNC_REQUEST out of the blue. But you can also get it before as well. 30 second later you finished your coffee break you decide to draw the next frame, so you inrement the counter and start drawing. At the same time the window manager decides to resize your window. It hasn't seen your new counter update, yet, and sends you _NET_WM_SYNC_REQUEST, and all messages cross each other on the way. So now you end up getting a _NET_WM_SYNC_REQUEST probably even before you finish drawing your next frame, before noticing it. > I've tried to stop updating the window if a resizing is started (received > sync counter), and continue the updates when _no_ new sync request counters > are received within 30ms (configurable). I don't think that's necessary. _NET_WM_FRAME_DRAWN contains a counter that specifies the exact counter update it's in response to. If it's always checked, and ignored unless it matches your last counter update, this logic is unambiguous. Upon receipt of a _NET_WM_SYNC_REQUEST you can do whatever you want to do, as long as you end up setting the counter to acknowledge the requested value in _NET_WM_SYNC_REQUEST. Whether you actually drew a frame, or wait to see if another _NET_WM_SYNC_REQUEST arrives quickly, that's your business, but if you actually decide to draw a frame, you have to wait until the new frame's counter is acked by a _NET_WM_FRAME_DRAWN, ignoring any others referencing previous frames. _______________________________________________ Xcb mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/xcb
signature.asc
(application/pgp-signature, 801 B)
-----BEGIN PGP SIGNATURE----- iQIcBAABAgAGBQJcbUJiAAoJEGs6Yr4nnb8lz8oP/3g6seVeRNb6wof12EPaxpz7 8dXKd69XQKj41vlhPjrqnlm8BSZDReI+gc98K1/UhyC7FORBCbeJlj0ecf/Q3pIH Lq7YiweCYlQ6X1+Oj9fb7WBMeDxBtXzO6eDCAB0knA39pflRDfAasYakIwk+5aZ5 VtnQbCE/2uXyHCqxMMBGnfdqdhtKH+CR2pTl96JTvQTl4zUOwH3Za6KFRgfznjm1 YInf6OUvxytDhtXl59FGzhzjJZH569rIiJjlzJyMbR9dVkr/eYPJ/OAr6ew5v79/ FhwFw/MZdv31vnsqrLOHt30y6CDRTEy27OE3iGh+hvhvZoYjPohuBnFzAE09nfvA VttOoFmsYEKWnPsLihqxtw8f21y21nwDrDZNbnZXM7CfLlc76UzMalNv6r/mEdSv JvtHBJ0ax1wjbilR2wFytvfU2kSdW+QvtLLoYC/rbGrVUnFXiqcOrVbs2BG4Be2t AZ1NawdYusWL47/tM9XUx1V4mvog86aEmJEvp6E+SNEskgHbMqx0rCsjUhkFkEGl emNFlnqe4smEEWzystXm/jvYABmHRxmIExL+TGhI+jAPVWGCwGn3GxQWkT8q4SQT Z8FatQ0rV1S2wvy3h88F//QlmiunnLHaiGfuYDcLaMqnNNAVcku+M17uUyBNh2Dd 8SHbUnqY+x+/TeDUnKRI =zQsy -----END PGP SIGNATURE-----