From ab5e559771385bef3e34e3964876021721385ee1 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Wed, 11 Jun 2025 17:44:28 -0700 Subject: [PATCH] Revert "xfree86: use dixDestroyPixmap() instead of direct driver call" This reverts commit 4d1953728e52bb1da0a7d0cb66efa651cd01e88b. Part-of: --- hw/xfree86/common/xf86DGA.c | 4 ++-- hw/xfree86/dri2/dri2.c | 14 +++++++------- hw/xfree86/drivers/modesetting/dri2.c | 7 ++++--- hw/xfree86/drivers/modesetting/drmmode_display.c | 9 ++++++--- 4 files changed, 19 insertions(+), 15 deletions(-) diff --git a/hw/xfree86/common/xf86DGA.c b/hw/xfree86/common/xf86DGA.c index 2482530a1..41b58d9e3 100644 --- a/hw/xfree86/common/xf86DGA.c +++ b/hw/xfree86/common/xf86DGA.c @@ -370,7 +370,7 @@ xf86SetDGAMode(ScrnInfoPtr pScrn, int num, DGADevicePtr devRet) if (oldPix->drawable.id) FreeResource(oldPix->drawable.id, X11_RESTYPE_NONE); else - dixDestroyPixmap(oldPix, 0); + (*pScreen->DestroyPixmap) (oldPix); } free(pScreenPriv->current); pScreenPriv->current = NULL; @@ -432,7 +432,7 @@ xf86SetDGAMode(ScrnInfoPtr pScrn, int num, DGADevicePtr devRet) if (oldPix->drawable.id) FreeResource(oldPix->drawable.id, X11_RESTYPE_NONE); else - dixDestroyPixmap(oldPix, 0); + (*pScreen->DestroyPixmap) (oldPix); } free(pScreenPriv->current); pScreenPriv->current = NULL; diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c index 4ac0e144e..8158a1661 100644 --- a/hw/xfree86/dri2/dri2.c +++ b/hw/xfree86/dri2/dri2.c @@ -436,8 +436,8 @@ DRI2DrawableGone(void *p, XID id) } if (pPriv->prime_secondary_pixmap) { - dixDestroyPixmap(pPriv->prime_secondary_pixmap->primary_pixmap, 0); - dixDestroyPixmap(pPriv->prime_secondary_pixmap, 0); + (*pPriv->prime_secondary_pixmap->primary_pixmap->drawable.pScreen->DestroyPixmap)(pPriv->prime_secondary_pixmap->primary_pixmap); + (*pPriv->prime_secondary_pixmap->drawable.pScreen->DestroyPixmap)(pPriv->prime_secondary_pixmap); } if (pPriv->buffers != NULL) { @@ -449,7 +449,7 @@ DRI2DrawableGone(void *p, XID id) if (pPriv->redirectpixmap) { (*pDraw->pScreen->ReplaceScanoutPixmap)(pDraw, pPriv->redirectpixmap, FALSE); - dixDestroyPixmap(pPriv->redirectpixmap, 0); + (*pDraw->pScreen->DestroyPixmap)(pPriv->redirectpixmap); } dri2WakeAll(CLIENT_SIGNAL_ANY, pPriv, WAKE_SWAP); @@ -847,7 +847,7 @@ DrawablePtr DRI2UpdatePrime(DrawablePtr pDraw, DRI2BufferPtr pDest) ret = (*primary->ReplaceScanoutPixmap)(pDraw, mpix, TRUE); if (ret == FALSE) { - dixDestroyPixmap(mpix, 0); + (*primary->DestroyPixmap)(mpix); return NULL; } pPriv->redirectpixmap = mpix; @@ -856,7 +856,7 @@ DrawablePtr DRI2UpdatePrime(DrawablePtr pDraw, DRI2BufferPtr pDest) } } else if (pPriv->redirectpixmap) { (*primary->ReplaceScanoutPixmap)(pDraw, pPriv->redirectpixmap, FALSE); - dixDestroyPixmap(pPriv->redirectpixmap, 0); + (*primary->DestroyPixmap)(pPriv->redirectpixmap); pPriv->redirectpixmap = NULL; } } @@ -869,8 +869,8 @@ DrawablePtr DRI2UpdatePrime(DrawablePtr pDraw, DRI2BufferPtr pDest) return &pPriv->prime_secondary_pixmap->drawable; else { PixmapUnshareSecondaryPixmap(pPriv->prime_secondary_pixmap); - dixDestroyPixmap(pPriv->prime_secondary_pixmap->primary_pixmap, 0); - dixDestroyPixmap(pPriv->prime_secondary_pixmap, 0); + (*pPriv->prime_secondary_pixmap->primary_pixmap->drawable.pScreen->DestroyPixmap)(pPriv->prime_secondary_pixmap->primary_pixmap); + (*secondary->DestroyPixmap)(pPriv->prime_secondary_pixmap); pPriv->prime_secondary_pixmap = NULL; } } diff --git a/hw/xfree86/drivers/modesetting/dri2.c b/hw/xfree86/drivers/modesetting/dri2.c index 68765cad8..af7db7ddc 100644 --- a/hw/xfree86/drivers/modesetting/dri2.c +++ b/hw/xfree86/drivers/modesetting/dri2.c @@ -208,7 +208,7 @@ ms_dri2_create_buffer2(ScreenPtr screen, DrawablePtr drawable, if (buffer->name == -1) { xf86DrvMsg(scrn->scrnIndex, X_ERROR, "Failed to get DRI2 name for pixmap\n"); - dixDestroyPixmap(pixmap, 0); + screen->DestroyPixmap(pixmap); free(private); free(buffer); return NULL; @@ -247,7 +247,8 @@ static void ms_dri2_destroy_buffer2(ScreenPtr unused, DrawablePtr unused2, if (buffer->driverPrivate) { ms_dri2_buffer_private_ptr private = buffer->driverPrivate; if (--private->refcnt == 0) { - dixDestroyPixmap(private->pixmap, 0); + ScreenPtr screen = private->pixmap->drawable.pScreen; + screen->DestroyPixmap(private->pixmap); free(private); free(buffer); } @@ -522,7 +523,7 @@ update_front(DrawablePtr draw, DRI2BufferPtr front) front->name = name; - dixDestroyPixmap(priv->pixmap, 0); + (*screen->DestroyPixmap) (priv->pixmap); front->pitch = pixmap->devKind; front->cpp = pixmap->drawable.bitsPerPixel / 8; priv->pixmap = pixmap; diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.c b/hw/xfree86/drivers/modesetting/drmmode_display.c index cf4269403..6769d3dbf 100644 --- a/hw/xfree86/drivers/modesetting/drmmode_display.c +++ b/hw/xfree86/drivers/modesetting/drmmode_display.c @@ -1570,7 +1570,8 @@ drmmode_copy_fb(ScrnInfoPtr pScrn, drmmode_ptr drmmode) pScreen->canDoBGNoneRoot = TRUE; - dixDestroyPixmap(drmmode->fbcon_pixmap, 0); + if (drmmode->fbcon_pixmap) + pScrn->pScreen->DestroyPixmap(drmmode->fbcon_pixmap); drmmode->fbcon_pixmap = NULL; #endif } @@ -2155,7 +2156,7 @@ drmmode_create_pixmap_header(ScreenPtr pScreen, int width, int height, if ((*pScreen->ModifyPixmapHeader)(pixmap, width, height, depth, bitsPerPixel, devKind, pPixData)) return pixmap; - dixDestroyPixmap(pixmap, 0); + (*pScreen->DestroyPixmap)(pixmap); } return NullPixmap; } @@ -2227,7 +2228,9 @@ drmmode_shadow_fb_destroy(xf86CrtcPtr crtc, PixmapPtr pixmap, drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; drmmode_ptr drmmode = drmmode_crtc->drmmode; - dixDestroyPixmap(pixmap, 0); + if (pixmap) { + pixmap->drawable.pScreen->DestroyPixmap(pixmap); + } if (data) { drmModeRmFB(drmmode->fd, *fb_id);