xv: Move CloseScreen setup from a DIX hook to normal wrapping.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
Eric Anholt 2014-04-04 22:58:37 +01:00
parent 6a71ee79aa
commit b01cfe5f23
6 changed files with 13 additions and 29 deletions

View File

@ -213,7 +213,6 @@ typedef struct {
DestroyWindowProcPtr DestroyWindow;
DestroyPixmapProcPtr DestroyPixmap;
CloseScreenProcPtr CloseScreen;
Bool (*ddCloseScreen) (ScreenPtr);
} XvScreenRec, *XvScreenPtr;
#define SCREEN_PROLOGUE(pScreen, field) ((pScreen)->field = ((XvScreenPtr) \

View File

@ -302,8 +302,6 @@ XvCloseScreen(ScreenPtr pScreen)
pScreen->DestroyWindow = pxvs->DestroyWindow;
pScreen->CloseScreen = pxvs->CloseScreen;
(*pxvs->ddCloseScreen) (pScreen);
free(pxvs);
dixSetPrivate(&pScreen->devPrivates, XvScreenKey, NULL);

View File

@ -56,10 +56,6 @@ of the copyright holder.
#include "kxv.h"
#include "fourcc.h"
/* XvScreenRec fields */
static Bool KdXVCloseScreen(ScreenPtr);
/* XvAdaptorRec fields */
static int KdXVAllocatePort(unsigned long, XvPortPtr, XvPortPtr *);
@ -95,6 +91,7 @@ static Bool KdXVCreateWindow(WindowPtr pWin);
static Bool KdXVDestroyWindow(WindowPtr pWin);
static void KdXVWindowExposures(WindowPtr pWin, RegionPtr r1, RegionPtr r2);
static void KdXVClipNotify(WindowPtr pWin, int dx, int dy);
static Bool KdXVCloseScreen(ScreenPtr);
/* misc */
static Bool KdXVInitAdaptors(ScreenPtr, KdVideoAdaptorPtr, int);
@ -132,7 +129,6 @@ Bool
KdXVScreenInit(ScreenPtr pScreen, KdVideoAdaptorPtr adaptors, int num)
{
KdXVScreenPtr ScreenPriv;
XvScreenPtr pxvs;
/* fprintf(stderr,"KdXVScreenInit initializing %d adaptors\n",num); */
@ -153,13 +149,6 @@ KdXVScreenInit(ScreenPtr pScreen, KdVideoAdaptorPtr adaptors, int num)
KdXvScreenKey = XvGetScreenKey();
PortResource = XvGetRTPort();
pxvs = GET_XV_SCREEN(pScreen);
/* Anyone initializing the Xv layer must provide this.
The Xv di layer calls it without even checking if it exists! */
pxvs->ddCloseScreen = KdXVCloseScreen;
ScreenPriv = malloc(sizeof(KdXVScreenRec));
dixSetPrivate(&pScreen->devPrivates, &KdXVScreenPrivateKey, ScreenPriv);
@ -170,6 +159,7 @@ KdXVScreenInit(ScreenPtr pScreen, KdVideoAdaptorPtr adaptors, int num)
ScreenPriv->DestroyWindow = pScreen->DestroyWindow;
ScreenPriv->WindowExposures = pScreen->WindowExposures;
ScreenPriv->ClipNotify = pScreen->ClipNotify;
ScreenPriv->CloseScreen = pScreen->CloseScreen;
/* fprintf(stderr,"XV: Wrapping screen funcs\n"); */
@ -177,6 +167,7 @@ KdXVScreenInit(ScreenPtr pScreen, KdVideoAdaptorPtr adaptors, int num)
pScreen->DestroyWindow = KdXVDestroyWindow;
pScreen->WindowExposures = KdXVWindowExposures;
pScreen->ClipNotify = KdXVClipNotify;
pScreen->CloseScreen = KdXVCloseScreen;
if (!KdXVInitAdaptors(pScreen, adaptors, num))
return FALSE;
@ -990,6 +981,7 @@ KdXVCloseScreen(ScreenPtr pScreen)
pScreen->DestroyWindow = ScreenPriv->DestroyWindow;
pScreen->WindowExposures = ScreenPriv->WindowExposures;
pScreen->ClipNotify = ScreenPriv->ClipNotify;
pScreen->CloseScreen = ScreenPriv->CloseScreen;
/* fprintf(stderr,"XV: Unwrapping screen funcs\n"); */
@ -1000,7 +992,7 @@ KdXVCloseScreen(ScreenPtr pScreen)
free(pxvs->pAdaptors);
free(ScreenPriv);
return TRUE;
return pScreen->CloseScreen(pScreen);
}
static Bool

