From bfa5c73a36230f77fb211f185152212541c9d56d Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Wed, 4 Jun 2014 22:00:45 -0700 Subject: [PATCH] ephyr: Free damage structure at server reset time The usual mechanism for freeing a damage structure when the pixmap is destroyed does not work for the screen pixmap as it isn't freed in the normal way. The existing driver cleanup function, scrfini, is called after the wrapped CloseScreen functions, including damageCloseScreen, are called and thus ephyr can't free the damage structure at that point. Deal with this by providing an early CloseScreen hook in KdCloseScreen which ephyr can use to free the damage structure before damage itself shuts down. Signed-off-by: Keith Packard Reviewed-by: Jamey Sharp --- hw/kdrive/ephyr/ephyr.c | 6 ++++++ hw/kdrive/ephyr/ephyr.h | 3 +++ hw/kdrive/ephyr/ephyrinit.c | 2 ++ hw/kdrive/src/kdrive.c | 4 ++++ hw/kdrive/src/kdrive.h | 1 + 5 files changed, 16 insertions(+) diff --git a/hw/kdrive/ephyr/ephyr.c b/hw/kdrive/ephyr/ephyr.c index def50d8d8f..49a4d2ded1 100644 --- a/hw/kdrive/ephyr/ephyr.c +++ b/hw/kdrive/ephyr/ephyr.c @@ -756,6 +756,12 @@ ephyrScreenFini(KdScreenInfo * screen) } } +void +ephyrCloseScreen(ScreenPtr pScreen) +{ + ephyrUnsetInternalDamage(pScreen); +} + /* * Port of Mark McLoughlin's Xnest fix for focus in + modifier bug. * See https://bugs.freedesktop.org/show_bug.cgi?id=3030 diff --git a/hw/kdrive/ephyr/ephyr.h b/hw/kdrive/ephyr/ephyr.h index 34ce4601b8..e691780823 100644 --- a/hw/kdrive/ephyr/ephyr.h +++ b/hw/kdrive/ephyr/ephyr.h @@ -130,6 +130,9 @@ void void ephyrScreenFini(KdScreenInfo * screen); +void +ephyrCloseScreen(ScreenPtr pScreen); + void ephyrCardFini(KdCardInfo * card); diff --git a/hw/kdrive/ephyr/ephyrinit.c b/hw/kdrive/ephyr/ephyrinit.c index fac84cd134..3f66e1c2f6 100644 --- a/hw/kdrive/ephyr/ephyrinit.c +++ b/hw/kdrive/ephyr/ephyrinit.c @@ -430,4 +430,6 @@ KdCardFuncs ephyrFuncs = { ephyrGetColors, /* getColors */ ephyrPutColors, /* putColors */ + + ephyrCloseScreen, /* closeScreen */ }; diff --git a/hw/kdrive/src/kdrive.c b/hw/kdrive/src/kdrive.c index 9814fc66a9..b5b91c0ddd 100644 --- a/hw/kdrive/src/kdrive.c +++ b/hw/kdrive/src/kdrive.c @@ -621,8 +621,12 @@ KdCloseScreen(ScreenPtr pScreen) KdCardInfo *card = pScreenPriv->card; Bool ret; + if (card->cfuncs->closeScreen) + (*card->cfuncs->closeScreen)(pScreen); + pScreenPriv->closed = TRUE; pScreen->CloseScreen = pScreenPriv->CloseScreen; + if (pScreen->CloseScreen) ret = (*pScreen->CloseScreen) (pScreen); else diff --git a/hw/kdrive/src/kdrive.h b/hw/kdrive/src/kdrive.h index bec75cb6fa..08b1681ce7 100644 --- a/hw/kdrive/src/kdrive.h +++ b/hw/kdrive/src/kdrive.h @@ -130,6 +130,7 @@ typedef struct _KdCardFuncs { void (*getColors) (ScreenPtr, int, xColorItem *); void (*putColors) (ScreenPtr, int, xColorItem *); + void (*closeScreen) (ScreenPtr); /* close ScreenRec */ } KdCardFuncs; #define KD_MAX_PSEUDO_DEPTH 8