xfree86: use dixDestroyPixmap() instead of direct driver call

Direct calls to ScreenRec->DestroyPixmap() blocks cleaning up the wrapping
jungle, so use the proper dix function instead.

See: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1754

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1711>
This commit is contained in:
Enrico Weigelt, metux IT consult 2024-09-30 17:58:50 +02:00
parent c117925ace
commit 4d1953728e
4 changed files with 15 additions and 19 deletions

View File

@ -370,7 +370,7 @@ xf86SetDGAMode(ScrnInfoPtr pScrn, int num, DGADevicePtr devRet)
if (oldPix->drawable.id) if (oldPix->drawable.id)
FreeResource(oldPix->drawable.id, X11_RESTYPE_NONE); FreeResource(oldPix->drawable.id, X11_RESTYPE_NONE);
else else
(*pScreen->DestroyPixmap) (oldPix); dixDestroyPixmap(oldPix, 0);
} }
free(pScreenPriv->current); free(pScreenPriv->current);
pScreenPriv->current = NULL; pScreenPriv->current = NULL;
@ -432,7 +432,7 @@ xf86SetDGAMode(ScrnInfoPtr pScrn, int num, DGADevicePtr devRet)
if (oldPix->drawable.id) if (oldPix->drawable.id)
FreeResource(oldPix->drawable.id, X11_RESTYPE_NONE); FreeResource(oldPix->drawable.id, X11_RESTYPE_NONE);
else else
(*pScreen->DestroyPixmap) (oldPix); dixDestroyPixmap(oldPix, 0);
} }
free(pScreenPriv->current); free(pScreenPriv->current);
pScreenPriv->current = NULL; pScreenPriv->current = NULL;

View File

@ -428,8 +428,8 @@ DRI2DrawableGone(void *p, XID id)
} }
if (pPriv->prime_secondary_pixmap) { if (pPriv->prime_secondary_pixmap) {
(*pPriv->prime_secondary_pixmap->primary_pixmap->drawable.pScreen->DestroyPixmap)(pPriv->prime_secondary_pixmap->primary_pixmap); dixDestroyPixmap(pPriv->prime_secondary_pixmap->primary_pixmap, 0);
(*pPriv->prime_secondary_pixmap->drawable.pScreen->DestroyPixmap)(pPriv->prime_secondary_pixmap); dixDestroyPixmap(pPriv->prime_secondary_pixmap, 0);
} }
if (pPriv->buffers != NULL) { if (pPriv->buffers != NULL) {
@ -441,7 +441,7 @@ DRI2DrawableGone(void *p, XID id)
if (pPriv->redirectpixmap) { if (pPriv->redirectpixmap) {
(*pDraw->pScreen->ReplaceScanoutPixmap)(pDraw, pPriv->redirectpixmap, FALSE); (*pDraw->pScreen->ReplaceScanoutPixmap)(pDraw, pPriv->redirectpixmap, FALSE);
(*pDraw->pScreen->DestroyPixmap)(pPriv->redirectpixmap); dixDestroyPixmap(pPriv->redirectpixmap, 0);
} }
dri2WakeAll(CLIENT_SIGNAL_ANY, pPriv, WAKE_SWAP); dri2WakeAll(CLIENT_SIGNAL_ANY, pPriv, WAKE_SWAP);
@ -839,7 +839,7 @@ DrawablePtr DRI2UpdatePrime(DrawablePtr pDraw, DRI2BufferPtr pDest)
ret = (*primary->ReplaceScanoutPixmap)(pDraw, mpix, TRUE); ret = (*primary->ReplaceScanoutPixmap)(pDraw, mpix, TRUE);
if (ret == FALSE) { if (ret == FALSE) {
(*primary->DestroyPixmap)(mpix); dixDestroyPixmap(mpix, 0);
return NULL; return NULL;
} }
pPriv->redirectpixmap = mpix; pPriv->redirectpixmap = mpix;
@ -848,7 +848,7 @@ DrawablePtr DRI2UpdatePrime(DrawablePtr pDraw, DRI2BufferPtr pDest)
} }
} else if (pPriv->redirectpixmap) { } else if (pPriv->redirectpixmap) {
(*primary->ReplaceScanoutPixmap)(pDraw, pPriv->redirectpixmap, FALSE); (*primary->ReplaceScanoutPixmap)(pDraw, pPriv->redirectpixmap, FALSE);
(*primary->DestroyPixmap)(pPriv->redirectpixmap); dixDestroyPixmap(pPriv->redirectpixmap, 0);
pPriv->redirectpixmap = NULL; pPriv->redirectpixmap = NULL;
} }
} }
@ -861,8 +861,8 @@ DrawablePtr DRI2UpdatePrime(DrawablePtr pDraw, DRI2BufferPtr pDest)
return &pPriv->prime_secondary_pixmap->drawable; return &pPriv->prime_secondary_pixmap->drawable;
else { else {
PixmapUnshareSecondaryPixmap(pPriv->prime_secondary_pixmap); PixmapUnshareSecondaryPixmap(pPriv->prime_secondary_pixmap);
(*pPriv->prime_secondary_pixmap->primary_pixmap->drawable.pScreen->DestroyPixmap)(pPriv->prime_secondary_pixmap->primary_pixmap); dixDestroyPixmap(pPriv->prime_secondary_pixmap->primary_pixmap, 0);
(*secondary->DestroyPixmap)(pPriv->prime_secondary_pixmap); dixDestroyPixmap(pPriv->prime_secondary_pixmap, 0);
pPriv->prime_secondary_pixmap = NULL; pPriv->prime_secondary_pixmap = NULL;
} }
} }

