Undo wxGLCanvas::SwapBuffers() Wayland frame sync.

This reverts the frame synchronization logic that was recently added
with the purpose of avoiding performance issues due to `eglSwapBuffers`
blocking when the canvas is hidden or occluded.

This logic should be unnecessary after `eglSwapInterval(display, 0)`
is called, since `eglSwapBuffers` should never block anymore.
Furthermore, as it stands now, it causes the canvas to continuously
repaint itself at the refresh rate of the display, which is wasteful
for applications which do not need to continuously refresh.

See #24012, #24017.

(cherry picked from commit abfdd186ff540e62d18ef3e3d37ce2015843309a)
This commit is contained in:
Joan Bruguera Micó 2023-10-29 22:50:04 +00:00 committed by Vadim Zeitlin
parent 238dd2a8ea
commit 264c499375

View File

@ -843,21 +843,13 @@ bool wxGLCanvasEGL::SwapBuffers()
#ifdef GDK_WINDOWING_WAYLAND
if (wxGTKImpl::IsWayland(window))
{
// Under Wayland, we must not draw before we're actually ready to, as
// this would be inefficient at best and could result in a deadlock at
// worst if we're called before the window is realized.
// Under Wayland, we must not draw before the window has been realized,
// as this could result in a deadlock inside eglSwapBuffers()
if ( !m_readyToDraw )
{
wxLogTrace(TRACE_EGL, "Window %p is not not ready to draw yet", this);
return false;
}
// Ensure that we redraw again when the frame becomes ready.
m_readyToDraw = false;
wl_surface* surface = gdk_wayland_window_get_wl_surface(window);
m_wlFrameCallbackHandler = wl_surface_frame(surface);
wl_callback_add_listener(m_wlFrameCallbackHandler,
&wl_frame_listener, this);
}
#endif // GDK_WINDOWING_WAYLAND