summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2012-08-07 09:14:39 +1000
committerDave Airlie <airlied@redhat.com>2012-08-07 09:18:12 +1000
commit5cebdabdaa66a8e512a73fa16f30521457079b28 (patch)
tree61d258f3e19b2cbfd5a3f5d58666b154600065bf
parenteaaf5dd373ab36491ac719f1408f1f4e2f7eb4f4 (diff)
xgi: convert to new server compat API
Signed-off-by: Dave Airlie <airlied@redhat.com>
-rw-r--r--src/Makefile.am1
-rw-r--r--src/compat-api.h99
-rwxr-xr-xsrc/xgi.h2
-rwxr-xr-xsrc/xgi_accel.c26
-rwxr-xr-xsrc/xgi_cursor.c6
-rwxr-xr-xsrc/xgi_dga.c12
-rwxr-xr-xsrc/xgi_dri.c18
-rwxr-xr-xsrc/xgi_driver.c66
-rwxr-xr-xsrc/xgi_driver.h14
-rwxr-xr-xsrc/xgi_memcpy.c2
-rwxr-xr-xsrc/xgi_video.c4
11 files changed, 177 insertions, 73 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 505f4c1..54b0daf 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -29,6 +29,7 @@ xgi_drv_la_LDFLAGS = -module -avoid-version
xgi_drv_ladir = @moduledir@/drivers
xgi_drv_la_SOURCES = \
+ compat-api.h\
init.c \
init.h \
osdef.h \
diff --git a/src/compat-api.h b/src/compat-api.h
new file mode 100644
index 0000000..6bc946f
--- /dev/null
+++ b/src/compat-api.h
@@ -0,0 +1,99 @@
+/*
+ * Copyright 2012 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Author: Dave Airlie <airlied@redhat.com>
+ */
+
+/* this file provides API compat between server post 1.13 and pre it,
+ it should be reused inside as many drivers as possible */
+#ifndef COMPAT_API_H
+#define COMPAT_API_H
+
+#ifndef GLYPH_HAS_GLYPH_PICTURE_ACCESSOR
+#define GetGlyphPicture(g, s) GlyphPicture((g))[(s)->myNum]
+#define SetGlyphPicture(g, s, p) GlyphPicture((g))[(s)->myNum] = p
+#endif
+
+#ifndef XF86_HAS_SCRN_CONV
+#define xf86ScreenToScrn(s) xf86Screens[(s)->myNum]
+#define xf86ScrnToScreen(s) screenInfo.screens[(s)->scrnIndex]
+#endif
+
+#ifndef XF86_SCRN_INTERFACE
+
+#define SCRN_ARG_TYPE int
+#define SCRN_INFO_PTR(arg1) ScrnInfoPtr pScrn = xf86Screens[(arg1)]
+
+#define SCREEN_ARG_TYPE int
+#define SCREEN_PTR(arg1) ScreenPtr pScreen = screenInfo.screens[(arg1)]
+
+#define SCREEN_INIT_ARGS_DECL int i, ScreenPtr pScreen, int argc, char **argv
+
+#define BLOCKHANDLER_ARGS_DECL int arg, pointer blockData, pointer pTimeout, pointer pReadmask
+#define BLOCKHANDLER_ARGS arg, blockData, pTimeout, pReadmask
+
+#define CLOSE_SCREEN_ARGS_DECL int scrnIndex, ScreenPtr pScreen
+#define CLOSE_SCREEN_ARGS scrnIndex, pScreen
+
+#define ADJUST_FRAME_ARGS_DECL int arg, int x, int y, int flags
+#define ADJUST_FRAME_ARGS(arg, x, y) (arg)->scrnIndex, x, y, 0
+
+#define SWITCH_MODE_ARGS_DECL int arg, DisplayModePtr mode, int flags
+#define SWITCH_MODE_ARGS(arg, m) (arg)->scrnIndex, m, 0
+
+#define FREE_SCREEN_ARGS_DECL int arg, int flags
+
+#define VT_FUNC_ARGS_DECL int arg, int flags
+#define VT_FUNC_ARGS pScrn->scrnIndex, 0
+
+#define XF86_SCRN_ARG(x) ((x)->scrnIndex)
+#else
+#define SCRN_ARG_TYPE ScrnInfoPtr
+#define SCRN_INFO_PTR(arg1) ScrnInfoPtr pScrn = (arg1)
+
+#define SCREEN_ARG_TYPE ScreenPtr
+#define SCREEN_PTR(arg1) ScreenPtr pScreen = (arg1)
+
+#define SCREEN_INIT_ARGS_DECL ScreenPtr pScreen, int argc, char **argv
+
+#define BLOCKHANDLER_ARGS_DECL ScreenPtr arg, pointer pTimeout, pointer pReadmask
+#define BLOCKHANDLER_ARGS arg, pTimeout, pReadmask
+
+#define CLOSE_SCREEN_ARGS_DECL ScreenPtr pScreen
+#define CLOSE_SCREEN_ARGS pScreen
+
+#define ADJUST_FRAME_ARGS_DECL ScrnInfoPtr arg, int x, int y
+#define ADJUST_FRAME_ARGS(arg, x, y) arg, x, y
+
+#define SWITCH_MODE_ARGS_DECL ScrnInfoPtr arg, DisplayModePtr mode
+#define SWITCH_MODE_ARGS(arg, m) arg, m
+
+#define FREE_SCREEN_ARGS_DECL ScrnInfoPtr arg
+
+#define VT_FUNC_ARGS_DECL ScrnInfoPtr arg
+#define VT_FUNC_ARGS pScrn
+
+#define XF86_SCRN_ARG(x) (x)
+
+#endif
+
+#endif
diff --git a/src/xgi.h b/src/xgi.h
index 9181f25..0bc8d30 100755
--- a/src/xgi.h
+++ b/src/xgi.h
@@ -196,6 +196,8 @@ extern BOOL g_bRunTimeDebug;
#include "vgatypes.h"
#include "vb_struct.h"
+#include "compat-api.h"
+
#ifdef XF86DRI
#define XGINEWDRI
#undef XGINEWDRI2
diff --git a/src/xgi_accel.c b/src/xgi_accel.c
index 5a6f91d..8392628 100755
--- a/src/xgi_accel.c
+++ b/src/xgi_accel.c
@@ -626,7 +626,7 @@ Volari_AccelInit(ScreenPtr pScreen)
XAAInfoRecPtr infoPtr;
#endif
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
XGIPtr pXGI = XGIPTR(pScrn);
int reservedFbSize;
long UsableFbSize;
@@ -1232,7 +1232,7 @@ Volari_SubsequentMonoPatternFill(ScrnInfoPtr pScrn,
#ifdef XGI_USE_EXA /* ---------------------------- EXA -------------------------- */
void XGIEXASync(ScreenPtr pScreen, int marker)
{
- XGIPtr pXGI = XGIPTR(xf86Screens[pScreen->myNum]);
+ XGIPtr pXGI = XGIPTR(xf86ScreenToScrn(pScreen));
PACCELDEBUG(ErrorF("XGIEXASync()...\n"));
@@ -1242,7 +1242,7 @@ void XGIEXASync(ScreenPtr pScreen, int marker)
static Bool
XGIPrepareSolid(PixmapPtr pPixmap, int alu, Pixel planemask, Pixel fg)
{
- ScrnInfoPtr pScrn = xf86Screens[pPixmap->drawable.pScreen->myNum];
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pPixmap->drawable.pScreen);
XGIPtr pXGI = XGIPTR(pScrn);
CARD16 pitch;
@@ -1287,7 +1287,7 @@ XGIPrepareSolid(PixmapPtr pPixmap, int alu, Pixel planemask, Pixel fg)
static void
XGISolid(PixmapPtr pPixmap, int x1, int y1, int x2, int y2)
{
- ScrnInfoPtr pScrn = xf86Screens[pPixmap->drawable.pScreen->myNum];
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pPixmap->drawable.pScreen);
XGIPtr pXGI = XGIPTR(pScrn);
CARD32 Command;
@@ -1311,7 +1311,7 @@ static Bool
XGIPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir, int ydir,
int alu, Pixel planemask)
{
- ScrnInfoPtr pScrn = xf86Screens[pDstPixmap->drawable.pScreen->myNum];
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pDstPixmap->drawable.pScreen);
XGIPtr pXGI = XGIPTR(pScrn);
CARD32 srcbase, dstbase;
CARD16 srcpitch, dstpitch;
@@ -1371,7 +1371,7 @@ XGIPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir, int ydir,
static void
XGICopy(PixmapPtr pDstPixmap, int srcX, int srcY, int dstX, int dstY, int width, int height)
{
- ScrnInfoPtr pScrn = xf86Screens[pDstPixmap->drawable.pScreen->myNum];
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pDstPixmap->drawable.pScreen);
XGIPtr pXGI = XGIPTR(pScrn);
CARD32 Command;
@@ -1398,7 +1398,7 @@ static Bool
XGICheckComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture,
PicturePtr pDstPicture)
{
- ScrnInfoPtr pScrn = xf86Screens[pDstPicture->pDrawable->pScreen->myNum];
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pDstPicture->pDrawable->pScreen);
XGIPtr pXGI = XGIPTR(pScrn);
PACCELDEBUG(ErrorF("XGICheckComposite()...\n"));
@@ -1424,7 +1424,7 @@ static Bool
XGIPrepareComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture,
PicturePtr pDstPicture, PixmapPtr pSrc, PixmapPtr pMask, PixmapPtr pDst)
{
- ScrnInfoPtr pScrn = xf86Screens[pDst->drawable.pScreen->myNum];
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pDst->drawable.pScreen);
XGIPtr pXGI = XGIPTR(pScrn);
PACCELDEBUG(ErrorF("XGIPrepareComposite()...\n"));
@@ -1439,7 +1439,7 @@ static void
XGIComposite(PixmapPtr pDst, int srcX, int srcY, int maskX, int maskY, int dstX, int dstY,
int width, int height)
{
- ScrnInfoPtr pScrn = xf86Screens[pDst->drawable.pScreen->myNum];
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pDst->drawable.pScreen);
XGIPtr pXGI = XGIPTR(pScrn);
PACCELDEBUG(ErrorF("XGIComposite()...\n"));
@@ -1534,7 +1534,7 @@ void XGIMemCopyFromVideoRam(XGIPtr pXGI, unsigned char *to, unsigned char *from,
Bool
XGIUploadToScreen(PixmapPtr pDst, int x, int y, int w, int h, char *src, int src_pitch)
{
- ScrnInfoPtr pScrn = xf86Screens[pDst->drawable.pScreen->myNum];
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pDst->drawable.pScreen);
XGIPtr pXGI = XGIPTR(pScrn);
unsigned char *dst = pDst->devPrivate.ptr;
int dst_pitch = exaGetPixmapPitch(pDst);
@@ -1587,7 +1587,7 @@ XGIUploadToScreen(PixmapPtr pDst, int x, int y, int w, int h, char *src, int src
Bool
XGIUploadToScratch(PixmapPtr pSrc, PixmapPtr pDst)
{
- ScrnInfoPtr pScrn = xf86Screens[pSrc->drawable.pScreen->myNum];
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pSrc->drawable.pScreen);
XGIPtr pXGI = XGIPTR(pScrn);
unsigned char *src, *dst;
int src_pitch = exaGetPixmapPitch(pSrc);
@@ -1665,7 +1665,7 @@ XGIUploadToScratch(PixmapPtr pSrc, PixmapPtr pDst)
Bool
XGIDownloadFromScreen(PixmapPtr pSrc, int x, int y, int w, int h, char *dst, int dst_pitch)
{
- ScrnInfoPtr pScrn = xf86Screens[pSrc->drawable.pScreen->myNum];
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pSrc->drawable.pScreen);
XGIPtr pXGI = XGIPTR(pScrn);
unsigned char *src = pSrc->devPrivate.ptr;
int src_pitch = exaGetPixmapPitch(pSrc);
@@ -1708,7 +1708,7 @@ XGIDownloadFromScreen(PixmapPtr pSrc, int x, int y, int w, int h, char *dst, int
void XGIScratchSave(ScreenPtr pScreen, ExaOffscreenArea *area)
{
- XGIPtr pXGI = XGIPTR(xf86Screens[pScreen->myNum]);
+ XGIPtr pXGI = XGIPTR(xf86ScreenToScrn(pScreen));
pXGI->exa_scratch = NULL;
}
#endif /* EXA */
diff --git a/src/xgi_cursor.c b/src/xgi_cursor.c
index 2c7fedd..55890d4 100755
--- a/src/xgi_cursor.c
+++ b/src/xgi_cursor.c
@@ -172,7 +172,7 @@ Volari_LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src)
static Bool
Volari_UseHWCursor(ScreenPtr pScreen, CursorPtr pCurs)
{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
DisplayModePtr mode = pScrn->currentMode;
if (mode->Flags & V_INTERLACE)
@@ -186,7 +186,7 @@ Volari_UseHWCursor(ScreenPtr pScreen, CursorPtr pCurs)
Bool
Volari_UseHWCursorARGB(ScreenPtr pScreen, CursorPtr pCurs)
{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
DisplayModePtr mode = pScrn->currentMode;
XGIPtr pXGI = XGIPTR(pScrn);
@@ -245,7 +245,7 @@ Volari_LoadCursorARGB(ScrnInfoPtr pScrn, CursorPtr pCursor)
Bool
XGIHWCursorInit(ScreenPtr pScreen)
{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
XGIPtr pXGI = XGIPTR(pScrn);
xf86CursorInfoPtr infoPtr;
diff --git a/src/xgi_dga.c b/src/xgi_dga.c
index 66e0319..3b798d7 100755
--- a/src/xgi_dga.c
+++ b/src/xgi_dga.c
@@ -193,7 +193,7 @@ SECOND_PASS:
Bool
XGIDGAInit(ScreenPtr pScreen)
{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
XGIPtr pXGI = XGIPTR(pScrn);
DGAModePtr modes = NULL;
int num = 0;
@@ -260,8 +260,8 @@ XGI_SetMode(
pScrn->currentMode = pXGI->CurrentLayout.mode;
- (*pScrn->SwitchMode)(index, pScrn->currentMode, 0);
- (*pScrn->AdjustFrame)(index, pScrn->frameX0, pScrn->frameY0, 0);
+ (*pScrn->SwitchMode)(SWITCH_MODE_ARGS(pScrn, pScrn->currentMode));
+ (*pScrn->AdjustFrame)(ADJUST_FRAME_ARGS(pScrn, pScrn->frameX0, pScrn->frameY0));
pXGI->DGAactive = FALSE;
} else { /* set new mode */
@@ -276,10 +276,10 @@ XGI_SetMode(
pXGI->CurrentLayout.depth = pMode->depth;
pXGI->CurrentLayout.displayWidth = pMode->bytesPerScanline / (pMode->bitsPerPixel >> 3);
- (*pScrn->SwitchMode)(index, pMode->mode, 0);
+ (*pScrn->SwitchMode)(SWITCH_MODE_ARGS(pScrn, pMode->mode));
/* TW: Adjust viewport to 0/0 after mode switch */
/* This should fix the vmware-in-dualhead problems */
- (*pScrn->AdjustFrame)(index, 0, 0, 0);
+ (*pScrn->AdjustFrame)(ADJUST_FRAME_ARGS(pScrn, 0, 0));
}
return TRUE;
@@ -297,7 +297,7 @@ XGI_GetViewport(ScrnInfoPtr pScrn)
static void
XGI_SetViewport(ScrnInfoPtr pScrn, int x, int y, int flags)
{
- (*pScrn->AdjustFrame)(pScrn->pScreen->myNum, x, y, flags);
+ (*pScrn->AdjustFrame)(ADJUST_FRAME_ARGS(pScrn, x, y));
}
static void
diff --git a/src/xgi_dri.c b/src/xgi_dri.c
index 6ad83ca..c4cbfed 100755
--- a/src/xgi_dri.c
+++ b/src/xgi_dri.c
@@ -117,7 +117,7 @@ ULONG CheckAGPSlot(ScreenPtr pScreen, ULONG uNextLink);
static Bool
XGIInitVisualConfigs(ScreenPtr pScreen)
{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
XGIPtr pXGI = XGIPTR(pScrn);
int numConfigs = 0;
__GLXvisualConfig *pConfigs = 0;
@@ -240,7 +240,7 @@ Bool XGIDRIScreenInit(ScreenPtr pScreen)
return FALSE;
#else /* linux */
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
XGIPtr pXGI = XGIPTR(pScrn);
DRIInfoPtr pDRIInfo;
XGIDRIPtr pXGIDRI;
@@ -529,7 +529,7 @@ Bool XGIDRIScreenInit(ScreenPtr pScreen)
void
XGIDRICloseScreen(ScreenPtr pScreen)
{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
XGIPtr pXGI = XGIPTR(pScrn);
DRICloseScreen(pScreen);
@@ -573,7 +573,7 @@ XGIDestroyContext(ScreenPtr pScreen, drm_context_t hwContext,
Bool
XGIDRIFinishScreenInit(ScreenPtr pScreen)
{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
XGIPtr pXGI = XGIPTR(pScrn);
/* XGIPtr pXGI = XGIPTR(pScrn); */
XGIDRIPtr pXGIDRI;
@@ -629,7 +629,7 @@ XGIDRISwapContext(ScreenPtr pScreen, DRISyncType syncType,
DRIContextType oldContextType, void *oldContext,
DRIContextType newContextType, void *newContext)
{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
XGIPtr pXGI = XGIPTR(pScrn);
/* mEndPrimitive */
@@ -649,7 +649,7 @@ static void
XGIDRIInitBuffers(WindowPtr pWin, RegionPtr prgn, CARD32 index)
{
ScreenPtr pScreen = pWin->drawable.pScreen;
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
XGIPtr pXGI = XGIPTR(pScrn);
Volari_Idle(pXGI);
@@ -660,7 +660,7 @@ XGIDRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg,
RegionPtr prgnSrc, CARD32 index)
{
ScreenPtr pScreen = pParent->drawable.pScreen;
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
XGIPtr pXGI = XGIPTR(pScrn);
Volari_Idle(pXGI);
@@ -673,7 +673,7 @@ XGIDRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg,
ULONG CheckAGPSlot(ScreenPtr pScreen, ULONG uNextLink)
{
ULONG uBuffer = 0, uLink = 0, uValue = 0 ;
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
XGIPtr pXGI = XGIPTR(pScrn);
uBuffer = pciReadLong(pXGI->PciTag, uNextLink);
@@ -699,7 +699,7 @@ ULONG CheckAGPSlot(ScreenPtr pScreen, ULONG uNextLink)
*/
ULONG IsXGIAGPCard(ScreenPtr pScreen)
{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
XGIPtr pXGI = XGIPTR(pScrn);
diff --git a/src/xgi_driver.c b/src/xgi_driver.c
index f5c2af6..79caeeb 100755
--- a/src/xgi_driver.c
+++ b/src/xgi_driver.c
@@ -4349,8 +4349,8 @@ XGIModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
}
XGIPostSetMode(pScrn, &pXGI->ModeReg);
- XGIAdjustFrame(pXGIEnt->pScrn_1->scrnIndex, pXGIEnt->pScrn_1->frameX0,
- pXGIEnt->pScrn_1->frameY0, 0);
+ XGIAdjustFrame(ADJUST_FRAME_ARGS(pXGIEnt->pScrn_1, pXGIEnt->pScrn_1->frameX0,
+ pXGIEnt->pScrn_1->frameY0));
}
else
{
@@ -4495,14 +4495,14 @@ XGIRestore(ScrnInfoPtr pScrn)
/* Our generic BlockHandler for Xv */
static void
-XGIBlockHandler(int i, pointer blockData, pointer pTimeout, pointer pReadmask)
+XGIBlockHandler(BLOCKHANDLER_ARGS_DECL)
{
- ScreenPtr pScreen = screenInfo.screens[i];
- ScrnInfoPtr pScrn = xf86Screens[i];
+ SCREEN_PTR(arg);
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
XGIPtr pXGI = XGIPTR(pScrn);
pScreen->BlockHandler = pXGI->BlockHandler;
- (*pScreen->BlockHandler) (i, blockData, pTimeout, pReadmask);
+ (*pScreen->BlockHandler) (BLOCKHANDLER_ARGS);
pScreen->BlockHandler = XGIBlockHandler;
if (pXGI->VideoTimerCallback) {
@@ -4542,7 +4542,7 @@ void xgiRestoreVirtual(ScrnInfoPtr pScrn)
* pScrn->displayWidth : memory pitch
*/
static Bool
-XGIScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
+XGIScreenInit(SCREEN_INIT_ARGS_DECL)
{
ScrnInfoPtr pScrn;
vgaHWPtr hwp;
@@ -4555,7 +4555,7 @@ XGIScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
XGIEntPtr pXGIEnt = NULL;
ErrorF("XGIScreenInit\n");
- pScrn = xf86Screens[pScreen->myNum];
+ pScrn = xf86ScreenToScrn(pScreen);
PDEBUG(ErrorF("pScrn->currentMode->HDisplay = %d\n", pScrn->currentMode->HDisplay));
PDEBUG(ErrorF("pScrn->currentMode->VDisplay = %d\n", pScrn->currentMode->VDisplay));
@@ -4689,7 +4689,8 @@ XGIScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
XGISaveScreen(pScreen, SCREEN_SAVER_ON);
/* Set the viewport */
- XGIAdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
+ XGIAdjustFrame(ADJUST_FRAME_ARGS(pScrn, pScrn->frameX0, pScrn->frameY0));
+
/* XGIAdjustFrame(scrnIndex, 0, 0, 0); */
/* xgiRestoreVirtual(pScrn); */
@@ -5011,7 +5012,7 @@ XGIScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
PDEBUG(XGIDumpRegs(pScrn));
/* xgiRestoreVirtual(); */
- XGIAdjustFrame(scrnIndex, 0, 0, 0);
+ XGIAdjustFrame(ADJUST_FRAME_ARGS(pScrn, 0, 0));
pScrn->frameX0 = 0;
pScrn->frameY0 = 0;
pScrn->frameX1 = pScrn->currentMode->HDisplay - 1 ;
@@ -5022,9 +5023,9 @@ XGIScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
/* Usually mandatory */
Bool
-XGISwitchMode(int scrnIndex, DisplayModePtr mode, int flags)
+XGISwitchMode(SWITCH_MODE_ARGS_DECL)
{
- ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ SCRN_INFO_PTR(arg);
XGIPtr pXGI = XGIPTR(pScrn);
if(pXGI->TargetRefreshRate)
@@ -5068,10 +5069,10 @@ XGISwitchMode(int scrnIndex, DisplayModePtr mode, int flags)
#if 1
/* Jong 07/29/2009; Set the viewport; still not working */
- XGIAdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
+ XGIAdjustFrame(ADJUST_FRAME_ARGS(pScrn, pScrn->frameX0, pScrn->frameY0));
#endif
- if (!(XGIModeInit(xf86Screens[scrnIndex], mode)))
+ if (!(XGIModeInit(pScrn, mode)))
return FALSE;
@@ -5421,14 +5422,14 @@ XGIAdjustFrameMerged(int scrnIndex, int x, int y, int flags)
* Usually mandatory
*/
void
-XGIAdjustFrame(int scrnIndex, int x, int y, int flags)
+XGIAdjustFrame(ADJUST_FRAME_ARGS_DECL)
{
- ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ SCRN_INFO_PTR(arg);
XGIPtr pXGI = XGIPTR(pScrn);
unsigned long base;
unsigned char ucSR5Stat, ucTemp;
- ErrorF("AdjustFrame %d\n", scrnIndex);
+ ErrorF("AdjustFrame %d\n", pScrn->scrnIndex);
inXGIIDXREG(XGISR, 0x05, ucSR5Stat);
if (ucSR5Stat == 0xA1)
ucSR5Stat = 0x86;
@@ -5480,9 +5481,9 @@ XGIAdjustFrame(int scrnIndex, int x, int y, int flags)
* Mandatory!
*/
static Bool
-XGIEnterVT(int scrnIndex, int flags)
+XGIEnterVT(VT_FUNC_ARGS_DECL)
{
- ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ SCRN_INFO_PTR(arg);
XGIPtr pXGI = XGIPTR(pScrn);
xgiSaveUnlockExtRegisterLock(pXGI, NULL, NULL);
@@ -5492,11 +5493,11 @@ XGIEnterVT(int scrnIndex, int flags)
return FALSE;
}
- XGIAdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
+ XGIAdjustFrame(ADJUST_FRAME_ARGS(pScrn, pScrn->frameX0, pScrn->frameY0));
#ifdef XF86DRI
if (pXGI->directRenderingEnabled) {
- DRIUnlock(screenInfo.screens[scrnIndex]);
+ DRIUnlock(xf86ScrnToScreen(pScrn));
}
#endif
@@ -5513,9 +5514,9 @@ XGIEnterVT(int scrnIndex, int flags)
* Mandatory!
*/
static void
-XGILeaveVT(int scrnIndex, int flags)
+XGILeaveVT(VT_FUNC_ARGS_DECL)
{
- ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ SCRN_INFO_PTR(arg);
vgaHWPtr hwp = VGAHWPTR(pScrn);
XGIPtr pXGI = XGIPTR(pScrn);
#ifdef XF86DRI
@@ -5523,7 +5524,7 @@ XGILeaveVT(int scrnIndex, int flags)
PDEBUG(ErrorF("XGILeaveVT()\n"));
if (pXGI->directRenderingEnabled) {
- pScreen = screenInfo.screens[scrnIndex];
+ pScreen = xf86ScrnToScreen(pScrn);
DRILock(pScreen, 0);
}
#endif
@@ -5556,9 +5557,9 @@ XGILeaveVT(int scrnIndex, int flags)
* Mandatory!
*/
static Bool
-XGICloseScreen(int scrnIndex, ScreenPtr pScreen)
+XGICloseScreen(CLOSE_SCREEN_ARGS_DECL)
{
- ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
vgaHWPtr hwp = VGAHWPTR(pScrn);
XGIPtr pXGI = XGIPTR(pScrn);
@@ -5642,7 +5643,7 @@ XGICloseScreen(int scrnIndex, ScreenPtr pScreen)
pScreen->CloseScreen = pXGI->CloseScreen;
- return (*pScreen->CloseScreen) (scrnIndex, pScreen);
+ return (*pScreen->CloseScreen) (CLOSE_SCREEN_ARGS);
}
@@ -5650,13 +5651,14 @@ XGICloseScreen(int scrnIndex, ScreenPtr pScreen)
/* Optional */
static void
-XGIFreeScreen(int scrnIndex, int flags)
+XGIFreeScreen(FREE_SCREEN_ARGS_DECL)
{
+ SCRN_INFO_PTR(arg);
if (xf86LoaderCheckSymbol("vgaHWFreeHWRec")) {
- vgaHWFreeHWRec(xf86Screens[scrnIndex]);
+ vgaHWFreeHWRec(pScrn);
}
- XGIFreeRec(xf86Screens[scrnIndex]);
+ XGIFreeRec(pScrn);
}
@@ -5858,7 +5860,7 @@ XGIValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags)
static Bool
XGISaveScreen(ScreenPtr pScreen, int mode)
{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
if ((pScrn != NULL) && pScrn->vtSema) {
@@ -5877,7 +5879,7 @@ static Bool
XGISaveScreenDH(ScreenPtr pScreen, int mode)
{
#ifdef XGIDUALHEAD
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
if ((pScrn != NULL) && pScrn->vtSema) {
XGIPtr pXGI = XGIPTR(pScrn);
diff --git a/src/xgi_driver.h b/src/xgi_driver.h
index 4004ccd..76a25e3 100755
--- a/src/xgi_driver.h
+++ b/src/xgi_driver.h
@@ -729,17 +729,17 @@ static const unsigned char XGI301CScaling[] = {
/* Mandatory functions */
static void XGIIdentify(int flags);
static Bool XGIPreInit(ScrnInfoPtr pScrn, int flags);
-static Bool XGIScreenInit(int Index, ScreenPtr pScreen, int argc, char **argv);
-static Bool XGIEnterVT(int scrnIndex, int flags);
-static void XGILeaveVT(int scrnIndex, int flags);
-static Bool XGICloseScreen(int scrnIndex, ScreenPtr pScreen);
+static Bool XGIScreenInit(SCREEN_INIT_ARGS_DECL);
+static Bool XGIEnterVT(VT_FUNC_ARGS_DECL);
+static void XGILeaveVT(VT_FUNC_ARGS_DECL);
+static Bool XGICloseScreen(CLOSE_SCREEN_ARGS_DECL);
static Bool XGISaveScreen(ScreenPtr pScreen, int mode);
-static Bool XGISwitchMode(int scrnIndex, DisplayModePtr mode, int flags);
-static void XGIAdjustFrame(int scrnIndex, int x, int y, int flags);
+static Bool XGISwitchMode(SWITCH_MODE_ARGS_DECL);
+static void XGIAdjustFrame(ADJUST_FRAME_ARGS_DECL);
static Bool XGISaveScreenDH(ScreenPtr pScreen, int mode);
/* Optional functions */
-static void XGIFreeScreen(int scrnIndex, int flags);
+static void XGIFreeScreen(FREE_SCREEN_ARGS_DECL);
static int XGIValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose,
int flags);
diff --git a/src/xgi_memcpy.c b/src/xgi_memcpy.c
index fd90b33..50034f3 100755
--- a/src/xgi_memcpy.c
+++ b/src/xgi_memcpy.c
@@ -1177,7 +1177,7 @@ static unsigned int XGI_GetCpuFeatures(ScrnInfoPtr pScrn)
static vidCopyFunc
XGIVidCopyInitGen(ScreenPtr pScreen, XGIMCFuncData *MCFunctions, vidCopyFunc *UMemCpy, Bool from)
{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
XGIPtr pXGI = XGIPTR(pScrn);
void *fbhandle = NULL;
char *frqBuf = NULL;
diff --git a/src/xgi_video.c b/src/xgi_video.c
index 4864b3a..716d6e1 100755
--- a/src/xgi_video.c
+++ b/src/xgi_video.c
@@ -128,7 +128,7 @@ static Atom xvBrightness, xvContrast, xvColorKey, xvSaturation, xvHue, xvmcUncom
void XGIInitVideo(ScreenPtr pScreen)
{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
XF86VideoAdaptorPtr *adaptors, *newAdaptors = NULL;
XF86VideoAdaptorPtr newAdaptor = NULL;
int num_adaptors;
@@ -387,7 +387,7 @@ XGISetPortDefaults(ScrnInfoPtr pScrn, XGIPortPrivPtr pPriv)
static XF86VideoAdaptorPtr
XGISetupImageVideo(ScreenPtr pScreen)
{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
XGIPtr pXGI = XGIPTR(pScrn);
XF86VideoAdaptorPtr adapt;
XGIPortPrivPtr pPriv;