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
60dd47abda
commit
f39bbe58d6
16
exa/exa.c
16
exa/exa.c
|
@ -743,6 +743,11 @@ static void exaCloseScreen(CallbackListPtr *pcbl, ScreenPtr pScreen, void *unuse
|
||||||
|
|
||||||
dixScreenUnhookClose(pScreen, exaCloseScreen);
|
dixScreenUnhookClose(pScreen, exaCloseScreen);
|
||||||
|
|
||||||
|
/* doesn't matter which one actually was registered */
|
||||||
|
dixScreenUnhookPixmapDestroy(pScreen, exaPixmapDestroy_classic);
|
||||||
|
dixScreenUnhookPixmapDestroy(pScreen, exaPixmapDestroy_driver);
|
||||||
|
dixScreenUnhookPixmapDestroy(pScreen, exaPixmapDestroy_mixed);
|
||||||
|
|
||||||
if (ps && ps->Glyphs == exaGlyphs)
|
if (ps && ps->Glyphs == exaGlyphs)
|
||||||
exaGlyphsFini(pScreen);
|
exaGlyphsFini(pScreen);
|
||||||
|
|
||||||
|
@ -755,8 +760,6 @@ static void exaCloseScreen(CallbackListPtr *pcbl, ScreenPtr pScreen, void *unuse
|
||||||
unwrap(pExaScr, pScreen, GetSpans);
|
unwrap(pExaScr, pScreen, GetSpans);
|
||||||
if (pExaScr->SavedCreatePixmap)
|
if (pExaScr->SavedCreatePixmap)
|
||||||
unwrap(pExaScr, pScreen, CreatePixmap);
|
unwrap(pExaScr, pScreen, CreatePixmap);
|
||||||
if (pExaScr->SavedDestroyPixmap)
|
|
||||||
unwrap(pExaScr, pScreen, DestroyPixmap);
|
|
||||||
if (pExaScr->SavedModifyPixmapHeader)
|
if (pExaScr->SavedModifyPixmapHeader)
|
||||||
unwrap(pExaScr, pScreen, ModifyPixmapHeader);
|
unwrap(pExaScr, pScreen, ModifyPixmapHeader);
|
||||||
unwrap(pExaScr, pScreen, CopyWindow);
|
unwrap(pExaScr, pScreen, CopyWindow);
|
||||||
|
@ -958,8 +961,9 @@ exaDriverInit(ScreenPtr pScreen, ExaDriverPtr pScreenInfo)
|
||||||
}
|
}
|
||||||
if (pExaScr->info->flags & EXA_HANDLES_PIXMAPS) {
|
if (pExaScr->info->flags & EXA_HANDLES_PIXMAPS) {
|
||||||
if (pExaScr->info->flags & EXA_MIXED_PIXMAPS) {
|
if (pExaScr->info->flags & EXA_MIXED_PIXMAPS) {
|
||||||
|
dixScreenHookPixmapDestroy(pScreen, exaPixmapDestroy_mixed);
|
||||||
|
|
||||||
wrap(pExaScr, pScreen, CreatePixmap, exaCreatePixmap_mixed);
|
wrap(pExaScr, pScreen, CreatePixmap, exaCreatePixmap_mixed);
|
||||||
wrap(pExaScr, pScreen, DestroyPixmap, exaDestroyPixmap_mixed);
|
|
||||||
wrap(pExaScr, pScreen, ModifyPixmapHeader,
|
wrap(pExaScr, pScreen, ModifyPixmapHeader,
|
||||||
exaModifyPixmapHeader_mixed);
|
exaModifyPixmapHeader_mixed);
|
||||||
wrap(pExaScr, pScreen, SharePixmapBacking, exaSharePixmapBacking_mixed);
|
wrap(pExaScr, pScreen, SharePixmapBacking, exaSharePixmapBacking_mixed);
|
||||||
|
@ -972,8 +976,9 @@ exaDriverInit(ScreenPtr pScreen, ExaDriverPtr pScreenInfo)
|
||||||
pExaScr->prepare_access_reg = exaPrepareAccessReg_mixed;
|
pExaScr->prepare_access_reg = exaPrepareAccessReg_mixed;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
dixScreenHookPixmapDestroy(pScreen, exaPixmapDestroy_driver);
|
||||||
|
|
||||||
wrap(pExaScr, pScreen, CreatePixmap, exaCreatePixmap_driver);
|
wrap(pExaScr, pScreen, CreatePixmap, exaCreatePixmap_driver);
|
||||||
wrap(pExaScr, pScreen, DestroyPixmap, exaDestroyPixmap_driver);
|
|
||||||
wrap(pExaScr, pScreen, ModifyPixmapHeader,
|
wrap(pExaScr, pScreen, ModifyPixmapHeader,
|
||||||
exaModifyPixmapHeader_driver);
|
exaModifyPixmapHeader_driver);
|
||||||
pExaScr->do_migration = NULL;
|
pExaScr->do_migration = NULL;
|
||||||
|
@ -984,8 +989,9 @@ exaDriverInit(ScreenPtr pScreen, ExaDriverPtr pScreenInfo)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
dixScreenHookPixmapDestroy(pScreen, exaPixmapDestroy_classic);
|
||||||
|
|
||||||
wrap(pExaScr, pScreen, CreatePixmap, exaCreatePixmap_classic);
|
wrap(pExaScr, pScreen, CreatePixmap, exaCreatePixmap_classic);
|
||||||
wrap(pExaScr, pScreen, DestroyPixmap, exaDestroyPixmap_classic);
|
|
||||||
wrap(pExaScr, pScreen, ModifyPixmapHeader,
|
wrap(pExaScr, pScreen, ModifyPixmapHeader,
|
||||||
exaModifyPixmapHeader_classic);
|
exaModifyPixmapHeader_classic);
|
||||||
pExaScr->do_migration = exaDoMigration_classic;
|
pExaScr->do_migration = exaDoMigration_classic;
|
||||||
|
|
|
@ -206,18 +206,11 @@ exaModifyPixmapHeader_classic(PixmapPtr pPixmap, int width, int height,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
Bool
|
void exaPixmapDestroy_classic(CallbackListPtr *pcbl, ScreenPtr pScreen, PixmapPtr pPixmap)
|
||||||
exaDestroyPixmap_classic(PixmapPtr pPixmap)
|
|
||||||
{
|
{
|
||||||
ScreenPtr pScreen = pPixmap->drawable.pScreen;
|
|
||||||
|
|
||||||
ExaScreenPriv(pScreen);
|
|
||||||
Bool ret = TRUE;
|
|
||||||
|
|
||||||
if (pPixmap->refcnt == 1) {
|
|
||||||
ExaPixmapPriv(pPixmap);
|
ExaPixmapPriv(pPixmap);
|
||||||
if (!pExaPixmap) // we're called on an error path
|
if (!pExaPixmap) // we're called on an error path
|
||||||
goto out;
|
return;
|
||||||
|
|
||||||
exaDestroyPixmap(pPixmap);
|
exaDestroyPixmap(pPixmap);
|
||||||
|
|
||||||
|
@ -233,15 +226,6 @@ exaDestroyPixmap_classic(PixmapPtr pPixmap)
|
||||||
}
|
}
|
||||||
RegionUninit(&pExaPixmap->validSys);
|
RegionUninit(&pExaPixmap->validSys);
|
||||||
RegionUninit(&pExaPixmap->validFB);
|
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
|
Bool
|
||||||
|
|
|
@ -185,33 +185,19 @@ exaModifyPixmapHeader_driver(PixmapPtr pPixmap, int width, int height,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
Bool
|
void exaPixmapDestroy_driver(CallbackListPtr *pcbl, ScreenPtr pScreen, PixmapPtr pPixmap)
|
||||||
exaDestroyPixmap_driver(PixmapPtr pPixmap)
|
|
||||||
{
|
{
|
||||||
ScreenPtr pScreen = pPixmap->drawable.pScreen;
|
|
||||||
|
|
||||||
ExaScreenPriv(pScreen);
|
ExaScreenPriv(pScreen);
|
||||||
Bool ret = TRUE;
|
|
||||||
|
|
||||||
if (pPixmap->refcnt == 1) {
|
|
||||||
ExaPixmapPriv(pPixmap);
|
ExaPixmapPriv(pPixmap);
|
||||||
if (!pExaPixmap) // we're called on an error path
|
if (!pExaPixmap) // we're called on an error path
|
||||||
goto out;
|
return;
|
||||||
|
|
||||||
exaDestroyPixmap(pPixmap);
|
exaDestroyPixmap(pPixmap);
|
||||||
|
|
||||||
if (pExaPixmap->driverPriv)
|
if (pExaPixmap->driverPriv)
|
||||||
pExaScr->info->DestroyPixmap(pScreen, pExaPixmap->driverPriv);
|
pExaScr->info->DestroyPixmap(pScreen, pExaPixmap->driverPriv);
|
||||||
pExaPixmap->driverPriv = NULL;
|
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
|
Bool
|
||||||
|
|
|
@ -239,18 +239,13 @@ exaModifyPixmapHeader_mixed(PixmapPtr pPixmap, int width, int height, int depth,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
Bool
|
void exaPixmapDestroy_mixed(CallbackListPtr *pcbl, ScreenPtr pScreen, PixmapPtr pPixmap)
|
||||||
exaDestroyPixmap_mixed(PixmapPtr pPixmap)
|
|
||||||
{
|
{
|
||||||
ScreenPtr pScreen = pPixmap->drawable.pScreen;
|
|
||||||
|
|
||||||
ExaScreenPriv(pScreen);
|
ExaScreenPriv(pScreen);
|
||||||
Bool ret = TRUE;
|
|
||||||
|
|
||||||
if (pPixmap->refcnt == 1) {
|
|
||||||
ExaPixmapPriv(pPixmap);
|
ExaPixmapPriv(pPixmap);
|
||||||
if (!pExaPixmap)
|
if (!pExaPixmap) // we're called on an error path
|
||||||
goto out; // we're called on an error path
|
return;
|
||||||
|
|
||||||
exaDestroyPixmap(pPixmap);
|
exaDestroyPixmap(pPixmap);
|
||||||
|
|
||||||
|
@ -266,15 +261,6 @@ exaDestroyPixmap_mixed(PixmapPtr pPixmap)
|
||||||
pExaPixmap->sys_ptr = NULL;
|
pExaPixmap->sys_ptr = NULL;
|
||||||
pExaPixmap->pDamage = 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
|
Bool
|
||||||
|
|
|
@ -155,7 +155,6 @@ typedef struct {
|
||||||
GetImageProcPtr SavedGetImage;
|
GetImageProcPtr SavedGetImage;
|
||||||
GetSpansProcPtr SavedGetSpans;
|
GetSpansProcPtr SavedGetSpans;
|
||||||
CreatePixmapProcPtr SavedCreatePixmap;
|
CreatePixmapProcPtr SavedCreatePixmap;
|
||||||
DestroyPixmapProcPtr SavedDestroyPixmap;
|
|
||||||
CopyWindowProcPtr SavedCopyWindow;
|
CopyWindowProcPtr SavedCopyWindow;
|
||||||
ChangeWindowAttributesProcPtr SavedChangeWindowAttributes;
|
ChangeWindowAttributesProcPtr SavedChangeWindowAttributes;
|
||||||
BitmapToRegionProcPtr SavedBitmapToRegion;
|
BitmapToRegionProcPtr SavedBitmapToRegion;
|
||||||
|
@ -589,8 +588,7 @@ exaModifyPixmapHeader_classic(PixmapPtr pPixmap, int width, int height,
|
||||||
int depth, int bitsPerPixel, int devKind,
|
int depth, int bitsPerPixel, int devKind,
|
||||||
void *pPixData);
|
void *pPixData);
|
||||||
|
|
||||||
Bool
|
void exaPixmapDestroy_classic(CallbackListPtr *pcbl, ScreenPtr pScreen, PixmapPtr pPixmap);
|
||||||
exaDestroyPixmap_classic(PixmapPtr pPixmap);
|
|
||||||
|
|
||||||
Bool
|
Bool
|
||||||
exaPixmapHasGpuCopy_classic(PixmapPtr pPixmap);
|
exaPixmapHasGpuCopy_classic(PixmapPtr pPixmap);
|
||||||
|
@ -607,8 +605,7 @@ exaModifyPixmapHeader_driver(PixmapPtr pPixmap, int width, int height,
|
||||||
int depth, int bitsPerPixel, int devKind,
|
int depth, int bitsPerPixel, int devKind,
|
||||||
void *pPixData);
|
void *pPixData);
|
||||||
|
|
||||||
Bool
|
void exaPixmapDestroy_driver(CallbackListPtr *pcbl, ScreenPtr pScreen, PixmapPtr pPixmap);
|
||||||
exaDestroyPixmap_driver(PixmapPtr pPixmap);
|
|
||||||
|
|
||||||
Bool
|
Bool
|
||||||
exaPixmapHasGpuCopy_driver(PixmapPtr pPixmap);
|
exaPixmapHasGpuCopy_driver(PixmapPtr pPixmap);
|
||||||
|
@ -624,8 +621,7 @@ Bool
|
||||||
exaModifyPixmapHeader_mixed(PixmapPtr pPixmap, int width, int height, int depth,
|
exaModifyPixmapHeader_mixed(PixmapPtr pPixmap, int width, int height, int depth,
|
||||||
int bitsPerPixel, int devKind, void *pPixData);
|
int bitsPerPixel, int devKind, void *pPixData);
|
||||||
|
|
||||||
Bool
|
void exaPixmapDestroy_mixed(CallbackListPtr *pcbl, ScreenPtr pScreen, PixmapPtr pPixmap);
|
||||||
exaDestroyPixmap_mixed(PixmapPtr pPixmap);
|
|
||||||
|
|
||||||
Bool
|
Bool
|
||||||
exaPixmapHasGpuCopy_mixed(PixmapPtr pPixmap);
|
exaPixmapHasGpuCopy_mixed(PixmapPtr pPixmap);
|
||||||
|
|
Loading…
Reference in New Issue