summaryrefslogtreecommitdiff
path: root/xserver/hw/xfree86/common/xf86xv.c
diff options
context:
space:
mode:
Diffstat (limited to 'xserver/hw/xfree86/common/xf86xv.c')
-rw-r--r--xserver/hw/xfree86/common/xf86xv.c59
1 files changed, 25 insertions, 34 deletions
diff --git a/xserver/hw/xfree86/common/xf86xv.c b/xserver/hw/xfree86/common/xf86xv.c
index 88e2f314b..92d0f6da2 100644
--- a/xserver/hw/xfree86/common/xf86xv.c
+++ b/xserver/hw/xfree86/common/xf86xv.c
@@ -51,13 +51,12 @@
#include <X11/extensions/Xv.h>
#include <X11/extensions/Xvproto.h>
#include "xvdix.h"
-#include "xvmodproc.h"
#include "xf86xvpriv.h"
/* XvScreenRec fields */
-static Bool xf86XVCloseScreen(int, ScreenPtr);
+static Bool xf86XVCloseScreen(ScreenPtr);
static int xf86XVQueryAdaptors(ScreenPtr, XvAdaptorPtr *, int *);
/* XvAdaptorRec fields */
@@ -101,9 +100,9 @@ static void xf86XVClipNotify(WindowPtr pWin, int dx, int dy);
/* ScrnInfoRec functions */
-static Bool xf86XVEnterVT(int, int);
-static void xf86XVLeaveVT(int, int);
-static void xf86XVAdjustFrame(int index, int x, int y, int flags);
+static Bool xf86XVEnterVT(ScrnInfoPtr);
+static void xf86XVLeaveVT(ScrnInfoPtr);
+static void xf86XVAdjustFrame(ScrnInfoPtr, int x, int y);
static void xf86XVModeSet(ScrnInfoPtr pScrn);
/* misc */
@@ -118,10 +117,6 @@ DevPrivateKey XF86XvScreenKey;
static unsigned long PortResource = 0;
-DevPrivateKey (*XvGetScreenKeyProc) (void) = NULL;
-unsigned long (*XvGetRTPortProc) (void) = NULL;
-int (*XvScreenInitProc) (ScreenPtr) = NULL;
-
#define GET_XV_SCREEN(pScreen) \
((XvScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, XF86XvScreenKey))
@@ -239,19 +234,18 @@ xf86XVScreenInit(ScreenPtr pScreen, XF86VideoAdaptorPtr * adaptors, int num)
XF86XVScreenPtr ScreenPriv;
XvScreenPtr pxvs;
- if (num <= 0 ||
- !XvGetScreenKeyProc || !XvGetRTPortProc || !XvScreenInitProc)
+ if (num <= 0 || noXvExtension)
return FALSE;
- if (Success != (*XvScreenInitProc) (pScreen))
+ if (Success != XvScreenInit(pScreen))
return FALSE;
if (!dixRegisterPrivateKey(&XF86XVWindowKeyRec, PRIVATE_WINDOW, 0))
return FALSE;
- XF86XvScreenKey = (*XvGetScreenKeyProc) ();
+ XF86XvScreenKey = XvGetScreenKey();
- PortResource = (*XvGetRTPortProc) ();
+ PortResource = XvGetRTPort();
pxvs = GET_XV_SCREEN(pScreen);
@@ -272,7 +266,7 @@ xf86XVScreenInit(ScreenPtr pScreen, XF86VideoAdaptorPtr * adaptors, int num)
if (!ScreenPriv)
return FALSE;
- pScrn = xf86Screens[pScreen->myNum];
+ pScrn = xf86ScreenToScrn(pScreen);
ScreenPriv->DestroyWindow = pScreen->DestroyWindow;
ScreenPriv->WindowExposures = pScreen->WindowExposures;
@@ -357,7 +351,7 @@ static Bool
xf86XVInitAdaptors(ScreenPtr pScreen, XF86VideoAdaptorPtr * infoPtr, int number)
{
XvScreenPtr pxvs = GET_XV_SCREEN(pScreen);
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
XF86VideoAdaptorPtr adaptorPtr;
XvAdaptorPtr pAdaptor, pa;
XvAdaptorRecPrivatePtr adaptorPriv;
@@ -1067,7 +1061,7 @@ xf86XVReputOrStopPort(XvPortRecPrivatePtr pPriv, WindowPtr pWin, Bool visible)
static void
xf86XVReputOrStopAllPorts(ScrnInfoPtr pScrn, Bool onlyChanged)
{
- ScreenPtr pScreen = pScrn->pScreen;
+ ScreenPtr pScreen = xf86ScrnToScreen(pScrn);
XvScreenPtr pxvs = GET_XV_SCREEN(pScreen);
XvAdaptorPtr pa;
int c, i;
@@ -1151,7 +1145,7 @@ xf86XVPostValidateTree(WindowPtr pWin, WindowPtr pLayerWin, VTKind kind)
pScreen = pLayerWin->drawable.pScreen;
ScreenPriv = GET_XF86XV_SCREEN(pScreen);
- pScrn = xf86Screens[pScreen->myNum];
+ pScrn = xf86ScreenToScrn(pScreen);
xf86XVReputOrStopAllPorts(pScrn, TRUE);
@@ -1256,9 +1250,9 @@ xf86XVClipNotify(WindowPtr pWin, int dx, int dy)
/**** Required XvScreenRec fields ****/
static Bool
-xf86XVCloseScreen(int i, ScreenPtr pScreen)
+xf86XVCloseScreen(ScreenPtr pScreen)
{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
XvScreenPtr pxvs = GET_XV_SCREEN(pScreen);
XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen);
XvAdaptorPtr pa;
@@ -1300,15 +1294,14 @@ xf86XVQueryAdaptors(ScreenPtr pScreen,
/**** ScrnInfoRec fields ****/
static Bool
-xf86XVEnterVT(int index, int flags)
+xf86XVEnterVT(ScrnInfoPtr pScrn)
{
- ScrnInfoPtr pScrn = xf86Screens[index];
- ScreenPtr pScreen = screenInfo.screens[index];
+ ScreenPtr pScreen = xf86ScrnToScreen(pScrn);
XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen);
Bool ret;
pScrn->EnterVT = ScreenPriv->EnterVT;
- ret = (*ScreenPriv->EnterVT) (index, flags);
+ ret = (*ScreenPriv->EnterVT) (pScrn);
ScreenPriv->EnterVT = pScrn->EnterVT;
pScrn->EnterVT = xf86XVEnterVT;
@@ -1319,10 +1312,9 @@ xf86XVEnterVT(int index, int flags)
}
static void
-xf86XVLeaveVT(int index, int flags)
+xf86XVLeaveVT(ScrnInfoPtr pScrn)
{
- ScrnInfoPtr pScrn = xf86Screens[index];
- ScreenPtr pScreen = screenInfo.screens[index];
+ ScreenPtr pScreen = xf86ScrnToScreen(pScrn);
XvScreenPtr pxvs = GET_XV_SCREEN(pScreen);
XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen);
XvAdaptorPtr pAdaptor;
@@ -1354,21 +1346,20 @@ xf86XVLeaveVT(int index, int flags)
}
pScrn->LeaveVT = ScreenPriv->LeaveVT;
- (*ScreenPriv->LeaveVT) (index, flags);
+ (*ScreenPriv->LeaveVT) (pScrn);
ScreenPriv->LeaveVT = pScrn->LeaveVT;
pScrn->LeaveVT = xf86XVLeaveVT;
}
static void
-xf86XVAdjustFrame(int index, int x, int y, int flags)
+xf86XVAdjustFrame(ScrnInfoPtr pScrn, int x, int y)
{
- ScrnInfoPtr pScrn = xf86Screens[index];
- ScreenPtr pScreen = pScrn->pScreen;
+ ScreenPtr pScreen = xf86ScrnToScreen(pScrn);
XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen);
if (ScreenPriv->AdjustFrame) {
pScrn->AdjustFrame = ScreenPriv->AdjustFrame;
- (*pScrn->AdjustFrame) (index, x, y, flags);
+ (*pScrn->AdjustFrame) (pScrn, x, y);
pScrn->AdjustFrame = xf86XVAdjustFrame;
}
@@ -1378,7 +1369,7 @@ xf86XVAdjustFrame(int index, int x, int y, int flags)
static void
xf86XVModeSet(ScrnInfoPtr pScrn)
{
- ScreenPtr pScreen = pScrn->pScreen;
+ ScreenPtr pScreen = xf86ScrnToScreen(pScrn);
XF86XVScreenPtr ScreenPriv;
/* Can be called before pScrn->pScreen is set */
@@ -1900,7 +1891,7 @@ xf86XVFillKeyHelperDrawable(DrawablePtr pDraw, CARD32 key, RegionPtr fillboxes)
xRectangle *rects;
GCPtr gc;
- if (!xf86Screens[pScreen->myNum]->vtSema)
+ if (!xf86ScreenToScrn(pScreen)->vtSema)
return;
gc = GetScratchGC(pDraw->depth, pScreen);