[PATCH] ephyr: Free damage structure at server reset time

Jamey Sharp jamey at minilop.net
Fri Jun 6 08:51:18 PDT 2014


Xephyr could wrap CloseScreen after initializing kdrive, couldn't it? I
haven't looked carefully at that code, so I dunno.

Regardless:
Reviewed-by: Jamey Sharp <jamey at minilop.net>

On Wed, Jun 04, 2014 at 10:00:45PM -0700, Keith Packard wrote:
> 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 <keithp at keithp.com>
> ---
>  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 def50d8..49a4d2d 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 34ce460..e691780 100644
> --- a/hw/kdrive/ephyr/ephyr.h
> +++ b/hw/kdrive/ephyr/ephyr.h
> @@ -131,6 +131,9 @@ void
>   ephyrScreenFini(KdScreenInfo * screen);
>  
>  void
> +ephyrCloseScreen(ScreenPtr pScreen);
> +
> +void
>   ephyrCardFini(KdCardInfo * card);
>  
>  void
> diff --git a/hw/kdrive/ephyr/ephyrinit.c b/hw/kdrive/ephyr/ephyrinit.c
> index fac84cd..3f66e1c 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 9814fc6..b5b91c0 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 bec75cb..08b1681 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
> -- 
> 2.0.0.rc4
> 
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://lists.x.org/archives/xorg-devel/attachments/20140606/e575bcc0/attachment.sig>


More information about the xorg-devel mailing list