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 - except when calling down the
chain where we had wrapped ourselves - and protecting those against NULL, so
we can move subsys-provided functions out of that chain.

See: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1754
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult
2024-10-01 10:50:45 +02:00
committed by Shashank Sharma
parent 7943a70cd3
commit 2cb59a92de
5 changed files with 11 additions and 11 deletions

View File

@@ -200,7 +200,7 @@ amdgpu_dri2_create_buffer2(ScreenPtr pScreen,
error:
free(buffers);
(*pScreen->DestroyPixmap) (pixmap);
dixDestroyPixmap(pixmap, 0);
return NULL;
}
@@ -224,7 +224,7 @@ amdgpu_dri2_destroy_buffer2(ScreenPtr pScreen,
private->refcnt--;
if (private->refcnt == 0) {
if (private->pixmap)
(*pScreen->DestroyPixmap) (private->pixmap);
dixDestroyPixmap(private->pixmap, 0);
free(buffers->driverPrivate);
free(buffers);
@@ -558,7 +558,7 @@ static Bool update_front(DrawablePtr draw, DRI2BufferPtr front)
if (!amdgpu_get_flink_name(pAMDGPUEnt, pixmap, &front->name))
return FALSE;
(*draw->pScreen->DestroyPixmap) (priv->pixmap);
dixDestroyPixmap(priv->pixmap, 0);
front->pitch = pixmap->devKind;
front->cpp = pixmap->drawable.bitsPerPixel / 8;
priv->pixmap = pixmap;

View File

@@ -157,7 +157,7 @@ static Bool amdgpu_glamor_destroy_pixmap(PixmapPtr pixmap)
#ifndef HAVE_GLAMOR_EGL_DESTROY_TEXTURED_PIXMAP
ScreenPtr screen = pixmap->drawable.pScreen;
AMDGPUInfoPtr info = AMDGPUPTR(xf86ScreenToScrn(screen));
Bool ret;
Bool ret = TRUE;
#endif
if (pixmap->refcnt == 1) {
@@ -179,7 +179,8 @@ static Bool amdgpu_glamor_destroy_pixmap(PixmapPtr pixmap)
return TRUE;
#else
screen->DestroyPixmap = info->glamor.SavedDestroyPixmap;
ret = screen->DestroyPixmap(pixmap);
if (screen->DestroyPixmap)
ret = screen->DestroyPixmap(pixmap);
info->glamor.SavedDestroyPixmap = screen->DestroyPixmap;
screen->DestroyPixmap = amdgpu_glamor_destroy_pixmap;
@@ -337,7 +338,7 @@ amdgpu_glamor_set_pixmap_bo(DrawablePtr drawable, PixmapPtr pixmap)
0, 0, pixmap->devKind, NULL);
old->devPrivate.ptr = NULL;
screen->DestroyPixmap(pixmap);
dixDestroyPixmap(pixmap, 0);
return old;
}

View File

@@ -2338,8 +2338,7 @@ void AMDGPULeaveVT_KMS(ScrnInfoPtr pScrn)
}
}
}
pScreen->DestroyPixmap(black_scanout);
dixDestroyPixmap(black_scanout, 0);
}
}

View File

@@ -402,7 +402,7 @@ create_pixmap_for_fbcon(drmmode_ptr drmmode,
if (!glamor_egl_create_textured_pixmap(pixmap, fbcon->handle,
pixmap->devKind)) {
pScreen->DestroyPixmap(pixmap);
dixDestroyPixmap(pixmap, 0);
pixmap = NULL;
}
@@ -460,7 +460,7 @@ void drmmode_copy_fb(ScrnInfoPtr pScrn, drmmode_ptr drmmode)
FreeScratchGC(gc);
pScreen->canDoBGNoneRoot = TRUE;
pScreen->DestroyPixmap(src);
dixDestroyPixmap(src, 0);
#endif
return;

View File

@@ -240,7 +240,7 @@ drmmode_crtc_scanout_destroy(PixmapPtr *scanout)
if (!*scanout)
return;
(*scanout)->drawable.pScreen->DestroyPixmap(*scanout);
dixDestroyPixmap(*scanout, 0);
(*scanout) = NULL;
}