[PATCH] dri2: Register the DRI2DrawableType after server regeneration

Pauli Nieminen suokkos at gmail.com
Thu Aug 25 07:26:20 PDT 2011


On Thu, Aug 25, 2011 at 2:50 PM, Chris Wilson <chris at chris-wilson.co.uk> wrote:
> The Resource database is reset upon regeneration and so the dri2 module
> needs to re-register its RESTYPE for the drawable or else it will
> clobber the next unsuspecting user of the database. Fortunately, DRI2 is
> loaded late in the initialisation sequence and was last up until
> xf86-video-intel started using the Resource database to track
> outstanding swaps...
>
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> ---
>  hw/xfree86/dri2/dri2.c |   11 +++++++++--
>  1 files changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c
> index 561237d..535078a 100644
> --- a/hw/xfree86/dri2/dri2.c
> +++ b/hw/xfree86/dri2/dri2.c
> @@ -1102,6 +1102,7 @@ DRI2SetWindowPixmap(WindowPtr pWin, PixmapPtr pPixmap)
>  Bool
>  DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info)
>  {
> +    static int dri2_server_generation;
>     DRI2ScreenPtr ds;
>     const char* driverTypeNames[] = {
>        "DRI", /* DRI2DriverDRI */
> @@ -1119,6 +1120,14 @@ DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info)
>         return FALSE;
>     }
>
> +    if (serverGeneration != dri2_server_generation) {
> +       dri2DrawableRes = CreateNewResourceType(DRI2DrawableGone, "DRI2Drawable");
> +       if (!dri2DrawableRes)
> +           return FALSE;
> +
> +       dri2_server_generation = serverGeneration;
> +    }
> +
>     if (!dixRegisterPrivateKey(&dri2ScreenPrivateKeyRec, PRIVATE_SCREEN, 0))
>        return FALSE;
>
> @@ -1227,8 +1236,6 @@ DRI2Setup(pointer module, pointer opts, int *errmaj, int *errmin)
>  {
>     static Bool setupDone = FALSE;
>
> -    dri2DrawableRes = CreateNewResourceType(DRI2DrawableGone, "DRI2Drawable");
> -

Extension init function could register the resource type.
InitExtensions calls the extension init function for each server
generation.

>     if (!setupDone)
>     {
>        setupDone = TRUE;
> --
> 1.7.5.4
>
> _______________________________________________
> 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
>


More information about the xorg-devel mailing list