xwayland: Add xwl_present_unrealize_window

When a window is unrealized, a pending frame callback may never be
called, which could result in repeatedly freezing until the frame timer
fires after a second.

Fixes these symptoms when switching from fullscreen to windowed mode in
sauerbraten.
This commit is contained in:
Michel Dänzer 2018-11-01 18:24:28 +01:00 committed by Adam Jackson
parent 6b016d58d2
commit 8c9538573c
3 changed files with 22 additions and 0 deletions

View File

@ -524,6 +524,22 @@ xwl_present_flips_stop(WindowPtr window)
xwl_present_reset_timer(xwl_present_window);
}
void
xwl_present_unrealize_window(WindowPtr window)
{
struct xwl_present_window *xwl_present_window = xwl_present_window_priv(window);
if (!xwl_present_window || !xwl_present_window->frame_callback)
return;
/* The pending frame callback may never be called, so drop it and shorten
* the frame timer interval.
*/
wl_callback_destroy(xwl_present_window->frame_callback);
xwl_present_window->frame_callback = NULL;
xwl_present_reset_timer(xwl_present_window);
}
static present_wnmd_info_rec xwl_present_info = {
.version = PRESENT_SCREEN_INFO_VERSION,
.get_crtc = xwl_present_get_crtc,

View File

@ -616,6 +616,11 @@ xwl_unrealize_window(WindowPtr window)
xwl_screen->UnrealizeWindow = screen->UnrealizeWindow;
screen->UnrealizeWindow = xwl_unrealize_window;
#ifdef GLAMOR_HAS_GBM
if (xwl_screen->present)
xwl_present_unrealize_window(window);
#endif
xwl_window = xwl_window_get(window);
if (!xwl_window)
return ret;

View File

@ -451,6 +451,7 @@ void xwl_glamor_egl_make_current(struct xwl_screen *xwl_screen);
#ifdef GLAMOR_HAS_GBM
Bool xwl_present_init(ScreenPtr screen);
void xwl_present_cleanup(WindowPtr window);
void xwl_present_unrealize_window(WindowPtr window);
#endif /* GLAMOR_HAS_GBM */
#ifdef XV