On Wed Jun 7 20:54:07 2023 +0000, Rémi Bernon wrote:
I don't know how critical this is, but FWIW waiting on condition variables is currently unstable in Wine, and you might end up with crashes that are difficult to debug. If possible, I think you should avoid it. Also, as a general rule from winex11, I believe we try as much as possible to avoid blocking the threads. So it would be great if this could be asynchronous and decoupled from the configure event handler.
Background: We are strictly not allowed to commit a buffer to a `wl_surface` with the `xdg_surface` role before we ack the first configure event (see [protocol text](https://gitlab.freedesktop.org/wayland/wayland-protocols/-/blob/bbe9298e8522...)). Failing to adhere to this requirement will get our client disconnected by the compositor with a [protocol error](https://gitlab.freedesktop.org/wayland/wayland-protocols/-/blob/bbe9298e8522...).
I have an alternative solution that doesn't block waiting for this initial event to arrive. The trade-off is that until that event arrives we must effectively ignore any flushes to `window_surface` (or any other operations that may commit buffers). Of course, when the initial event arrives we can trigger a flush, to ensure the on-screen output is synchronized with window contents, but we may have skipped some frames in the meantime. The initial configure event typically arrives quickly, so in most cases such asynchronous handling is not a concern at all.
Please me know if you think this trade-off is acceptable, and I can update the code accordingly.