Commit 86f1d894 authored by Dave Airlie's avatar Dave Airlie

vesa: add api 13 compat layer.

Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent 378e55e3
......@@ -38,4 +38,61 @@
#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 SCRN_OR_INDEX_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 SCRN_OR_INDEX_ARG(x) (x)
#endif
#endif
......@@ -75,17 +75,16 @@ static Bool VESAPciProbe(DriverPtr drv, int entity_num,
struct pci_device *dev, intptr_t match_data);
#endif
static Bool VESAPreInit(ScrnInfoPtr pScrn, int flags);
static Bool VESAScreenInit(int Index, ScreenPtr pScreen, int argc,
char **argv);
static Bool VESAEnterVT(int scrnIndex, int flags);
static void VESALeaveVT(int scrnIndex, int flags);
static Bool VESACloseScreen(int scrnIndex, ScreenPtr pScreen);
static Bool VESAScreenInit(SCREEN_INIT_ARGS_DECL);
static Bool VESAEnterVT(VT_FUNC_ARGS_DECL);
static void VESALeaveVT(VT_FUNC_ARGS_DECL);
static Bool VESACloseScreen(CLOSE_SCREEN_ARGS_DECL);
static Bool VESASaveScreen(ScreenPtr pScreen, int mode);
static Bool VESASwitchMode(int scrnIndex, DisplayModePtr pMode, int flags);
static Bool VESASwitchMode(SWITCH_MODE_ARGS_DECL);
static Bool VESASetMode(ScrnInfoPtr pScrn, DisplayModePtr pMode);
static void VESAAdjustFrame(int scrnIndex, int x, int y, int flags);
static void VESAFreeScreen(int scrnIndex, int flags);
static void VESAAdjustFrame(ADJUST_FRAME_ARGS_DECL);
static void VESAFreeScreen(FREE_SCREEN_ARGS_DECL);
static void VESAFreeRec(ScrnInfoPtr pScrn);
static VESAPtr VESAGetRec(ScrnInfoPtr pScrn);
......@@ -342,11 +341,11 @@ vesaModesCloseEnough(DisplayModePtr edid, DisplayModePtr vbe)
}
static ModeStatus
VESAValidMode(int scrn, DisplayModePtr p, Bool flag, int pass)
VESAValidMode(SCRN_ARG_TYPE arg, DisplayModePtr p, Bool flag, int pass)
{
SCRN_INFO_PTR(arg);
static int warned = 0;
int found = 0;
ScrnInfoPtr pScrn = xf86Screens[scrn];
VESAPtr pVesa = VESAGetRec(pScrn);
MonPtr mon = pScrn->monitor;
ModeStatus ret = MODE_BAD;
......@@ -357,7 +356,7 @@ VESAValidMode(int scrn, DisplayModePtr p, Bool flag, int pass)
if (pass != MODECHECK_FINAL) {
if (!warned) {
xf86DrvMsg(scrn, X_WARNING, "VESAValidMode called unexpectedly\n");
xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "VESAValidMode called unexpectedly\n");
warned = 1;
}
return MODE_OK;
......@@ -740,7 +739,7 @@ VESAPreInit(ScrnInfoPtr pScrn, int flags)
#ifdef HAVE_PANELID
else {
void *panelid = VBEReadPanelID(pVesa->pVbe);
VBEInterpretPanelID(pScrn->scrnIndex, panelid);
VBEInterpretPanelID(SCRN_OR_INDEX_ARG(pScrn), panelid);
free(panelid);
}
#endif
......@@ -918,19 +917,19 @@ vesaCreateScreenResources(ScreenPtr pScreen)
}
static void
vesaEnableDisableFBAccess(int scrnIndex, Bool enable)
vesaEnableDisableFBAccess(SCRN_ARG_TYPE arg, Bool enable)
{
ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
SCRN_INFO_PTR(arg);
VESAPtr pVesa = VESAGetRec(pScrn);
pVesa->accessEnabled = enable;
pVesa->EnableDisableFBAccess(scrnIndex, enable);
pVesa->EnableDisableFBAccess(arg, enable);
}
static Bool
VESAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
VESAScreenInit(SCREEN_INIT_ARGS_DECL)
{
ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
VESAPtr pVesa = VESAGetRec(pScrn);
VisualPtr visual;
VbeModeInfoBlock *mode;
......@@ -988,7 +987,7 @@ VESAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
return (FALSE);
/* set the viewport */
VESAAdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
VESAAdjustFrame(ADJUST_FRAME_ARGS(pScrn, pScrn->frameX0, pScrn->frameY0));
/* Blank the screen for aesthetic reasons. */
VESASaveScreen(pScreen, SCREEN_SAVER_ON);
......@@ -1117,30 +1116,31 @@ VESAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
}
static Bool
VESAEnterVT(int scrnIndex, int flags)
VESAEnterVT(VT_FUNC_ARGS_DECL)
{
ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
SCRN_INFO_PTR(arg);
if (!VESASetMode(pScrn, pScrn->currentMode))
return FALSE;
VESAAdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
VESAAdjustFrame(ADJUST_FRAME_ARGS(pScrn, pScrn->frameX0, pScrn->frameY0));
return TRUE;
}
static void
VESALeaveVT(int scrnIndex, int flags)
VESALeaveVT(VT_FUNC_ARGS_DECL)
{
VESASaveRestore(xf86Screens[scrnIndex], MODE_RESTORE);
SCRN_INFO_PTR(arg);
VESASaveRestore(pScrn, MODE_RESTORE);
}
static Bool
VESACloseScreen(int scrnIndex, ScreenPtr pScreen)
VESACloseScreen(CLOSE_SCREEN_ARGS_DECL)
{
ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
VESAPtr pVesa = VESAGetRec(pScrn);
if (pScrn->vtSema) {
VESASaveRestore(xf86Screens[scrnIndex], MODE_RESTORE);
VESASaveRestore(pScrn, MODE_RESTORE);
if (pVesa->savedPal)
VBESetGetPaletteData(pVesa->pVbe, TRUE, 0, 256,
pVesa->savedPal, FALSE, TRUE);
......@@ -1160,21 +1160,21 @@ VESACloseScreen(int scrnIndex, ScreenPtr pScreen)
pScrn->EnableDisableFBAccess = pVesa->EnableDisableFBAccess;
pScreen->CreateScreenResources = pVesa->CreateScreenResources;
pScreen->CloseScreen = pVesa->CloseScreen;
return pScreen->CloseScreen(scrnIndex, pScreen);
return pScreen->CloseScreen(CLOSE_SCREEN_ARGS);
}
static Bool
VESASwitchMode(int scrnIndex, DisplayModePtr pMode, int flags)
VESASwitchMode(SWITCH_MODE_ARGS_DECL)
{
ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
SCRN_INFO_PTR(arg);
VESAPtr pVesa = VESAGetRec(pScrn);
Bool ret, disableAccess = pVesa->ModeSetClearScreen && pVesa->accessEnabled;
if (disableAccess)
pScrn->EnableDisableFBAccess(scrnIndex,FALSE);
ret = VESASetMode(xf86Screens[scrnIndex], pMode);
pScrn->EnableDisableFBAccess(SCRN_OR_INDEX_ARG(pScrn),FALSE);
ret = VESASetMode(pScrn, mode);
if (disableAccess)
pScrn->EnableDisableFBAccess(scrnIndex,TRUE);
pScrn->EnableDisableFBAccess(SCRN_OR_INDEX_ARG(pScrn),TRUE);
return ret;
}
......@@ -1235,17 +1235,19 @@ VESASetMode(ScrnInfoPtr pScrn, DisplayModePtr pMode)
}
static void
VESAAdjustFrame(int scrnIndex, int x, int y, int flags)
VESAAdjustFrame(ADJUST_FRAME_ARGS_DECL)
{
VESAPtr pVesa = VESAGetRec(xf86Screens[scrnIndex]);
SCRN_INFO_PTR(arg);
VESAPtr pVesa = VESAGetRec(pScrn);
VBESetDisplayStart(pVesa->pVbe, x, y, TRUE);
}
static void
VESAFreeScreen(int scrnIndex, int flags)
VESAFreeScreen(FREE_SCREEN_ARGS_DECL)
{
VESAFreeRec(xf86Screens[scrnIndex]);
SCRN_INFO_PTR(arg);
VESAFreeRec(pScrn);
}
static Bool
......@@ -1735,9 +1737,9 @@ VESADGASetMode(ScrnInfoPtr pScrn, DGAModePtr pDGAMode)
frameY0 = pScrn->frameY0;
}
if (!(*pScrn->SwitchMode)(scrnIdx, pMode, 0))
if (!(*pScrn->SwitchMode)(SWITCH_MODE_ARGS(pScrn, pMode)))
return (FALSE);
(*pScrn->AdjustFrame)(scrnIdx, frameX0, frameY0, 0);
(*pScrn->AdjustFrame)(ADJUST_FRAME_ARGS(pScrn, frameX0, frameY0));
return (TRUE);
}
......@@ -1745,7 +1747,7 @@ VESADGASetMode(ScrnInfoPtr pScrn, DGAModePtr pDGAMode)
static void
VESADGASetViewport(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 int
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment