dummy: convert to the new server APIs.

Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
Dave Airlie 2012-06-05 11:14:37 +01:00
parent 6ff612955a
commit 1491470ee0
4 changed files with 93 additions and 34 deletions

View File

@ -38,4 +38,64 @@
#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 FREE_SCREEN_ARGS(x) (x)->scrnIndex, 0
#define VT_FUNC_ARGS_DECL int arg, int flags
#define VT_FUNC_ARGS(flags) pScrn->scrnIndex, (flags)
#define XF86_ENABLEDISABLEFB_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 FREE_SCREEN_ARGS(x) (x)
#define VT_FUNC_ARGS_DECL ScrnInfoPtr arg
#define VT_FUNC_ARGS(flags) pScrn
#define XF86_ENABLEDISABLEFB_ARG(x) (x)
#endif
#endif

View File

@ -20,8 +20,8 @@ typedef enum {
/* function prototypes */
extern Bool DUMMYSwitchMode(int scrnIndex, DisplayModePtr mode, int flags);
extern void DUMMYAdjustFrame(int scrnIndex, int x, int y, int flags);
extern Bool DUMMYSwitchMode(SWITCH_MODE_ARGS_DECL);
extern void DUMMYAdjustFrame(ADJUST_FRAME_ARGS_DECL);
/* in dummy_cursor.c */
extern Bool DUMMYCursorInit(ScreenPtr pScrn);

View File

@ -116,8 +116,8 @@ DUMMY_SetMode(
if(!pMode) { /* restore the original mode */
if(pDUMMY->DGAactive) {
pScrn->currentMode = DUMMYSavedDGAModes[index];
DUMMYSwitchMode(index, pScrn->currentMode, 0);
DUMMYAdjustFrame(index, 0, 0, 0);
DUMMYSwitchMode(SWITCH_MODE_ARGS(pScrn, pScrn->currentMode));
DUMMYAdjustFrame(ADJUST_FRAME_ARGS(pScrn, 0, 0));
pDUMMY->DGAactive = FALSE;
}
} else {
@ -126,7 +126,7 @@ DUMMY_SetMode(
pDUMMY->DGAactive = TRUE;
}
DUMMYSwitchMode(index, pMode->mode, 0);
DUMMYSwitchMode(SWITCH_MODE_ARGS(pScrn, pMode->mode));
}
return TRUE;
@ -149,7 +149,7 @@ DUMMY_SetViewport(
){
DUMMYPtr pDUMMY = DUMMYPTR(pScrn);
DUMMYAdjustFrame(pScrn->pScreen->myNum, x, y, flags);
DUMMYAdjustFrame(ADJUST_FRAME_ARGS(pScrn, x, y));
pDUMMY->DGAViewportStatus = 0;
}

View File

@ -57,14 +57,13 @@ static const OptionInfoRec * DUMMYAvailableOptions(int chipid, int busid);
static void DUMMYIdentify(int flags);
static Bool DUMMYProbe(DriverPtr drv, int flags);
static Bool DUMMYPreInit(ScrnInfoPtr pScrn, int flags);
static Bool DUMMYScreenInit(int Index, ScreenPtr pScreen, int argc,
char **argv);
static Bool DUMMYEnterVT(int scrnIndex, int flags);
static void DUMMYLeaveVT(int scrnIndex, int flags);
static Bool DUMMYCloseScreen(int scrnIndex, ScreenPtr pScreen);
static Bool DUMMYScreenInit(SCREEN_INIT_ARGS_DECL);
static Bool DUMMYEnterVT(VT_FUNC_ARGS_DECL);
static void DUMMYLeaveVT(VT_FUNC_ARGS_DECL);
static Bool DUMMYCloseScreen(CLOSE_SCREEN_ARGS_DECL);
static Bool DUMMYCreateWindow(WindowPtr pWin);
static void DUMMYFreeScreen(int scrnIndex, int flags);
static ModeStatus DUMMYValidMode(int scrnIndex, DisplayModePtr mode,
static void DUMMYFreeScreen(FREE_SCREEN_ARGS_DECL);
static ModeStatus DUMMYValidMode(SCRN_ARG_TYPE arg, DisplayModePtr mode,
Bool verbose, int flags);
static Bool DUMMYSaveScreen(ScreenPtr pScreen, int mode);
@ -463,24 +462,24 @@ DUMMYPreInit(ScrnInfoPtr pScrn, int flags)
/* Mandatory */
static Bool
DUMMYEnterVT(int scrnIndex, int flags)
DUMMYEnterVT(VT_FUNC_ARGS_DECL)
{
ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
SCRN_INFO_PTR(arg);
/* Should we re-save the text mode on each VT enter? */
if(!dummyModeInit(pScrn, pScrn->currentMode))
return FALSE;
DUMMYAdjustFrame(pScrn->scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
DUMMYAdjustFrame(ADJUST_FRAME_ARGS(pScrn, pScrn->frameX0, pScrn->frameY0));
return TRUE;
}
/* Mandatory */
static void
DUMMYLeaveVT(int scrnIndex, int flags)
DUMMYLeaveVT(VT_FUNC_ARGS_DECL)
{
ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
SCRN_INFO_PTR(arg);
dummyRestore(pScrn, TRUE);
}
@ -521,7 +520,7 @@ static ScrnInfoPtr DUMMYScrn; /* static-globalize it */
/* Mandatory */
static Bool
DUMMYScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
DUMMYScreenInit(SCREEN_INIT_ARGS_DECL)
{
ScrnInfoPtr pScrn;
DUMMYPtr dPtr;
@ -547,7 +546,7 @@ DUMMYScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
if (!dummyModeInit(pScrn,pScrn->currentMode))
return FALSE;
DUMMYAdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
DUMMYAdjustFrame(ADJUST_FRAME_ARGS(pScrn, pScrn->frameX0, pScrn->frameY0));
/*
* Reset visual list.
@ -599,7 +598,7 @@ DUMMYScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
#endif
if (dPtr->swCursor)
xf86DrvMsg(scrnIndex, X_CONFIG, "Using Software Cursor.\n");
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Using Software Cursor.\n");
{
@ -629,7 +628,7 @@ DUMMYScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
if (!dPtr->swCursor) {
/* HW cursor functions */
if (!DUMMYCursorInit(pScreen)) {
xf86DrvMsg(scrnIndex, X_ERROR,
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"Hardware cursor initialization failed\n");
return FALSE;
}
@ -668,20 +667,19 @@ DUMMYScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
/* Mandatory */
Bool
DUMMYSwitchMode(int scrnIndex, DisplayModePtr mode, int flags)
DUMMYSwitchMode(SWITCH_MODE_ARGS_DECL)
{
return dummyModeInit(xf86Screens[scrnIndex], mode);
SCRN_INFO_PTR(arg);
return dummyModeInit(pScrn, mode);
}
/* Mandatory */
void
DUMMYAdjustFrame(int scrnIndex, int x, int y, int flags)
DUMMYAdjustFrame(ADJUST_FRAME_ARGS_DECL)
{
ScrnInfoPtr pScrn;
SCRN_INFO_PTR(arg);
int Base;
pScrn = xf86Screens[scrnIndex];
Base = (y * pScrn->displayWidth + x) >> 2;
/* Scale Base by the number of bytes per pixel. */
@ -702,9 +700,9 @@ DUMMYAdjustFrame(int scrnIndex, int x, int y, int flags)
/* Mandatory */
static Bool
DUMMYCloseScreen(int scrnIndex, ScreenPtr pScreen)
DUMMYCloseScreen(CLOSE_SCREEN_ARGS_DECL)
{
ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
DUMMYPtr dPtr = DUMMYPTR(pScrn);
if(pScrn->vtSema){
@ -717,14 +715,15 @@ DUMMYCloseScreen(int scrnIndex, ScreenPtr pScreen)
pScrn->vtSema = FALSE;
pScreen->CloseScreen = dPtr->CloseScreen;
return (*pScreen->CloseScreen)(scrnIndex, pScreen);
return (*pScreen->CloseScreen)(CLOSE_SCREEN_ARGS);
}
/* Optional */
static void
DUMMYFreeScreen(int scrnIndex, int flags)
DUMMYFreeScreen(FREE_SCREEN_ARGS_DECL)
{
DUMMYFreeRec(xf86Screens[scrnIndex]);
SCRN_INFO_PTR(arg);
DUMMYFreeRec(pScrn);
}
static Bool
@ -744,7 +743,7 @@ DUMMYSaveScreen(ScreenPtr pScreen, int mode)
/* Optional */
static ModeStatus
DUMMYValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags)
DUMMYValidMode(SCRN_ARG_TYPE arg, DisplayModePtr mode, Bool verbose, int flags)
{
return(MODE_OK);
}