xvmc: use CloseScreen hook

Wrapping ScreenRec's function pointers is problematic for many reasons,
so use the new screen close notify hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult 2025-04-30 10:30:56 +02:00
parent 4d368c6be4
commit d61de13690

View File

@ -5,6 +5,7 @@
#include <X11/X.h>
#include <X11/Xproto.h>
#include "dix/screen_hooks_priv.h"
#include "Xext/xvdix_priv.h"
#include "misc.h"
@ -48,7 +49,6 @@ static RESTYPE XvMCRTSubpicture;
typedef struct {
int num_adaptors;
XvMCAdaptorPtr adaptors;
CloseScreenProcPtr CloseScreen;
char clientDriverName[DR_CLIENT_DRIVER_NAME_SIZE];
char busID[DR_BUSID_SIZE];
int major;
@ -733,16 +733,12 @@ XvMCExtensionInit(void)
extEntry->errorBase + XvMCBadSubpicture);
}
static Bool
XvMCCloseScreen(ScreenPtr pScreen)
static void XvMCScreenClose(CallbackListPtr *pcbl, ScreenPtr pScreen, void *unused)
{
XvMCScreenPtr pScreenPriv = XVMC_GET_PRIVATE(pScreen);
pScreen->CloseScreen = pScreenPriv->CloseScreen;
free(pScreenPriv);
return (*pScreen->CloseScreen) (pScreen);
dixSetPrivate(&pScreen->devPrivates, XvMCScreenKey, NULL);
dixScreenUnhookClose(pScreen, XvMCScreenClose);
}
int
@ -758,8 +754,7 @@ XvMCScreenInit(ScreenPtr pScreen, int num, XvMCAdaptorPtr pAdapt)
dixSetPrivate(&pScreen->devPrivates, XvMCScreenKey, pScreenPriv);
pScreenPriv->CloseScreen = pScreen->CloseScreen;
pScreen->CloseScreen = XvMCCloseScreen;
dixScreenHookClose(pScreen, XvMCScreenClose);
pScreenPriv->num_adaptors = num;
pScreenPriv->adaptors = pAdapt;