[PATCH 2/4] present: don't vblank abort pending flip during window destruction
Frank Binns
frank.binns at imgtec.com
Thu Apr 24 02:38:59 PDT 2014
As part of present's window destroy function, any vblanks associated with
the destroyed window are aborted and destroyed. However, this can include
a pending flip. This means that when the corresponding flip event is
finally processed it gets ignored. As a result, any deferred unflip is
never performed and, more importantly, the now idle pixmap is never
destroyed. This results in a leak between server resets.
Fix this by preventing any pending flip, associated with the window being
destroyed, from being aborted and destroyed during window destruction.
Signed-off-by: Frank Binns <frank.binns at imgtec.com>
---
present/present.c | 3 ++-
present/present_screen.c | 8 ++++++--
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/present/present.c b/present/present.c
index 2a96928..32160b9 100644
--- a/present/present.c
+++ b/present/present.c
@@ -354,7 +354,8 @@ present_unflip(ScreenPtr screen)
present_set_tree_pixmap(screen_priv->flip_window,
(*screen->GetScreenPixmap)(screen));
- present_set_tree_pixmap(screen->root, (*screen->GetScreenPixmap)(screen));
+ if (screen->root)
+ present_set_tree_pixmap(screen->root, (*screen->GetScreenPixmap)(screen));
/* Update the screen pixmap with the current flip pixmap contents
*/
diff --git a/present/present_screen.c b/present/present_screen.c
index 25ef681..693c827 100644
--- a/present/present_screen.c
+++ b/present/present_screen.c
@@ -71,12 +71,16 @@ present_close_screen(ScreenPtr screen)
static void
present_free_window_vblank(WindowPtr window)
{
+ ScreenPtr screen = window->drawable.pScreen;
+ present_screen_priv_ptr screen_priv = present_screen_priv(screen);
present_window_priv_ptr window_priv = present_window_priv(window);
present_vblank_ptr vblank, tmp;
xorg_list_for_each_entry_safe(vblank, tmp, &window_priv->vblank, window_list) {
- present_abort_vblank(window->drawable.pScreen, vblank->crtc, vblank->event_id, vblank->target_msc);
- present_vblank_destroy(vblank);
+ if (vblank != screen_priv->flip_pending) {
+ present_abort_vblank(window->drawable.pScreen, vblank->crtc, vblank->event_id, vblank->target_msc);
+ present_vblank_destroy(vblank);
+ }
}
}
--
1.8.5.4.gfdaaaa2
More information about the xorg-devel
mailing list