View File

@ -188,6 +188,7 @@ typedef struct {
DestroyWindowProcPtr DestroyWindow;
ClipNotifyProcPtr ClipNotify;
WindowExposuresProcPtr WindowExposures;
CloseScreenProcPtr CloseScreen;
} KdXVScreenRec, *KdXVScreenPtr;
typedef struct {

View File

@ -54,10 +54,6 @@
#include "xf86xvpriv.h"
/* XvScreenRec fields */
static Bool xf86XVCloseScreen(ScreenPtr);
/* XvAdaptorRec fields */
static int xf86XVAllocatePort(unsigned long, XvPortPtr, XvPortPtr *);
@ -94,6 +90,7 @@ static void xf86XVWindowExposures(WindowPtr pWin, RegionPtr r1, RegionPtr r2);
static void xf86XVPostValidateTree(WindowPtr pWin, WindowPtr pLayerWin,
VTKind kind);
static void xf86XVClipNotify(WindowPtr pWin, int dx, int dy);
static Bool xf86XVCloseScreen(ScreenPtr);
#define PostValidateTreeUndefined ((PostValidateTreeProcPtr)-1)
@ -234,7 +231,6 @@ xf86XVScreenInit(ScreenPtr pScreen, XF86VideoAdaptorPtr * adaptors, int num)
{
ScrnInfoPtr pScrn;
XF86XVScreenPtr ScreenPriv;
XvScreenPtr pxvs;
if (num <= 0 || noXvExtension)
return FALSE;
@ -251,13 +247,6 @@ xf86XVScreenInit(ScreenPtr pScreen, XF86VideoAdaptorPtr * adaptors, int num)
PortResource = XvGetRTPort();
pxvs = GET_XV_SCREEN(pScreen);
/* Anyone initializing the Xv layer must provide this.
The Xv di layer calls it without even checking if it exists! */
pxvs->ddCloseScreen = xf86XVCloseScreen;
ScreenPriv = malloc(sizeof(XF86XVScreenRec));
dixSetPrivate(&pScreen->devPrivates, &XF86XVScreenPrivateKey, ScreenPriv);
@ -270,6 +259,7 @@ xf86XVScreenInit(ScreenPtr pScreen, XF86VideoAdaptorPtr * adaptors, int num)
ScreenPriv->WindowExposures = pScreen->WindowExposures;
ScreenPriv->PostValidateTree = PostValidateTreeUndefined;
ScreenPriv->ClipNotify = pScreen->ClipNotify;
ScreenPriv->CloseScreen = pScreen->CloseScreen;
ScreenPriv->EnterVT = pScrn->EnterVT;
ScreenPriv->LeaveVT = pScrn->LeaveVT;
ScreenPriv->AdjustFrame = pScrn->AdjustFrame;
@ -278,6 +268,7 @@ xf86XVScreenInit(ScreenPtr pScreen, XF86VideoAdaptorPtr * adaptors, int num)
pScreen->DestroyWindow = xf86XVDestroyWindow;
pScreen->WindowExposures = xf86XVWindowExposures;
pScreen->ClipNotify = xf86XVClipNotify;
pScreen->CloseScreen = xf86XVCloseScreen;
pScrn->EnterVT = xf86XVEnterVT;
pScrn->LeaveVT = xf86XVLeaveVT;
if (pScrn->AdjustFrame)
@ -1168,6 +1159,7 @@ xf86XVCloseScreen(ScreenPtr pScreen)
pScreen->DestroyWindow = ScreenPriv->DestroyWindow;
pScreen->WindowExposures = ScreenPriv->WindowExposures;
pScreen->ClipNotify = ScreenPriv->ClipNotify;
pScreen->CloseScreen = ScreenPriv->CloseScreen;
pScrn->EnterVT = ScreenPriv->EnterVT;
pScrn->LeaveVT = ScreenPriv->LeaveVT;
@ -1180,7 +1172,8 @@ xf86XVCloseScreen(ScreenPtr pScreen)
free(pxvs->pAdaptors);
free(ScreenPriv);
return TRUE;
return pScreen->CloseScreen(pScreen);
}
/**** ScrnInfoRec fields ****/

View File

@ -45,6 +45,7 @@ typedef struct {
Bool (*EnterVT) (ScrnInfoPtr);
void (*LeaveVT) (ScrnInfoPtr);
xf86ModeSetProc *ModeSet;
CloseScreenProcPtr CloseScreen;
} XF86XVScreenRec, *XF86XVScreenPtr;
typedef struct {