summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/compat-api.h118
-rw-r--r--src/geode.h10
-rw-r--r--src/geode_ddc.c2
-rw-r--r--src/gx_accel.c2
-rw-r--r--src/gx_cursor.c2
-rw-r--r--src/gx_driver.c58
-rw-r--r--src/gx_randr.c4
-rw-r--r--src/gx_rotate.c4
-rw-r--r--src/gx_video.c18
-rw-r--r--src/lx_driver.c37
-rw-r--r--src/lx_exa.c6
-rw-r--r--src/lx_video.c14
-rw-r--r--src/z4l.c11
13 files changed, 208 insertions, 78 deletions
diff --git a/src/compat-api.h b/src/compat-api.h
new file mode 100644
index 0000000..e296829
--- /dev/null
+++ b/src/compat-api.h
@@ -0,0 +1,118 @@
+/*
+ * Copyright 2012 Red Hat, Inc.
+ * Copyright 2012 Canonical Ltd.
+ *
+ * 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.
+ *
+ * Authors:
+ * Dave Airlie <airlied@redhat.com>
+ * Maarten Lankhorst <maarten.lankhorst@canonical.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 DDC_CALL(pScrni) (pScrni->scrnIndex)
+
+#define SCRN_ARG_TYPE int
+#define SCRN_INFO_PTR(arg1) ScrnInfoPtr pScrni = xf86Screens[(arg1)]
+
+#define SCREEN_ARG_TYPE int
+#define SCREEN_PTR(arg1) ScreenPtr pScrn = screenInfo.screens[(arg1)]
+
+#define SCREEN_INIT_ARGS_DECL int index, ScreenPtr pScrn, 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 pScrn
+#define CLOSE_SCREEN_ARGS scrnIndex, pScrn
+
+#define ADJUST_FRAME_ARGS_DECL int arg, int x, int y, int flags
+#define ADJUST_FRAME_ARGS(x, y) pScrni->scrnIndex, (x), (y), 0
+
+#define SWITCH_MODE_ARGS_DECL int arg, DisplayModePtr pMode, int flags
+
+#define FREE_SCREEN_ARGS_DECL int arg, int flags
+#define FREE_SCREEN_ARGS(x) (x)->scrnIndex, 0
+
+#define VT_FUNC_ARGS_DECL int arg, int flags
+#define VT_FUNC_ARGS(flags) pScrni->scrnIndex, (flags)
+
+#define XF86_ENABLEDISABLEFB_ARG(pScrni, x) ((pScrni)->scrnIndex), (x)
+
+#define POINTER_MOVED_ARGS_DECL int arg, int x, int y
+#define POINTER_MOVED_ARGS(x, y) pScrni->scrnIndex, (x), (y)
+
+#define VALID_MODE_ARGS_DECL int arg, DisplayModePtr pMode, Bool Verbose, int flags
+
+#else /*XF86_SCRN_INTERFACE)*/
+
+#define DDC_CALL(pScrni) (pScrni)
+
+#define SCRN_ARG_TYPE ScrnInfoPtr
+#define SCRN_INFO_PTR(arg1) ScrnInfoPtr pScrni = (arg1)
+
+#define SCREEN_ARG_TYPE ScreenPtr
+#define SCREEN_PTR(arg1) ScreenPtr pScrn = (arg1)
+
+#define SCREEN_INIT_ARGS_DECL ScreenPtr pScrn, 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 pScrn
+#define CLOSE_SCREEN_ARGS pScrn
+
+#define ADJUST_FRAME_ARGS_DECL ScrnInfoPtr arg, int x, int y
+#define ADJUST_FRAME_ARGS(x, y) pScrni, (x), (y)
+
+#define SWITCH_MODE_ARGS_DECL ScrnInfoPtr arg, DisplayModePtr pMode
+
+#define FREE_SCREEN_ARGS_DECL ScrnInfoPtr arg
+#define FREE_SCREEN_ARGS(x) (x)
+
+#define VT_FUNC_ARGS_DECL ScrnInfoPtr arg
+#define VT_FUNC_ARGS(flags) pScrni
+
+#define XF86_ENABLEDISABLEFB_ARG(pScrni, x) (pScrni), (x)
+
+#define POINTER_MOVED_ARGS_DECL ScrnInfoPtr arg, int x, int y
+#define POINTER_MOVED_ARGS(x, y) pScrni, (x), (y)
+
+#define VALID_MODE_ARGS_DECL ScrnInfoPtr arg, DisplayModePtr pMode, Bool Verbose, int flags
+
+#endif
+
+#endif
diff --git a/src/geode.h b/src/geode.h
index 0165c81..b733805 100644
--- a/src/geode.h
+++ b/src/geode.h
@@ -43,6 +43,8 @@
#include "xf86xv.h"
+#include "compat-api.h"
+
/* We only support EXA version >=2 */
#if (EXA_VERSION_MAJOR >= 2)
@@ -248,7 +250,7 @@ typedef struct _geodeRec {
/* Hooks */
- void (*PointerMoved) (int index, int x, int y);
+ void (*PointerMoved) (POINTER_MOVED_ARGS_DECL);
CloseScreenProcPtr CloseScreen;
Bool (*CreateScreenResources) (ScreenPtr);
@@ -405,8 +407,8 @@ xf86MonPtr GeodeDoDDC(ScrnInfoPtr pScrni, int index);
Bool GeodeI2CInit(ScrnInfoPtr pScrni, I2CBusPtr * ptr, char *name);
int GeodeGetFPGeometry(const char *str, int *width, int *height);
-void GeodePointerMoved(int index, int x, int y);
-void GeodeFreeScreen(int scrnIndex, int flags);
+void GeodePointerMoved(POINTER_MOVED_ARGS_DECL);
+void GeodeFreeScreen(FREE_SCREEN_ARGS_DECL);
int GeodeCalculatePitchBytes(unsigned int width, unsigned int bpp);
void GXSetupChipsetFPtr(ScrnInfoPtr pScrn);
@@ -458,7 +460,7 @@ void LXSetupOutput(ScrnInfoPtr);
DisplayModePtr LXGetLegacyPanelMode(ScrnInfoPtr pScrni);
DisplayModePtr LXGetManualPanelMode(char *modestr);
-void LXAdjustFrame(int scrnIndex, int x, int y, int flags);
+void LXAdjustFrame(ADJUST_FRAME_ARGS_DECL);
/* lx_display.c */
void LXSetupCrtc(ScrnInfoPtr pScrni);
diff --git a/src/geode_ddc.c b/src/geode_ddc.c
index 8f1c605..7b8277d 100644
--- a/src/geode_ddc.c
+++ b/src/geode_ddc.c
@@ -173,7 +173,7 @@ GeodeGetDDC(ScrnInfoPtr pScrni)
if (!GeodeI2CInit(pScrni, &bus, "CS5536 DDC BUS"))
return NULL;
- mon = xf86DoEDID_DDC2(pScrni->scrnIndex, bus);
+ mon = xf86DoEDID_DDC2(DDC_CALL(pScrni), bus);
#if (XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,4,99,0,0))
if (mon)
diff --git a/src/gx_accel.c b/src/gx_accel.c
index c368649..764e0db 100644
--- a/src/gx_accel.c
+++ b/src/gx_accel.c
@@ -1904,7 +1904,7 @@ amd_gx_exa_Composite(PixmapPtr pxDst, int srcX, int srcY, int maskX,
Bool
GXAccelInit(ScreenPtr pScrn)
{
- ScrnInfoPtr pScrni = xf86Screens[pScrn->myNum];
+ ScrnInfoPtr pScrni = xf86ScreenToScrn(pScrn);
GeodeRec *pGeode = GEODEPTR(pScrni);
#if XF86EXA
diff --git a/src/gx_cursor.c b/src/gx_cursor.c
index de706fc..5a8f335 100644
--- a/src/gx_cursor.c
+++ b/src/gx_cursor.c
@@ -67,7 +67,7 @@ extern void GXSetVideoPosition(int x, int y, int width, int height,
Bool
GXHWCursorInit(ScreenPtr pScrn)
{
- ScrnInfoPtr pScrni = xf86Screens[pScrn->myNum];
+ ScrnInfoPtr pScrni = xf86ScreenToScrn(pScrn);
GeodeRec *pGeode = GEODEPTR(pScrni);
xf86CursorInfoPtr infoPtr;
diff --git a/src/gx_driver.c b/src/gx_driver.c
index 96b3dc3..5268f29 100644
--- a/src/gx_driver.c
+++ b/src/gx_driver.c
@@ -306,7 +306,7 @@ GXAllocateMemory(ScreenPtr pScrn, ScrnInfoPtr pScrni, int rotate)
static Bool
GXSaveScreen(ScreenPtr pScrn, int mode)
{
- ScrnInfoPtr pScrni = xf86Screens[pScrn->myNum];
+ ScrnInfoPtr pScrni = xf86ScreenToScrn(pScrn);
GeodePtr pGeode = GEODEPTR(pScrni);
if (pGeode->useVGA && !pScrni->vtSema)
@@ -784,9 +784,9 @@ GXSetDvLineSize(unsigned int pitch)
/* XXX - this is nothing like the original function - not sure exactly what the purpose is for this quite yet */
static void
-GXAdjustFrame(int scrnIndex, int x, int y, int flags)
+GXAdjustFrame(ADJUST_FRAME_ARGS_DECL)
{
- ScrnInfoPtr pScrni = xf86Screens[scrnIndex];
+ SCRN_INFO_PTR(arg);
GeodeRec *pGeode = GEODEPTR(pScrni);
unsigned long offset;
@@ -868,16 +868,16 @@ GXSetVideoMode(ScrnInfoPtr pScrni, DisplayModePtr pMode)
pGeode->HWCursor = FALSE;
}
- GXAdjustFrame(pScrni->scrnIndex, pScrni->frameX0, pScrni->frameY0, 0);
+ GXAdjustFrame(ADJUST_FRAME_ARGS(pScrni->frameX0, pScrni->frameY0));
gx_enable_dac_power();
return TRUE;
}
static Bool
-GXSwitchMode(int index, DisplayModePtr pMode, int flags)
+GXSwitchMode(SWITCH_MODE_ARGS_DECL)
{
- ScrnInfoPtr pScrni = xf86Screens[index];
+ SCRN_INFO_PTR(arg);
GeodeRec *pGeode = GEODEPTR(pScrni);
int ret = TRUE;
int rotate;
@@ -966,9 +966,9 @@ GXLeaveGraphics(ScrnInfoPtr pScrni)
}
static Bool
-GXCloseScreen(int scrnIndex, ScreenPtr pScrn)
+GXCloseScreen(CLOSE_SCREEN_ARGS_DECL)
{
- ScrnInfoPtr pScrni = xf86Screens[scrnIndex];
+ ScrnInfoPtr pScrni = xf86ScreenToScrn(pScrn);
GeodeRec *pGeode = GEODEPTR(pScrni);
if (pScrni->vtSema)
@@ -1004,7 +1004,7 @@ GXCloseScreen(int scrnIndex, ScreenPtr pScrn)
pScrn->CloseScreen = pGeode->CloseScreen;
if (pScrn->CloseScreen)
- return (*pScrn->CloseScreen) (scrnIndex, pScrn);
+ return (*pScrn->CloseScreen) (CLOSE_SCREEN_ARGS);
return TRUE;
}
@@ -1199,7 +1199,7 @@ GXDPMSSet(ScrnInfoPtr pScrni, int mode, int flags)
static Bool
GXCreateScreenResources(ScreenPtr pScreen)
{
- ScrnInfoPtr pScrni = xf86Screens[pScreen->myNum];
+ ScrnInfoPtr pScrni = xf86ScreenToScrn(pScreen);
GeodeRec *pGeode = GEODEPTR(pScrni);
pScreen->CreateScreenResources = pGeode->CreateScreenResources;
@@ -1235,9 +1235,9 @@ GXCreateScreenResources(ScreenPtr pScreen)
}
static Bool
-GXScreenInit(int scrnIndex, ScreenPtr pScrn, int argc, char **argv)
+GXScreenInit(SCREEN_INIT_ARGS_DECL)
{
- ScrnInfoPtr pScrni = xf86Screens[scrnIndex];
+ ScrnInfoPtr pScrni = xf86ScreenToScrn(pScrn);
GeodeRec *pGeode = GEODEPTR(pScrni);
XF86ModReqInfo shadowReq;
int maj, min, ret, rotate;
@@ -1259,7 +1259,7 @@ GXScreenInit(int scrnIndex, ScreenPtr pScrn, int argc, char **argv)
if (pGeode->useEXA) {
if (!(pGeode->pExa = exaDriverAlloc())) {
- xf86DrvMsg(scrnIndex, X_ERROR,
+ xf86DrvMsg(pScrni->scrnIndex, X_ERROR,
"Couldn't allocate the EXA structure.\n");
pGeode->NoAccel = TRUE;
}
@@ -1360,7 +1360,7 @@ GXScreenInit(int scrnIndex, ScreenPtr pScrn, int argc, char **argv)
if (pGeode->tryHWCursor) {
if (!GXHWCursorInit(pScrn))
- xf86DrvMsg(scrnIndex, X_ERROR,
+ xf86DrvMsg(pScrni->scrnIndex, X_ERROR,
"Hardware cursor initialization failed.\n");
}
@@ -1434,9 +1434,9 @@ GXScreenInit(int scrnIndex, ScreenPtr pScrn, int argc, char **argv)
}
static int
-GXValidMode(int scrnIndex, DisplayModePtr pMode, Bool Verbose, int flags)
+GXValidMode(VALID_MODE_ARGS_DECL)
{
- ScrnInfoPtr pScrni = xf86Screens[scrnIndex];
+ SCRN_INFO_PTR(arg);
GeodeRec *pGeode = GEODEPTR(pScrni);
int p;
int custom = 0;
@@ -1485,19 +1485,20 @@ GXValidMode(int scrnIndex, DisplayModePtr pMode, Bool Verbose, int flags)
/* XXX - Way more to do here */
static Bool
-GXEnterVT(int scrnIndex, int flags)
+GXEnterVT(VT_FUNC_ARGS_DECL)
{
- return GXEnterGraphics(NULL, xf86Screens[scrnIndex]);
+ SCRN_INFO_PTR(arg);
+ return GXEnterGraphics(NULL, pScrni);
}
static void
-GXLeaveVT(int scrnIndex, int flags)
+GXLeaveVT(VT_FUNC_ARGS_DECL)
{
- ScrnInfoPtr pScrni = xf86Screens[scrnIndex];
+ SCRN_INFO_PTR(arg);
GeodeRec *pGeode = GEODEPTR(pScrni);
pGeode->PrevDisplayOffset = gfx_get_display_offset();
- GXLeaveGraphics(xf86Screens[scrnIndex]);
+ GXLeaveGraphics(pScrni);
}
void
@@ -1520,9 +1521,9 @@ GXSetupChipsetFPtr(ScrnInfoPtr pScrn)
* ============================== */
void
-GeodePointerMoved(int index, int x, int y)
+GeodePointerMoved(POINTER_MOVED_ARGS_DECL)
{
- ScrnInfoPtr pScrni = xf86Screens[index];
+ SCRN_INFO_PTR(arg);
GeodeRec *pGeode = GEODEPTR(pScrni);
int newX = x, newY = y;
@@ -1544,7 +1545,7 @@ GeodePointerMoved(int index, int x, int y)
break;
}
- (*pGeode->PointerMoved) (index, newX, newY);
+ (*pGeode->PointerMoved) (POINTER_MOVED_ARGS(newX, newY));
}
int
@@ -1566,19 +1567,20 @@ GeodeFreeRec(ScrnInfoPtr pScrni)
}
void
-GeodeFreeScreen(int scrnIndex, int flags)
+GeodeFreeScreen(FREE_SCREEN_ARGS_DECL)
{
- GeodeRec *pGeode = GEODEPTR(xf86Screens[scrnIndex]);
+ SCRN_INFO_PTR(arg);
+ GeodeRec *pGeode = GEODEPTR(pScrni);
if (pGeode == NULL)
return;
if (pGeode->useVGA) {
if (xf86LoaderCheckSymbol("vgaHWFreeHWRec"))
- vgaHWFreeHWRec(xf86Screens[scrnIndex]);
+ vgaHWFreeHWRec(pScrni);
}
- GeodeFreeRec(xf86Screens[scrnIndex]);
+ GeodeFreeRec(pScrni);
}
int
diff --git a/src/gx_randr.c b/src/gx_randr.c
index 2176019..5b83094 100644
--- a/src/gx_randr.c
+++ b/src/gx_randr.c
@@ -181,7 +181,7 @@ GXRandRSetMode(ScreenPtr pScreen,
#endif
if (pRoot)
- (*pScrni->EnableDisableFBAccess) (pScreen->myNum, FALSE);
+ (*pScrni->EnableDisableFBAccess) (XF86_ENABLEDISABLEFB_ARG(pScrni, FALSE));
if (useVirtual) {
pScrni->virtualX = pRandr->virtualX;
@@ -236,7 +236,7 @@ GXRandRSetMode(ScreenPtr pScreen,
xf86SetViewport(pScreen, 0, 0);
if (pRoot)
- (*pScrni->EnableDisableFBAccess) (pScreen->myNum, TRUE);
+ (*pScrni->EnableDisableFBAccess) (XF86_ENABLEDISABLEFB_ARG(pScrni, TRUE));
return ret;
}
diff --git a/src/gx_rotate.c b/src/gx_rotate.c
index 2a86b30..3f7c911 100644
--- a/src/gx_rotate.c
+++ b/src/gx_rotate.c
@@ -35,7 +35,7 @@ static void *
GXWindowLinear(ScreenPtr pScreen, CARD32 row, CARD32 offset, int mode,
CARD32 *size, void *closure)
{
- ScrnInfoPtr pScrni = xf86Screens[pScreen->myNum];
+ ScrnInfoPtr pScrni = xf86ScreenToScrn(pScreen);
GeodeRec *pGeode = GEODEPTR(pScrni);
*size = pGeode->displayPitch;
@@ -47,7 +47,7 @@ GXWindowLinear(ScreenPtr pScreen, CARD32 row, CARD32 offset, int mode,
static void
GXUpdate(ScreenPtr pScreen, shadowBufPtr pBuf)
{
- ScrnInfoPtr pScrni = xf86Screens[pScreen->myNum];
+ ScrnInfoPtr pScrni = xf86ScreenToScrn(pScreen);
GeodeRec *pGeode = GEODEPTR(pScrni);
int rotate = pGeode->rotation;
diff --git a/src/gx_video.c b/src/gx_video.c
index b687b11..0d3e1c5 100644
--- a/src/gx_video.c
+++ b/src/gx_video.c
@@ -105,7 +105,7 @@ static int GXPutImage(ScrnInfoPtr, short, short, short, short, short, short,
short, short, int, unsigned char *, short, short, Bool,
RegionPtr, pointer, DrawablePtr pDraw);
-static void GXBlockHandler(int, pointer, pointer, pointer);
+static void GXBlockHandler(BLOCKHANDLER_ARGS_DECL);
void GXSetVideoPosition(int x, int y, int width, int height,
short src_w, short src_h, short drw_w,
short drw_h, int id, int offset, ScrnInfoPtr pScrni);
@@ -164,7 +164,7 @@ void
GXInitVideo(ScreenPtr pScrn)
{
GeodeRec *pGeode;
- ScrnInfoPtr pScrni = xf86Screens[pScrn->myNum];
+ ScrnInfoPtr pScrni = xf86ScreenToScrn(pScrn);
pGeode = GEODEPTR(pScrni);
@@ -371,7 +371,7 @@ GXResetVideo(ScrnInfoPtr pScrni)
static XF86VideoAdaptorPtr
GXSetupImageVideo(ScreenPtr pScrn)
{
- ScrnInfoPtr pScrni = xf86Screens[pScrn->myNum];
+ ScrnInfoPtr pScrni = xf86ScreenToScrn(pScrn);
GeodeRec *pGeode = GEODEPTR(pScrni);
XF86VideoAdaptorPtr adapt;
GeodePortPrivRec *pPriv;
@@ -690,7 +690,7 @@ GXCopyData422(unsigned char *src, unsigned char *dst,
static void
GXVideoSave(ScreenPtr pScreen, ExaOffscreenArea * area)
{
- ScrnInfoPtr pScrni = xf86Screens[pScreen->myNum];
+ ScrnInfoPtr pScrni = xf86ScreenToScrn(pScreen);
GeodePortPrivRec *pPriv = GET_PORT_PRIVATE(pScrni);
if (area == pPriv->area)
@@ -701,7 +701,7 @@ GXVideoSave(ScreenPtr pScreen, ExaOffscreenArea * area)
static int
GXAllocateMemory(ScrnInfoPtr pScrni, void **memp, int numlines)
{
- ScreenPtr pScrn = screenInfo.screens[pScrni->scrnIndex];
+ ScreenPtr pScrn = xf86ScrnToScreen(pScrni);
GeodeRec *pGeode = GEODEPTR(pScrni);
//long displayWidth = pGeode->Pitch / ((pScrni->bitsPerPixel + 7) / 8);
@@ -1320,15 +1320,15 @@ GeodeQueryImageAttributes(ScrnInfoPtr pScrni,
}
static void
-GXBlockHandler(int i, pointer blockData, pointer pTimeout, pointer pReadmask)
+GXBlockHandler(BLOCKHANDLER_ARGS_DECL)
{
- ScreenPtr pScrn = screenInfo.screens[i];
- ScrnInfoPtr pScrni = xf86Screens[i];
+ SCREEN_PTR(arg);
+ ScrnInfoPtr pScrni = xf86ScreenToScrn(pScrn);
GeodeRec *pGeode = GEODEPTR(pScrni);
GeodePortPrivRec *pPriv = GET_PORT_PRIVATE(pScrni);
pScrn->BlockHandler = pGeode->BlockHandler;
- (*pScrn->BlockHandler) (i, blockData, pTimeout, pReadmask);
+ (*pScrn->BlockHandler) (BLOCKHANDLER_ARGS);
pScrn->BlockHandler = GXBlockHandler;
if (pPriv->videoStatus & TIMER_MASK) {
diff --git a/src/lx_driver.c b/src/lx_driver.c
index 44ab2a4..6d7f37f 100644
--- a/src/lx_driver.c
+++ b/src/lx_driver.c
@@ -76,7 +76,7 @@ unsigned char *XpressROMPtr;
static Bool
LXSaveScreen(ScreenPtr pScrn, int mode)
{
- ScrnInfoPtr pScrni = xf86Screens[pScrn->myNum];
+ ScrnInfoPtr pScrni = xf86ScreenToScrn(pScrn);
GeodePtr pGeode = GEODEPTR(pScrni);
if (pGeode->useVGA && !pScrni->vtSema)
@@ -630,9 +630,9 @@ LXUnmapMem(ScrnInfoPtr pScrni)
/* These should be correctly accounted for rotation */
void
-LXAdjustFrame(int scrnIndex, int x, int y, int flags)
+LXAdjustFrame(ADJUST_FRAME_ARGS_DECL)
{
- ScrnInfoPtr pScrni = xf86Screens[scrnIndex];
+ SCRN_INFO_PTR(arg);
GeodeRec *pGeode = GEODEPTR(pScrni);
unsigned long offset;
@@ -644,9 +644,9 @@ LXAdjustFrame(int scrnIndex, int x, int y, int flags)
}
static Bool
-LXSwitchMode(int index, DisplayModePtr pMode, int flags)
+LXSwitchMode(SWITCH_MODE_ARGS_DECL)
{
- ScrnInfoPtr pScrni = xf86Screens[index];
+ SCRN_INFO_PTR(arg);
GeodeRec *pGeode = GEODEPTR(pScrni);
/* Set the new mode */
@@ -693,9 +693,9 @@ LXLeaveGraphics(ScrnInfoPtr pScrni)
}
static Bool
-LXCloseScreen(int scrnIndex, ScreenPtr pScrn)
+LXCloseScreen(CLOSE_SCREEN_ARGS_DECL)
{
- ScrnInfoPtr pScrni = xf86Screens[scrnIndex];
+ ScrnInfoPtr pScrni = xf86ScreenToScrn(pScrn);
GeodeRec *pGeode = GEODEPTR(pScrni);
if (pScrni->vtSema)
@@ -719,7 +719,7 @@ LXCloseScreen(int scrnIndex, ScreenPtr pScrn)
pScrn->CloseScreen = pGeode->CloseScreen;
if (pScrn->CloseScreen)
- return (*pScrn->CloseScreen) (scrnIndex, pScrn);
+ return (*pScrn->CloseScreen) (CLOSE_SCREEN_ARGS);
return TRUE;
}
@@ -815,9 +815,9 @@ LXLoadPalette(ScrnInfoPtr pScrni,
}
static Bool
-LXScreenInit(int scrnIndex, ScreenPtr pScrn, int argc, char **argv)
+LXScreenInit(SCREEN_INIT_ARGS_DECL)
{
- ScrnInfoPtr pScrni = xf86Screens[scrnIndex];
+ ScrnInfoPtr pScrni = xf86ScreenToScrn(pScrn);
GeodeRec *pGeode = GEODEPTR(pScrni);
int ret;
unsigned int dwidth;
@@ -850,7 +850,7 @@ LXScreenInit(int scrnIndex, ScreenPtr pScrn, int argc, char **argv)
pGeode->pExa->maxY = LX_MAX_HEIGHT - 1;
}
else {
- xf86DrvMsg(scrnIndex, X_ERROR,
+ xf86DrvMsg(pScrni->scrnIndex, X_ERROR,
"Couldn't allocate the EXA structure.\n");
pGeode->NoAccel = TRUE;
}
@@ -942,7 +942,7 @@ LXScreenInit(int scrnIndex, ScreenPtr pScrn, int argc, char **argv)
if (pGeode->tryHWCursor) {
if (!LXCursorInit(pScrn))
- xf86DrvMsg(scrnIndex, X_ERROR,
+ xf86DrvMsg(pScrni->scrnIndex, X_ERROR,
"Hardware cursor initialization failed.\n");
}
@@ -973,7 +973,7 @@ LXScreenInit(int scrnIndex, ScreenPtr pScrn, int argc, char **argv)
pScrn->SaveScreen = LXSaveScreen;
if (!xf86CrtcScreenInit(pScrn)) {
- xf86DrvMsg(scrnIndex, X_ERROR, "CRTCScreenInit failed.\n");
+ xf86DrvMsg(pScrni->scrnIndex, X_ERROR, "CRTCScreenInit failed.\n");
return FALSE;
}
@@ -986,21 +986,22 @@ LXScreenInit(int scrnIndex, ScreenPtr pScrn, int argc, char **argv)
}
static int
-LXValidMode(int scrnIndex, DisplayModePtr pMode, Bool Verbose, int flags)
+LXValidMode(VALID_MODE_ARGS_DECL)
{
return MODE_OK;
}
static Bool
-LXEnterVT(int scrnIndex, int flags)
+LXEnterVT(VT_FUNC_ARGS_DECL)
{
- return LXEnterGraphics(NULL, xf86Screens[scrnIndex]);
+ SCRN_INFO_PTR(arg);
+ return LXEnterGraphics(NULL, pScrni);
}
static void
-LXLeaveVT(int scrnIndex, int flags)
+LXLeaveVT(VT_FUNC_ARGS_DECL)
{
- ScrnInfoPtr pScrni = xf86Screens[scrnIndex];
+ SCRN_INFO_PTR(arg);
GeodeRec *pGeode = GEODEPTR(pScrni);
pGeode->PrevDisplayOffset = vg_get_display_offset();
diff --git a/src/lx_exa.c b/src/lx_exa.c
index 1f01717..bcff23e 100644
--- a/src/lx_exa.c
+++ b/src/lx_exa.c
@@ -461,7 +461,9 @@ struct blend_ops_t {
}
};
+#ifndef ARRAY_SIZE
#define ARRAY_SIZE(a) (sizeof((a)) / (sizeof(*(a))))
+#endif
static const struct exa_format_t *
lx_get_format(PicturePtr p)
@@ -1508,7 +1510,7 @@ lx_upload_to_screen(PixmapPtr pxDst, int x, int y, int w, int h,
static Bool
lx_exa_pixmap_is_offscreen(PixmapPtr pPixmap)
{
- ScrnInfoPtr pScrni = xf86Screens[pPixmap->drawable.pScreen->myNum];
+ ScrnInfoPtr pScrni = xf86ScreenToScrn(pPixmap->drawable.pScreen);
GeodeRec *pGeode = GEODEPTR(pScrni);
void *start = (void *) (pGeode->FBBase);
void *end =
@@ -1527,7 +1529,7 @@ lx_exa_pixmap_is_offscreen(PixmapPtr pPixmap)
Bool
LXExaInit(ScreenPtr pScreen)
{
- ScrnInfoPtr pScrni = xf86Screens[pScreen->myNum];
+ ScrnInfoPtr pScrni = xf86ScreenToScrn(pScreen);
GeodeRec *pGeode = GEODEPTR(pScrni);
ExaDriverPtr pExa = pGeode->pExa;
diff --git a/src/lx_video.c b/src/lx_video.c
index cf1c380..5dbe224 100644
--- a/src/lx_video.c
+++ b/src/lx_video.c
@@ -61,7 +61,9 @@
#define TIMER_MASK (OFF_TIMER | FREE_TIMER)
#define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE)
+#ifndef ARRAY_SIZE
#define ARRAY_SIZE(a) (sizeof((a)) / (sizeof(*(a))))
+#endif
/* Local function prototypes */
static void LXStopVideo(ScrnInfoPtr pScrni, pointer data, Bool exit);
@@ -638,15 +640,15 @@ LXResetVideo(ScrnInfoPtr pScrni)
}
static void
-LXVidBlockHandler(int i, pointer blockData, pointer pTimeout, pointer pReadmask)
+LXVidBlockHandler(BLOCKHANDLER_ARGS_DECL)
{
- ScreenPtr pScrn = screenInfo.screens[i];
- ScrnInfoPtr pScrni = xf86Screens[i];
+ SCREEN_PTR(arg);
+ ScrnInfoPtr pScrni = xf86ScreenToScrn(pScrn);
GeodeRec *pGeode = GEODEPTR(pScrni);
GeodePortPrivRec *pPriv = GET_PORT_PRIVATE(pScrni);
pScrn->BlockHandler = pGeode->BlockHandler;
- (*pScrn->BlockHandler) (i, blockData, pTimeout, pReadmask);
+ (*pScrn->BlockHandler) (BLOCKHANDLER_ARGS);
pScrn->BlockHandler = LXVidBlockHandler;
if (pPriv->videoStatus & TIMER_MASK) {
@@ -684,7 +686,7 @@ LXVidBlockHandler(int i, pointer blockData, pointer pTimeout, pointer pReadmask)
static XF86VideoAdaptorPtr
LXSetupImageVideo(ScreenPtr pScrn)
{
- ScrnInfoPtr pScrni = xf86Screens[pScrn->myNum];
+ ScrnInfoPtr pScrni = xf86ScreenToScrn(pScrn);
GeodeRec *pGeode = GEODEPTR(pScrni);
XF86VideoAdaptorPtr adapt;
GeodePortPrivRec *pPriv;
@@ -946,7 +948,7 @@ void
LXInitVideo(ScreenPtr pScrn)
{
GeodeRec *pGeode;
- ScrnInfoPtr pScrni = xf86Screens[pScrn->myNum];
+ ScrnInfoPtr pScrni = xf86ScreenToScrn(pScrn);
XF86VideoAdaptorPtr *adaptors, *newAdaptors = NULL;
XF86VideoAdaptorPtr newAdaptor = NULL;
int num_adaptors;
diff --git a/src/z4l.c b/src/z4l.c
index 6388e00..eccefe8 100644
--- a/src/z4l.c
+++ b/src/z4l.c
@@ -47,6 +47,8 @@
#include "xf86xv.h"
#include "fourcc.h"
+#include "compat-api.h"
+
#define __s64 __s_64
typedef long long __s64;
@@ -1271,19 +1273,20 @@ Z4lGetPortAttribute(ScrnInfoPtr pScrni, Atom attribute, INT32 *value,
return Success;
}
-static void (*oldAdjustFrame) (int scrnIndex, int x, int y, int flags) = NULL;
+static void (*oldAdjustFrame) (ADJUST_FRAME_ARGS_DECL) = NULL;
static void
-Z4lAdjustFrame(int scrnIndex, int x, int y, int flags)
+Z4lAdjustFrame(ADJUST_FRAME_ARGS_DECL)
{
+ SCRN_INFO_PTR(arg);
int i;
XF86VideoAdaptorPtr adpt;
Z4lPortPrivRec *pPriv;
- DBLOG(3, "Z4lAdjustFrame(%d,%d,%d)\n", x, y, flags);
+ DBLOG(3, "Z4lAdjustFrame(%d,%d)\n", x, y);
z4l_x_offset = x;
z4l_y_offset = y;
- oldAdjustFrame(scrnIndex, x, y, flags);
+ oldAdjustFrame(ADJUST_FRAME_ARGS(x, y));
/* xv adjust does not handle putvideo case */
for (i = 0; i < Z4l_nAdaptors; ++i) {