When a flip event is received the associated resources are transferred from the vblank data, which gets destroyed, to the screen private data. Usually, the resources would be cleaned up when a new flip event is received or an unflip is completed.
In the case of normal client termination it's expected that an unflip will be performed. However, if the client terminates abnormally it's possible that this will not happen meaning some of the resources are leaked. This is avoided by cleaning up these resources at window destruction time. Signed-off-by: Frank Binns <[email protected]> --- present/present.c | 14 +------------- present/present_priv.h | 2 +- present/present_screen.c | 7 ++++--- 3 files changed, 6 insertions(+), 17 deletions(-) diff --git a/present/present.c b/present/present.c index dbd60cc..a717d0d 100644 --- a/present/present.c +++ b/present/present.c @@ -293,7 +293,7 @@ present_window_to_crtc_msc(WindowPtr window, RRCrtcPtr crtc, uint64_t window_msc return window_msc + window_priv->msc_offset; } -static void +void present_flip_idle(ScreenPtr screen) { present_screen_priv_ptr screen_priv = present_screen_priv(screen); @@ -878,18 +878,6 @@ present_notify_msc(WindowPtr window, } void -present_flip_destroy(ScreenPtr screen) -{ - present_screen_priv_ptr screen_priv = present_screen_priv(screen); - - /* XXX this needs to be synchronous for server reset */ - - /* Do the actual cleanup once the flip has been performed by the hardware */ - if (screen_priv->flip_pending) - present_set_abort_flip(screen); -} - -void present_vblank_destroy(present_vblank_ptr vblank) { /* Remove vblank from window and screen lists */ diff --git a/present/present_priv.h b/present/present_priv.h index 8d3e007..49276ba 100644 --- a/present/present_priv.h +++ b/present/present_priv.h @@ -181,7 +181,7 @@ void present_vblank_destroy(present_vblank_ptr vblank); void -present_flip_destroy(ScreenPtr screen); +present_flip_idle(ScreenPtr screen); void present_check_flip_window(WindowPtr window); diff --git a/present/present_screen.c b/present/present_screen.c index 25ef681..2efcac7 100644 --- a/present/present_screen.c +++ b/present/present_screen.c @@ -57,7 +57,8 @@ present_close_screen(ScreenPtr screen) { present_screen_priv_ptr screen_priv = present_screen_priv(screen); - present_flip_destroy(screen); + assert (!screen_priv->flip_pending); + assert (!screen_priv->flip_pixmap); unwrap(screen_priv, screen, CloseScreen); (*screen->CloseScreen) (screen); @@ -92,10 +93,10 @@ present_clear_window_flip(WindowPtr window) if (flip_pending && flip_pending->window == window) { assert (flip_pending->abort_flip); - flip_pending->window = NULL; + screen_priv->flip_pending = NULL; } if (screen_priv->flip_window == window) - screen_priv->flip_window = NULL; + present_flip_idle(screen); } /* -- 1.8.5.4.gfdaaaa2 _______________________________________________ [email protected]: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
