From c721bb59c8daaa148673a473608c2a6af61d5adc Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Thu, 5 Feb 2026 17:25:09 +0100 Subject: [PATCH] dri2: declare variables where needed in DRI2AllocateDrawable() Signed-off-by: Enrico Weigelt, metux IT consult --- Xext/dri2/dri2.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/Xext/dri2/dri2.c b/Xext/dri2/dri2.c index 79853f14f0..2b49768f79 100644 --- a/Xext/dri2/dri2.c +++ b/Xext/dri2/dri2.c @@ -227,15 +227,12 @@ DRI2GetDrawable(DrawablePtr pDraw) static DRI2DrawablePtr DRI2AllocateDrawable(DrawablePtr pDraw) { - DRI2ScreenPtr ds = DRI2GetScreen(pDraw->pScreen); - CARD64 ust; - WindowPtr pWin; - PixmapPtr pPixmap; - DRI2DrawablePtr pPriv = calloc(1, sizeof *pPriv); if (pPriv == NULL) return NULL; + DRI2ScreenPtr ds = DRI2GetScreen(pDraw->pScreen); + pPriv->dri2_screen = ds; pPriv->drawable = pDraw; pPriv->width = pDraw->width; @@ -246,7 +243,9 @@ DRI2AllocateDrawable(DrawablePtr pDraw) pPriv->swap_count = 0; pPriv->target_sbc = -1; pPriv->swap_interval = 1; + /* Initialize last swap target from DDX if possible */ + CARD64 ust; if (!ds->GetMSC || !(*ds->GetMSC) (pDraw, &ust, &pPriv->last_swap_target)) pPriv->last_swap_target = 0; @@ -259,11 +258,11 @@ DRI2AllocateDrawable(DrawablePtr pDraw) pPriv->redirectpixmap = NULL; pPriv->prime_secondary_pixmap = NULL; if (pDraw->type == DRAWABLE_WINDOW) { - pWin = (WindowPtr) pDraw; + WindowPtr pWin = (WindowPtr) pDraw; dixSetPrivate(&pWin->devPrivates, &dri2WindowPrivateKeyRec, pPriv); } else { - pPixmap = (PixmapPtr) pDraw; + PixmapPtr pPixmap = (PixmapPtr) pDraw; dixSetPrivate(&pPixmap->devPrivates, &dri2PixmapPrivateKeyRec, pPriv); }