xv: use window destructor hook

Wrapping ScreenRec's function pointers is problematic for many reasons,
so use the new window destructor hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult 2024-09-20 17:56:03 +02:00
parent c335d5a92e
commit f208c7a971
2 changed files with 11 additions and 21 deletions

View File

@ -173,7 +173,6 @@ typedef struct {
int version, revision;
int nAdaptors;
XvAdaptorPtr pAdaptors;
DestroyWindowProcPtr DestroyWindow;
DestroyPixmapProcPtr DestroyPixmap;
CloseScreenProcPtr CloseScreen;
} XvScreenRec, *XvScreenPtr;

View File

@ -81,6 +81,7 @@ SOFTWARE.
#include <X11/extensions/Xv.h>
#include <X11/extensions/Xvproto.h>
#include "dix/screen_hooks_priv.h"
#include "Xext/xvdix_priv.h"
#include "misc.h"
@ -143,7 +144,6 @@ static Bool CreateResourceTypes(void);
static Bool XvCloseScreen(ScreenPtr);
static Bool XvDestroyPixmap(PixmapPtr);
static Bool XvDestroyWindow(WindowPtr);
static void XvResetProc(ExtensionEntry *);
static int XvdiDestroyGrab(void *, XID);
static int XvdiDestroyEncoding(void *, XID);
@ -152,6 +152,7 @@ static int XvdiDestroyPortNotify(void *, XID);
static int XvdiDestroyVideoNotifyList(void *, XID);
static int XvdiDestroyPort(void *, XID);
static int XvdiSendVideoNotify(XvPortPtr, DrawablePtr, int);
static void XvStopAdaptors(DrawablePtr pDrawable);
/*
** XvExtensionInit
@ -257,6 +258,11 @@ CreateResourceTypes(void)
}
static void XvWindowDestroy(CallbackListPtr *pcbl, ScreenPtr pScreen, WindowPtr pWin)
{
XvStopAdaptors(&pWin->drawable);
}
int
XvScreenInit(ScreenPtr pScreen)
{
@ -291,11 +297,11 @@ XvScreenInit(ScreenPtr pScreen)
dixSetPrivate(&pScreen->devPrivates, XvScreenKey, pxvs);
pxvs->DestroyPixmap = pScreen->DestroyPixmap;
pxvs->DestroyWindow = pScreen->DestroyWindow;
pxvs->CloseScreen = pScreen->CloseScreen;
dixScreenHookWindowDestroy(pScreen, XvWindowDestroy);
pScreen->DestroyPixmap = XvDestroyPixmap;
pScreen->DestroyWindow = XvDestroyWindow;
pScreen->CloseScreen = XvCloseScreen;
return Success;
@ -304,13 +310,13 @@ XvScreenInit(ScreenPtr pScreen)
static Bool
XvCloseScreen(ScreenPtr pScreen)
{
XvScreenPtr pxvs;
pxvs = (XvScreenPtr) dixLookupPrivate(&pScreen->devPrivates, XvScreenKey);
dixScreenUnhookWindowDestroy(pScreen, XvWindowDestroy);
pScreen->DestroyPixmap = pxvs->DestroyPixmap;
pScreen->DestroyWindow = pxvs->DestroyWindow;
pScreen->CloseScreen = pxvs->CloseScreen;
free(pxvs);
@ -385,21 +391,6 @@ XvDestroyPixmap(PixmapPtr pPix)
}
static Bool
XvDestroyWindow(WindowPtr pWin)
{
ScreenPtr pScreen = pWin->drawable.pScreen;
Bool status;
XvStopAdaptors(&pWin->drawable);
SCREEN_PROLOGUE(pScreen, DestroyWindow);
status = (*pScreen->DestroyWindow) (pWin);
SCREEN_EPILOGUE(pScreen, DestroyWindow, XvDestroyWindow);
return status;
}
static int
XvdiDestroyPort(void *pPort, XID id)