Revert "exa: simplify CreatePixmap()/DestroyPixmap() handlers error pathes"

This reverts commit ee798cf212.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2020>
This commit is contained in:
Alan Coopersmith 2025-06-11 17:44:28 -07:00 committed by Marge Bot
parent e48b1aaa97
commit 8b47b53226
3 changed files with 18 additions and 24 deletions

View File

@ -96,9 +96,10 @@ exaCreatePixmap_classic(ScreenPtr pScreen, int w, int h, int depth,
pExaPixmap->fb_size = pExaPixmap->fb_pitch * h; pExaPixmap->fb_size = pExaPixmap->fb_pitch * h;
if (pExaPixmap->fb_pitch > 131071) { if (pExaPixmap->fb_pitch > 131071) {
// don't need to protect from calling our own (wrapped) DestroyPixmap swap(pExaScr, pScreen, DestroyPixmap);
// handler, because it can deal with half-initialized state if (pScreen->DestroyPixmap)
dixDestroyPixmap(pPixmap, 0); pScreen->DestroyPixmap(pPixmap);
swap(pExaScr, pScreen, DestroyPixmap);
return NULL; return NULL;
} }
@ -108,9 +109,10 @@ exaCreatePixmap_classic(ScreenPtr pScreen, int w, int h, int depth,
pScreen, pPixmap); pScreen, pPixmap);
if (pExaPixmap->pDamage == NULL) { if (pExaPixmap->pDamage == NULL) {
// don't need to protect from calling our own (wrapped) DestroyPixmap swap(pExaScr, pScreen, DestroyPixmap);
// handler, because it can deal with half-initialized state if (pScreen->DestroyPixmap)
dixDestroyPixmap(pPixmap, 0); pScreen->DestroyPixmap(pPixmap);
swap(pExaScr, pScreen, DestroyPixmap);
return NULL; return NULL;
} }
@ -216,8 +218,6 @@ exaDestroyPixmap_classic(PixmapPtr pPixmap)
if (pPixmap->refcnt == 1) { if (pPixmap->refcnt == 1) {
ExaPixmapPriv(pPixmap); ExaPixmapPriv(pPixmap);
if (!pExaPixmap) // we're called on an error path
goto out;
exaDestroyPixmap(pPixmap); exaDestroyPixmap(pPixmap);
@ -235,10 +235,9 @@ exaDestroyPixmap_classic(PixmapPtr pPixmap)
RegionUninit(&pExaPixmap->validFB); RegionUninit(&pExaPixmap->validFB);
} }
out:
// restore original (screen driver's) DestroyPixmap() handler and call it
swap(pExaScr, pScreen, DestroyPixmap); swap(pExaScr, pScreen, DestroyPixmap);
dixDestroyPixmap(pPixmap, 0); if (pScreen->DestroyPixmap)
ret = pScreen->DestroyPixmap(pPixmap);
swap(pExaScr, pScreen, DestroyPixmap); swap(pExaScr, pScreen, DestroyPixmap);
return ret; return ret;

View File

@ -98,9 +98,10 @@ exaCreatePixmap_driver(ScreenPtr pScreen, int w, int h, int depth,
} }
if (!pExaPixmap->driverPriv) { if (!pExaPixmap->driverPriv) {
// don't need to protect from calling our own (wrapped) DestroyPixmap swap(pExaScr, pScreen, DestroyPixmap);
// handler, because it can deal with half-initialized state if (pScreen->DestroyPixmap)
dixDestroyPixmap(pPixmap, 0); pScreen->DestroyPixmap(pPixmap);
swap(pExaScr, pScreen, DestroyPixmap);
return NULL; return NULL;
} }
@ -195,8 +196,6 @@ exaDestroyPixmap_driver(PixmapPtr pPixmap)
if (pPixmap->refcnt == 1) { if (pPixmap->refcnt == 1) {
ExaPixmapPriv(pPixmap); ExaPixmapPriv(pPixmap);
if (!pExaPixmap) // we're called on an error path
goto out;
exaDestroyPixmap(pPixmap); exaDestroyPixmap(pPixmap);
@ -205,10 +204,9 @@ exaDestroyPixmap_driver(PixmapPtr pPixmap)
pExaPixmap->driverPriv = NULL; pExaPixmap->driverPriv = NULL;
} }
out:
// restore original (screen driver's) DestroyPixmap() handler and call it
swap(pExaScr, pScreen, DestroyPixmap); swap(pExaScr, pScreen, DestroyPixmap);
dixDestroyPixmap(pPixmap, 0); if (pScreen->DestroyPixmap)
ret = pScreen->DestroyPixmap(pPixmap);
swap(pExaScr, pScreen, DestroyPixmap); swap(pExaScr, pScreen, DestroyPixmap);
return ret; return ret;

View File

@ -249,8 +249,6 @@ exaDestroyPixmap_mixed(PixmapPtr pPixmap)
if (pPixmap->refcnt == 1) { if (pPixmap->refcnt == 1) {
ExaPixmapPriv(pPixmap); ExaPixmapPriv(pPixmap);
if (!pExaPixmap)
goto out; // we're called on an error path
exaDestroyPixmap(pPixmap); exaDestroyPixmap(pPixmap);
@ -268,10 +266,9 @@ exaDestroyPixmap_mixed(PixmapPtr pPixmap)
} }
} }
out:
// restore original (screen driver's) DestroyPixmap() handler and call it
swap(pExaScr, pScreen, DestroyPixmap); swap(pExaScr, pScreen, DestroyPixmap);
dixDestroyPixmap(pPixmap, 0); if (pScreen->DestroyPixmap)
ret = pScreen->DestroyPixmap(pPixmap);
swap(pExaScr, pScreen, DestroyPixmap); swap(pExaScr, pScreen, DestroyPixmap);
return ret; return ret;