(!1714) exa: use PixmapDestroy hook
Wrapping ScreenRec's function pointers is problematic for many reasons, so use the new pixmap destroy notify hook instead. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
parent
987f37270b
commit
c248346e78
16
exa/exa.c
16
exa/exa.c
|
@ -740,6 +740,11 @@ exaCloseScreen(ScreenPtr pScreen)
|
|||
ExaScreenPriv(pScreen);
|
||||
PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
|
||||
|
||||
/* doesn't matter which one actually was registered */
|
||||
dixScreenUnhookPixmapDestroy(pScreen, exaPixmapDestroy_classic, 0);
|
||||
dixScreenUnhookPixmapDestroy(pScreen, exaPixmapDestroy_driver, 0);
|
||||
dixScreenUnhookPixmapDestroy(pScreen, exaPixmapDestroy_mixed, 0);
|
||||
|
||||
if (ps->Glyphs == exaGlyphs)
|
||||
exaGlyphsFini(pScreen);
|
||||
|
||||
|
@ -753,8 +758,6 @@ exaCloseScreen(ScreenPtr pScreen)
|
|||
unwrap(pExaScr, pScreen, GetSpans);
|
||||
if (pExaScr->SavedCreatePixmap)
|
||||
unwrap(pExaScr, pScreen, CreatePixmap);
|
||||
if (pExaScr->SavedDestroyPixmap)
|
||||
unwrap(pExaScr, pScreen, DestroyPixmap);
|
||||
if (pExaScr->SavedModifyPixmapHeader)
|
||||
unwrap(pExaScr, pScreen, ModifyPixmapHeader);
|
||||
unwrap(pExaScr, pScreen, CopyWindow);
|
||||
|
@ -955,8 +958,9 @@ exaDriverInit(ScreenPtr pScreen, ExaDriverPtr pScreenInfo)
|
|||
}
|
||||
if (pExaScr->info->flags & EXA_HANDLES_PIXMAPS) {
|
||||
if (pExaScr->info->flags & EXA_MIXED_PIXMAPS) {
|
||||
dixScreenHookPixmapDestroy(pScreen, exaPixmapDestroy_mixed, 0);
|
||||
|
||||
wrap(pExaScr, pScreen, CreatePixmap, exaCreatePixmap_mixed);
|
||||
wrap(pExaScr, pScreen, DestroyPixmap, exaDestroyPixmap_mixed);
|
||||
wrap(pExaScr, pScreen, ModifyPixmapHeader,
|
||||
exaModifyPixmapHeader_mixed);
|
||||
wrap(pExaScr, pScreen, SharePixmapBacking, exaSharePixmapBacking_mixed);
|
||||
|
@ -969,8 +973,9 @@ exaDriverInit(ScreenPtr pScreen, ExaDriverPtr pScreenInfo)
|
|||
pExaScr->prepare_access_reg = exaPrepareAccessReg_mixed;
|
||||
}
|
||||
else {
|
||||
dixScreenHookPixmapDestroy(pScreen, exaPixmapDestroy_driver, 0);
|
||||
|
||||
wrap(pExaScr, pScreen, CreatePixmap, exaCreatePixmap_driver);
|
||||
wrap(pExaScr, pScreen, DestroyPixmap, exaDestroyPixmap_driver);
|
||||
wrap(pExaScr, pScreen, ModifyPixmapHeader,
|
||||
exaModifyPixmapHeader_driver);
|
||||
pExaScr->do_migration = NULL;
|
||||
|
@ -981,8 +986,9 @@ exaDriverInit(ScreenPtr pScreen, ExaDriverPtr pScreenInfo)
|
|||
}
|
||||
}
|
||||
else {
|
||||
dixScreenHookPixmapDestroy(pScreen, exaPixmapDestroy_classic, 0);
|
||||
|
||||
wrap(pExaScr, pScreen, CreatePixmap, exaCreatePixmap_classic);
|
||||
wrap(pExaScr, pScreen, DestroyPixmap, exaDestroyPixmap_classic);
|
||||
wrap(pExaScr, pScreen, ModifyPixmapHeader,
|
||||
exaModifyPixmapHeader_classic);
|
||||
pExaScr->do_migration = exaDoMigration_classic;
|
||||
|
|
|
@ -206,18 +206,11 @@ exaModifyPixmapHeader_classic(PixmapPtr pPixmap, int width, int height,
|
|||
return ret;
|
||||
}
|
||||
|
||||
Bool
|
||||
exaDestroyPixmap_classic(PixmapPtr pPixmap)
|
||||
void exaPixmapDestroy_classic(ScreenPtr pScreen, PixmapPtr pPixmap, void *arg)
|
||||
{
|
||||
ScreenPtr pScreen = pPixmap->drawable.pScreen;
|
||||
|
||||
ExaScreenPriv(pScreen);
|
||||
Bool ret = TRUE;
|
||||
|
||||
if (pPixmap->refcnt == 1) {
|
||||
ExaPixmapPriv(pPixmap);
|
||||
if (!pExaPixmap) // we're called on an error path
|
||||
goto out;
|
||||
return;
|
||||
|
||||
exaDestroyPixmap(pPixmap);
|
||||
|
||||
|
@ -233,15 +226,6 @@ exaDestroyPixmap_classic(PixmapPtr pPixmap)
|
|||
}
|
||||
RegionUninit(&pExaPixmap->validSys);
|
||||
RegionUninit(&pExaPixmap->validFB);
|
||||
}
|
||||
|
||||
out:
|
||||
// restore original (screen driver's) DestroyPixmap() handler and call it
|
||||
swap(pExaScr, pScreen, DestroyPixmap);
|
||||
dixDestroyPixmap(pPixmap, 0);
|
||||
swap(pExaScr, pScreen, DestroyPixmap);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
Bool
|
||||
|
|
|
@ -185,33 +185,19 @@ exaModifyPixmapHeader_driver(PixmapPtr pPixmap, int width, int height,
|
|||
return ret;
|
||||
}
|
||||
|
||||
Bool
|
||||
exaDestroyPixmap_driver(PixmapPtr pPixmap)
|
||||
void exaPixmapDestroy_driver(ScreenPtr pScreen, PixmapPtr pPixmap, void *arg)
|
||||
{
|
||||
ScreenPtr pScreen = pPixmap->drawable.pScreen;
|
||||
|
||||
ExaScreenPriv(pScreen);
|
||||
Bool ret = TRUE;
|
||||
|
||||
if (pPixmap->refcnt == 1) {
|
||||
ExaPixmapPriv(pPixmap);
|
||||
if (!pExaPixmap) // we're called on an error path
|
||||
goto out;
|
||||
return;
|
||||
|
||||
exaDestroyPixmap(pPixmap);
|
||||
|
||||
if (pExaPixmap->driverPriv)
|
||||
pExaScr->info->DestroyPixmap(pScreen, pExaPixmap->driverPriv);
|
||||
pExaPixmap->driverPriv = NULL;
|
||||
}
|
||||
|
||||
out:
|
||||
// restore original (screen driver's) DestroyPixmap() handler and call it
|
||||
swap(pExaScr, pScreen, DestroyPixmap);
|
||||
dixDestroyPixmap(pPixmap, 0);
|
||||
swap(pExaScr, pScreen, DestroyPixmap);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
Bool
|
||||
|
|
|
@ -239,18 +239,13 @@ exaModifyPixmapHeader_mixed(PixmapPtr pPixmap, int width, int height, int depth,
|
|||
return ret;
|
||||
}
|
||||
|
||||
Bool
|
||||
exaDestroyPixmap_mixed(PixmapPtr pPixmap)
|
||||
void exaPixmapDestroy_mixed(ScreenPtr pScreen, PixmapPtr pPixmap, void *arg)
|
||||
{
|
||||
ScreenPtr pScreen = pPixmap->drawable.pScreen;
|
||||
|
||||
ExaScreenPriv(pScreen);
|
||||
Bool ret = TRUE;
|
||||
|
||||
if (pPixmap->refcnt == 1) {
|
||||
ExaPixmapPriv(pPixmap);
|
||||
if (!pExaPixmap)
|
||||
goto out; // we're called on an error path
|
||||
if (!pExaPixmap) // we're called on an error path
|
||||
return;
|
||||
|
||||
exaDestroyPixmap(pPixmap);
|
||||
|
||||
|
@ -266,15 +261,6 @@ exaDestroyPixmap_mixed(PixmapPtr pPixmap)
|
|||
pExaPixmap->sys_ptr = NULL;
|
||||
pExaPixmap->pDamage = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
out:
|
||||
// restore original (screen driver's) DestroyPixmap() handler and call it
|
||||
swap(pExaScr, pScreen, DestroyPixmap);
|
||||
dixDestroyPixmap(pPixmap, 0);
|
||||
swap(pExaScr, pScreen, DestroyPixmap);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
Bool
|
||||
|
|
|
@ -156,7 +156,6 @@ typedef struct {
|
|||
GetImageProcPtr SavedGetImage;
|
||||
GetSpansProcPtr SavedGetSpans;
|
||||
CreatePixmapProcPtr SavedCreatePixmap;
|
||||
DestroyPixmapProcPtr SavedDestroyPixmap;
|
||||
CopyWindowProcPtr SavedCopyWindow;
|
||||
ChangeWindowAttributesProcPtr SavedChangeWindowAttributes;
|
||||
BitmapToRegionProcPtr SavedBitmapToRegion;
|
||||
|
@ -590,8 +589,7 @@ exaModifyPixmapHeader_classic(PixmapPtr pPixmap, int width, int height,
|
|||
int depth, int bitsPerPixel, int devKind,
|
||||
void *pPixData);
|
||||
|
||||
Bool
|
||||
exaDestroyPixmap_classic(PixmapPtr pPixmap);
|
||||
void exaPixmapDestroy_classic(ScreenPtr pScreen, PixmapPtr pPixmap, void *arg);
|
||||
|
||||
Bool
|
||||
exaPixmapHasGpuCopy_classic(PixmapPtr pPixmap);
|
||||
|
@ -608,8 +606,7 @@ exaModifyPixmapHeader_driver(PixmapPtr pPixmap, int width, int height,
|
|||
int depth, int bitsPerPixel, int devKind,
|
||||
void *pPixData);
|
||||
|
||||
Bool
|
||||
exaDestroyPixmap_driver(PixmapPtr pPixmap);
|
||||
void exaPixmapDestroy_driver(ScreenPtr pScreen, PixmapPtr pPixmap, void *arg);
|
||||
|
||||
Bool
|
||||
exaPixmapHasGpuCopy_driver(PixmapPtr pPixmap);
|
||||
|
@ -625,8 +622,7 @@ Bool
|
|||
exaModifyPixmapHeader_mixed(PixmapPtr pPixmap, int width, int height, int depth,
|
||||
int bitsPerPixel, int devKind, void *pPixData);
|
||||
|
||||
Bool
|
||||
exaDestroyPixmap_mixed(PixmapPtr pPixmap);
|
||||
void exaPixmapDestroy_mixed(ScreenPtr pScreen, PixmapPtr pPixmap, void *arg);
|
||||
|
||||
Bool
|
||||
exaPixmapHasGpuCopy_mixed(PixmapPtr pPixmap);
|
||||
|
|
Loading…
Reference in New Issue