View File

@ -208,7 +208,7 @@ ms_dri2_create_buffer2(ScreenPtr screen, DrawablePtr drawable,
if (buffer->name == -1) { if (buffer->name == -1) {
xf86DrvMsg(scrn->scrnIndex, X_ERROR, xf86DrvMsg(scrn->scrnIndex, X_ERROR,
"Failed to get DRI2 name for pixmap\n"); "Failed to get DRI2 name for pixmap\n");
screen->DestroyPixmap(pixmap); dixDestroyPixmap(pixmap, 0);
free(private); free(private);
free(buffer); free(buffer);
return NULL; return NULL;
@ -247,8 +247,7 @@ static void ms_dri2_destroy_buffer2(ScreenPtr unused, DrawablePtr unused2,
if (buffer->driverPrivate) { if (buffer->driverPrivate) {
ms_dri2_buffer_private_ptr private = buffer->driverPrivate; ms_dri2_buffer_private_ptr private = buffer->driverPrivate;
if (--private->refcnt == 0) { if (--private->refcnt == 0) {
ScreenPtr screen = private->pixmap->drawable.pScreen; dixDestroyPixmap(private->pixmap, 0);
screen->DestroyPixmap(private->pixmap);
free(private); free(private);
free(buffer); free(buffer);
} }
@ -523,7 +522,7 @@ update_front(DrawablePtr draw, DRI2BufferPtr front)
front->name = name; front->name = name;
(*screen->DestroyPixmap) (priv->pixmap); dixDestroyPixmap(priv->pixmap, 0);
front->pitch = pixmap->devKind; front->pitch = pixmap->devKind;
front->cpp = pixmap->drawable.bitsPerPixel / 8; front->cpp = pixmap->drawable.bitsPerPixel / 8;
priv->pixmap = pixmap; priv->pixmap = pixmap;

View File

@ -1570,8 +1570,7 @@ drmmode_copy_fb(ScrnInfoPtr pScrn, drmmode_ptr drmmode)
pScreen->canDoBGNoneRoot = TRUE; pScreen->canDoBGNoneRoot = TRUE;
if (drmmode->fbcon_pixmap) dixDestroyPixmap(drmmode->fbcon_pixmap, 0);
pScrn->pScreen->DestroyPixmap(drmmode->fbcon_pixmap);
drmmode->fbcon_pixmap = NULL; drmmode->fbcon_pixmap = NULL;
#endif #endif
} }
@ -2151,7 +2150,7 @@ drmmode_create_pixmap_header(ScreenPtr pScreen, int width, int height,
if ((*pScreen->ModifyPixmapHeader)(pixmap, width, height, depth, if ((*pScreen->ModifyPixmapHeader)(pixmap, width, height, depth,
bitsPerPixel, devKind, pPixData)) bitsPerPixel, devKind, pPixData))
return pixmap; return pixmap;
(*pScreen->DestroyPixmap)(pixmap); dixDestroyPixmap(pixmap, 0);
} }
return NullPixmap; return NullPixmap;
} }
@ -2223,9 +2222,7 @@ drmmode_shadow_fb_destroy(xf86CrtcPtr crtc, PixmapPtr pixmap,
drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
drmmode_ptr drmmode = drmmode_crtc->drmmode; drmmode_ptr drmmode = drmmode_crtc->drmmode;
if (pixmap) { dixDestroyPixmap(pixmap, 0);
pixmap->drawable.pScreen->DestroyPixmap(pixmap);
}
if (data) { if (data) {
drmModeRmFB(drmmode->fd, *fb_id); drmModeRmFB(drmmode->fd, *fb_id);