Skip to content

Commit 264c499

Browse files
joanbmvadz
authored andcommitted
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 wxWidgets#24012, wxWidgets#24017. (cherry picked from commit abfdd18)
1 parent 238dd2a commit 264c499

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

src/unix/glegl.cpp

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -843,21 +843,13 @@ bool wxGLCanvasEGL::SwapBuffers()
843843
#ifdef GDK_WINDOWING_WAYLAND
844844
if (wxGTKImpl::IsWayland(window))
845845
{
846-
// Under Wayland, we must not draw before we're actually ready to, as
847-
// this would be inefficient at best and could result in a deadlock at
848-
// worst if we're called before the window is realized.
846+
// Under Wayland, we must not draw before the window has been realized,
847+
// as this could result in a deadlock inside eglSwapBuffers()
849848
if ( !m_readyToDraw )
850849
{
851850
wxLogTrace(TRACE_EGL, "Window %p is not not ready to draw yet", this);
852851
return false;
853852
}
854-
855-
// Ensure that we redraw again when the frame becomes ready.
856-
m_readyToDraw = false;
857-
wl_surface* surface = gdk_wayland_window_get_wl_surface(window);
858-
m_wlFrameCallbackHandler = wl_surface_frame(surface);
859-
wl_callback_add_listener(m_wlFrameCallbackHandler,
860-
&wl_frame_listener, this);
861853
}
862854
#endif // GDK_WINDOWING_WAYLAND
863855

0 commit comments

Comments
 (0)