summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Makefile.am3
-rw-r--r--src/alp_driver.c64
-rw-r--r--src/alp_hwcurs.c4
-rw-r--r--src/alp_xaa.c2
-rw-r--r--src/alp_xaam.c2
-rw-r--r--src/cir.h5
-rw-r--r--src/cir_dga.c4
-rw-r--r--src/cir_shadow.c6
-rw-r--r--src/compat-api.h99
-rw-r--r--src/lg_driver.c65
-rw-r--r--src/lg_hwcurs.c4
-rw-r--r--src/lg_xaa.c2
12 files changed, 177 insertions, 83 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index f2cb24f..c649b3d 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -34,7 +34,8 @@ cirrus_drv_la_SOURCES = \
cir.h \
CirrusClk.c \
cir_shadow.c \
- cir_pcirename.h
+ cir_pcirename.h \
+ compat-api.h
cirrus_alpine_la_LTLIBRARIES = cirrus_alpine.la
cirrus_alpine_la_LDFLAGS = -module -avoid-version
diff --git a/src/alp_driver.c b/src/alp_driver.c
index 2e19461..77a5ba9 100644
--- a/src/alp_driver.c
+++ b/src/alp_driver.c
@@ -92,20 +92,20 @@ static void AlpProbeI2C(int scrnIndex);
/* Mandatory functions */
Bool AlpPreInit(ScrnInfoPtr pScrn, int flags);
-Bool AlpScreenInit(int Index, ScreenPtr pScreen, int argc, char **argv);
-Bool AlpEnterVT(int scrnIndex, int flags);
-void AlpLeaveVT(int scrnIndex, int flags);
-static Bool AlpCloseScreen(int scrnIndex, ScreenPtr pScreen);
+Bool AlpScreenInit(SCREEN_INIT_ARGS_DECL);
+Bool AlpEnterVT(VT_FUNC_ARGS_DECL);
+void AlpLeaveVT(VT_FUNC_ARGS_DECL);
+static Bool AlpCloseScreen(CLOSE_SCREEN_ARGS_DECL);
static Bool AlpSaveScreen(ScreenPtr pScreen, int mode);
/* Required if the driver supports mode switching */
-Bool AlpSwitchMode(int scrnIndex, DisplayModePtr mode, int flags);
+Bool AlpSwitchMode(SWITCH_MODE_ARGS_DECL);
/* Required if the driver supports moving the viewport */
-void AlpAdjustFrame(int scrnIndex, int x, int y, int flags);
+void AlpAdjustFrame(ADJUST_FRAME_ARGS_DECL);
/* Optional functions */
-void AlpFreeScreen(int scrnIndex, int flags);
-ModeStatus AlpValidMode(int scrnIndex, DisplayModePtr mode,
+void AlpFreeScreen(FREE_SCREEN_ARGS_DECL);
+ModeStatus AlpValidMode(SCRN_ARG_TYPE arg, DisplayModePtr mode,
Bool verbose, int flags);
/* Internally used functions */
static void AlpSave(ScrnInfoPtr pScrn);
@@ -781,7 +781,7 @@ AlpPreInit(ScrnInfoPtr pScrn, int flags)
}
else
xf86SetDDCproperties(pScrn,xf86PrintEDID(
- xf86DoEDID_DDC2(pScrn->scrnIndex,pCir->I2CPtr1)));
+ xf86DoEDID_DDC2(XF86_SCRN_ARG(pScrn),pCir->I2CPtr1)));
/* Probe the possible LCD display */
AlpProbeLCD(pScrn);
@@ -1457,9 +1457,9 @@ AlpRestore(ScrnInfoPtr pScrn)
/* This gets called at the start of each server generation */
Bool
-AlpScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
+AlpScreenInit(SCREEN_INIT_ARGS_DECL)
{
- ScrnInfoPtr pScrn;
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
vgaHWPtr hwp;
CirPtr pCir;
int i, ret;
@@ -1473,11 +1473,6 @@ AlpScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
ErrorF("AlpScreenInit\n");
#endif
- /*
- * First get the ScrnInfoRec
- */
- pScrn = xf86Screens[pScreen->myNum];
-
hwp = VGAHWPTR(pScrn);
pCir = CIRPTR(pScrn);
@@ -1513,7 +1508,7 @@ AlpScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
AlpSaveScreen(pScreen, SCREEN_SAVER_ON);
/* Set the viewport */
- AlpAdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
+ AlpAdjustFrame(ADJUST_FRAME_ARGS(pScrn, pScrn->frameX0, pScrn->frameY0));
/*
* The next step is to setup the screen's visuals, and initialise the
@@ -1591,7 +1586,7 @@ AlpScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
init_picture = 1;
break;
default:
- xf86DrvMsg(scrnIndex, X_ERROR,
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"X11: Internal error: invalid bpp (%d) in AlpScreenInit\n",
pScrn->bitsPerPixel);
ret = FALSE;
@@ -1747,9 +1742,10 @@ AlpScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
/* Usually mandatory */
Bool
-AlpSwitchMode(int scrnIndex, DisplayModePtr mode, int flags)
+AlpSwitchMode(SWITCH_MODE_ARGS_DECL)
{
- return AlpModeInit(xf86Screens[scrnIndex], mode);
+ SCRN_INFO_PTR(arg);
+ return AlpModeInit(pScrn, mode);
}
@@ -1759,13 +1755,12 @@ AlpSwitchMode(int scrnIndex, DisplayModePtr mode, int flags)
*/
/* Usually mandatory */
void
-AlpAdjustFrame(int scrnIndex, int x, int y, int flags)
+AlpAdjustFrame(ADJUST_FRAME_ARGS_DECL)
{
- ScrnInfoPtr pScrn;
+ SCRN_INFO_PTR(arg);
int Base, tmp;
vgaHWPtr hwp;
- pScrn = xf86Screens[scrnIndex];
hwp = VGAHWPTR(pScrn);
Base = ((y * pScrn->displayWidth + x) / 8);
@@ -1803,9 +1798,9 @@ AlpAdjustFrame(int scrnIndex, int x, int y, int flags)
/* Mandatory */
Bool
-AlpEnterVT(int scrnIndex, int flags)
+AlpEnterVT(VT_FUNC_ARGS_DECL)
{
- ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ SCRN_INFO_PTR(arg);
CirPtr pCir = CIRPTR(pScrn);
Bool ret;
@@ -1833,9 +1828,9 @@ AlpEnterVT(int scrnIndex, int flags)
/* Mandatory */
void
-AlpLeaveVT(int scrnIndex, int flags)
+AlpLeaveVT(VT_FUNC_ARGS_DECL)
{
- ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ SCRN_INFO_PTR(arg);
vgaHWPtr hwp = VGAHWPTR(pScrn);
#ifdef ALP_DEBUG
ErrorF("AlpLeaveVT\n");
@@ -1860,9 +1855,9 @@ AlpLeaveVT(int scrnIndex, int flags)
/* Mandatory */
static Bool
-AlpCloseScreen(int scrnIndex, ScreenPtr pScreen)
+AlpCloseScreen(CLOSE_SCREEN_ARGS_DECL)
{
- ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
vgaHWPtr hwp = VGAHWPTR(pScrn);
CirPtr pCir = CIRPTR(pScrn);
@@ -1891,7 +1886,7 @@ AlpCloseScreen(int scrnIndex, ScreenPtr pScreen)
#endif
pScreen->CloseScreen = pCir->CloseScreen;
- return (*pScreen->CloseScreen)(scrnIndex, pScreen);
+ return (*pScreen->CloseScreen)(CLOSE_SCREEN_ARGS);
}
@@ -1899,8 +1894,9 @@ AlpCloseScreen(int scrnIndex, ScreenPtr pScreen)
/* Optional */
void
-AlpFreeScreen(int scrnIndex, int flags)
+AlpFreeScreen(FREE_SCREEN_ARGS_DECL)
{
+ SCRN_INFO_PTR(arg);
#ifdef ALP_DEBUG
ErrorF("AlpFreeScreen\n");
#endif
@@ -1909,8 +1905,8 @@ AlpFreeScreen(int scrnIndex, int flags)
* get called routinely at the end of a server generation.
*/
if (xf86LoaderCheckSymbol("vgaHWFreeHWRec"))
- vgaHWFreeHWRec(xf86Screens[scrnIndex]);
- AlpFreeRec(xf86Screens[scrnIndex]);
+ vgaHWFreeHWRec(pScrn);
+ AlpFreeRec(pScrn);
}
@@ -1918,7 +1914,7 @@ AlpFreeScreen(int scrnIndex, int flags)
/* Optional */
ModeStatus
-AlpValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags)
+AlpValidMode(SCRN_ARG_TYPE arg, DisplayModePtr mode, Bool verbose, int flags)
{
int lace;
diff --git a/src/alp_hwcurs.c b/src/alp_hwcurs.c
index 9891eb4..97c72e1 100644
--- a/src/alp_hwcurs.c
+++ b/src/alp_hwcurs.c
@@ -187,7 +187,7 @@ AlpShowCursor(ScrnInfoPtr pScrn)
static Bool
AlpUseHWCursor(ScreenPtr pScreen, CursorPtr pCurs)
{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
#ifdef ALP_DEBUG
ErrorF("AlpUseHWCursor\n");
#endif
@@ -200,7 +200,7 @@ AlpUseHWCursor(ScreenPtr pScreen, CursorPtr pCurs)
Bool
AlpHWCursorInit(ScreenPtr pScreen, int size)
{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
const CirPtr pCir = CIRPTR(pScrn);
const AlpPtr pAlp = ALPPTR(pCir);
diff --git a/src/alp_xaa.c b/src/alp_xaa.c
index 7a96e1a..cc8c0d9 100644
--- a/src/alp_xaa.c
+++ b/src/alp_xaa.c
@@ -588,7 +588,7 @@ AlpAccelEngineInit(ScrnInfoPtr pScrn)
Bool
AlpXAAInit(ScreenPtr pScreen)
{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
CirPtr pCir = CIRPTR(pScrn);
AlpPtr pAlp = ALPPTR(pCir);
XAAInfoRecPtr XAAPtr;
diff --git a/src/alp_xaam.c b/src/alp_xaam.c
index 3ecc7de..42bbb31 100644
--- a/src/alp_xaam.c
+++ b/src/alp_xaam.c
@@ -222,7 +222,7 @@ AlpAccelEngineInit(ScrnInfoPtr pScrn)
Bool
AlpXAAInitMMIO(ScreenPtr pScreen)
{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
CirPtr pCir = CIRPTR(pScrn);
XAAInfoRecPtr XAAPtr;
diff --git a/src/cir.h b/src/cir.h
index 861966d..3915a31 100644
--- a/src/cir.h
+++ b/src/cir.h
@@ -9,6 +9,7 @@
#include <string.h>
#include <stdlib.h>
+#include "compat-api.h"
#include "cir_pcirename.h"
/* Card-specific driver information */
@@ -59,7 +60,7 @@ typedef struct {
int rotate;
int ShadowPitch;
unsigned char * ShadowPtr;
- void (*PointerMoved)(int index, int x, int y);
+ void (*PointerMoved)(SCRN_ARG_TYPE arg, int x, int y);
int pitch;
unsigned char ** ScanlineColorExpandBuffers;
@@ -85,7 +86,7 @@ extern void cirProbeDDC(ScrnInfoPtr pScrn, int index);
extern Bool CirDGAInit(ScreenPtr pScreen);
/* in cir_shadow.c */
-void cirPointerMoved(int index, int x, int y);
+void cirPointerMoved(SCRN_ARG_TYPE arg, int x, int y);
void cirRefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox);
void cirRefreshArea8(ScrnInfoPtr pScrn, int num, BoxPtr pbox);
void cirRefreshArea16(ScrnInfoPtr pScrn, int num, BoxPtr pbox);
diff --git a/src/cir_dga.c b/src/cir_dga.c
index f930231..44abfd9 100644
--- a/src/cir_dga.c
+++ b/src/cir_dga.c
@@ -69,7 +69,7 @@ DGAFunctionRec CirDGAFuncs = {
_X_EXPORT Bool
CirDGAInit(ScreenPtr pScreen)
{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
CirPtr pCir = CIRPTR(pScrn);
DGAModePtr modes = NULL, newmodes = NULL, currentMode;
DisplayModePtr pMode, firstMode;
@@ -191,7 +191,7 @@ Cir_SetViewport(
CirPtr pCir = CIRPTR(pScrn);
vgaHWPtr hwp = VGAHWPTR(pScrn);
- pScrn->AdjustFrame(pScrn->pScreen->myNum, x, y, flags);
+ pScrn->AdjustFrame(ADJUST_FRAME_ARGS(pScrn, x, y));
while((hwp->readST01(hwp) & 0x08));
while(!(hwp->readST01(hwp) & 0x08));
diff --git a/src/cir_shadow.c b/src/cir_shadow.c
index 0716a64..5dc8d08 100644
--- a/src/cir_shadow.c
+++ b/src/cir_shadow.c
@@ -44,9 +44,9 @@ cirRefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox)
}
_X_EXPORT void
-cirPointerMoved(int index, int x, int y)
+cirPointerMoved(SCRN_ARG_TYPE arg, int x, int y)
{
- ScrnInfoPtr pScrn = xf86Screens[index];
+ SCRN_INFO_PTR(arg);
CirPtr pCir = CIRPTR(pScrn);
int newX, newY;
@@ -58,7 +58,7 @@ cirPointerMoved(int index, int x, int y)
newY = pScrn->pScreen->width - x - 1;
}
- (*pCir->PointerMoved)(index, newX, newY);
+ (*pCir->PointerMoved)(arg, newX, newY);
}
_X_EXPORT void
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/lg_driver.c b/src/lg_driver.c
index d4301e1..1ae6765 100644
--- a/src/lg_driver.c
+++ b/src/lg_driver.c
@@ -78,20 +78,20 @@
/* Mandatory functions */
Bool LgPreInit(ScrnInfoPtr pScrn, int flags);
-Bool LgScreenInit(int Index, ScreenPtr pScreen, int argc, char **argv);
-Bool LgEnterVT(int scrnIndex, int flags);
-void LgLeaveVT(int scrnIndex, int flags);
-static Bool LgCloseScreen(int scrnIndex, ScreenPtr pScreen);
+Bool LgScreenInit(SCREEN_INIT_ARGS_DECL);
+Bool LgEnterVT(VT_FUNC_ARGS_DECL);
+void LgLeaveVT(VT_FUNC_ARGS_DECL);
+static Bool LgCloseScreen(CLOSE_SCREEN_ARGS_DECL);
static Bool LgSaveScreen(ScreenPtr pScreen, Bool mode);
/* Required if the driver supports mode switching */
-Bool LgSwitchMode(int scrnIndex, DisplayModePtr mode, int flags);
+Bool LgSwitchMode(SWITCH_MODE_ARGS_DECL);
/* Required if the driver supports moving the viewport */
-void LgAdjustFrame(int scrnIndex, int x, int y, int flags);
+void LgAdjustFrame(ADJUST_FRAME_ARGS_DECL);
/* Optional functions */
-void LgFreeScreen(int scrnIndex, int flags);
-ModeStatus LgValidMode(int scrnIndex, DisplayModePtr mode,
+void LgFreeScreen(FREE_SCREEN_ARGS_DECL);
+ModeStatus LgValidMode(SCRN_ARG_TYPE arg, DisplayModePtr mode,
Bool verbose, int flags);
/* Internally used functions */
@@ -1232,10 +1232,10 @@ LgRestore(ScrnInfoPtr pScrn)
/* This gets called at the start of each server generation */
Bool
-LgScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
+LgScreenInit(SCREEN_INIT_ARGS_DECL)
{
/* The vgaHW references will disappear one day */
- ScrnInfoPtr pScrn;
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
vgaHWPtr hwp;
CirPtr pCir;
int i, ret;
@@ -1247,11 +1247,6 @@ LgScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
ErrorF("LgScreenInit\n");
#endif
- /*
- * First get the ScrnInfoRec
- */
- pScrn = xf86Screens[pScreen->myNum];
-
hwp = VGAHWPTR(pScrn);
hwp->MapSize = 0x10000; /* Standard 64k VGA window */
@@ -1281,7 +1276,7 @@ LgScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
LgSaveScreen(pScreen, SCREEN_SAVER_ON);
/* Set the viewport */
- LgAdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
+ LgAdjustFrame(ADJUST_FRAME_ARGS(pScrn, pScrn->frameX0, pScrn->frameY0));
/*
* The next step is to setup the screen's visuals, and initialise the
@@ -1344,7 +1339,7 @@ LgScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
displayWidth,pScrn->bitsPerPixel);
break;
default:
- xf86DrvMsg(scrnIndex, X_ERROR,
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"X11: Internal error: invalid bpp (%d) in LgScreenInit\n",
pScrn->bitsPerPixel);
ret = FALSE;
@@ -1443,9 +1438,10 @@ LgScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
/* Usually mandatory */
Bool
-LgSwitchMode(int scrnIndex, DisplayModePtr mode, int flags)
+LgSwitchMode(SWITCH_MODE_ARGS_DECL)
{
- return LgModeInit(xf86Screens[scrnIndex], mode);
+ SCRN_INFO_PTR(arg);
+ return LgModeInit(pScrn, mode);
}
#define ROUND_DOWN(x, mod) (((x) / (mod)) * (mod))
@@ -1457,9 +1453,9 @@ LgSwitchMode(int scrnIndex, DisplayModePtr mode, int flags)
*/
/* Usually mandatory */
void
-LgAdjustFrame(int scrnIndex, int x, int y, int flags)
+LgAdjustFrame(ADJUST_FRAME_ARGS_DECL)
{
- ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ SCRN_INFO_PTR(arg);
int Base, tmp;
CirPtr pCir = CIRPTR(pScrn);
vgaHWPtr hwp = VGAHWPTR(pScrn);
@@ -1545,9 +1541,9 @@ LgAdjustFrame(int scrnIndex, int x, int y, int flags)
/* Mandatory */
Bool
-LgEnterVT(int scrnIndex, int flags)
+LgEnterVT(VT_FUNC_ARGS_DECL)
{
- ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ SCRN_INFO_PTR(arg);
CirPtr pCir = CIRPTR(pScrn);
#ifdef LG_DEBUG
ErrorF("LgEnterVT\n");
@@ -1572,9 +1568,9 @@ LgEnterVT(int scrnIndex, int flags)
/* Mandatory */
void
-LgLeaveVT(int scrnIndex, int flags)
+LgLeaveVT(VT_FUNC_ARGS_DECL)
{
- ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ SCRN_INFO_PTR(arg);
vgaHWPtr hwp = VGAHWPTR(pScrn);
CirPtr pCir = CIRPTR(pScrn);
#ifdef LG_DEBUG
@@ -1600,9 +1596,9 @@ LgLeaveVT(int scrnIndex, int flags)
/* Mandatory */
static Bool
-LgCloseScreen(int scrnIndex, ScreenPtr pScreen)
+LgCloseScreen(CLOSE_SCREEN_ARGS_DECL)
{
- ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
vgaHWPtr hwp = VGAHWPTR(pScrn);
CirPtr pCir = CIRPTR(pScrn);
@@ -1631,7 +1627,7 @@ LgCloseScreen(int scrnIndex, ScreenPtr pScreen)
pScrn->vtSema = FALSE;
pScreen->CloseScreen = pCir->CloseScreen;
- return (*pScreen->CloseScreen)(scrnIndex, pScreen);
+ return (*pScreen->CloseScreen)(CLOSE_SCREEN_ARGS);
}
@@ -1639,8 +1635,9 @@ LgCloseScreen(int scrnIndex, ScreenPtr pScreen)
/* Optional */
void
-LgFreeScreen(int scrnIndex, int flags)
+LgFreeScreen(FREE_SCREEN_ARGS_DECL)
{
+ SCRN_INFO_PTR(arg);
#ifdef LG_DEBUG
ErrorF("LgFreeScreen\n");
#endif
@@ -1649,8 +1646,8 @@ LgFreeScreen(int scrnIndex, int flags)
* get called routinely at the end of a server generation.
*/
if (xf86LoaderCheckSymbol("vgaHWFreeHWRec"))
- vgaHWFreeHWRec(xf86Screens[scrnIndex]);
- LgFreeRec(xf86Screens[scrnIndex]);
+ vgaHWFreeHWRec(pScrn);
+ LgFreeRec(pScrn);
}
@@ -1658,7 +1655,7 @@ LgFreeScreen(int scrnIndex, int flags)
/* Optional */
ModeStatus
-LgValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags)
+LgValidMode(SCRN_ARG_TYPE arg, DisplayModePtr mode, Bool verbose, int flags)
{
int lace;
@@ -1684,14 +1681,14 @@ LgValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags)
static Bool
LgSaveScreen(ScreenPtr pScreen, int mode)
{
- CirPtr pCir = CIRPTR(xf86Screens[pScreen->myNum]);
+ CirPtr pCir = CIRPTR(xf86ScreenToScrn(pScreen));
ScrnInfoPtr pScrn = NULL;
Bool unblank;
unblank = xf86IsUnblank(mode);
if (pScreen != NULL)
- pScrn = xf86Screens[pScreen->myNum];
+ pScrn = xf86ScreenToScrn(pScreen);
if (pScrn != NULL && pScrn->vtSema) {
if (unblank)
diff --git a/src/lg_hwcurs.c b/src/lg_hwcurs.c
index 381db1c..80d1dff 100644
--- a/src/lg_hwcurs.c
+++ b/src/lg_hwcurs.c
@@ -328,7 +328,7 @@ void LgShowCursor(ScrnInfoPtr pScrn)
*/
static Bool LgUseHWCursor(ScreenPtr pScreen, CursorPtr pCurs)
{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
#ifdef LG_CURSOR_DEBUG
ErrorF("LgUseHWCursor\n");
@@ -346,7 +346,7 @@ static Bool LgUseHWCursor(ScreenPtr pScreen, CursorPtr pCurs)
*/
Bool LgHWCursorInit(ScreenPtr pScreen)
{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
CirPtr pCir = CIRPTR(pScrn);
xf86CursorInfoPtr infoPtr;
diff --git a/src/lg_xaa.c b/src/lg_xaa.c
index 8bab365..7abfb20 100644
--- a/src/lg_xaa.c
+++ b/src/lg_xaa.c
@@ -98,7 +98,7 @@ static void LgSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int x1, int y1,
Bool
LgXAAInit(ScreenPtr pScreen)
{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
CirPtr pCir = CIRPTR(pScrn);
XAAInfoRecPtr XAAPtr;