Commit 1b20cd63 authored by Dave Airlie's avatar Dave Airlie

sis: port to new compat API.

Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent e067fc08
......@@ -31,6 +31,7 @@ sis_drv_ladir = @moduledir@/drivers
sis_drv_la_SOURCES = \
300vtbl.h \
310vtbl.h \
compat-api.h \
init301.c \
init301.h \
init.c \
......
/*
* 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
......@@ -269,6 +269,8 @@
#include "extnsionst.h" /* required */
#include <X11/extensions/panoramiXproto.h> /* required */
#include "compat-api.h"
#undef SISCHECKOSSSE
#ifdef XORG_VERSION_CURRENT
#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(6,8,99,13,0)
......@@ -1144,7 +1146,7 @@ typedef struct {
CARD32 ColorExpandBase;
int Rotate, Reflect;
void (*PointerMoved)(int index, int x, int y);
void (*PointerMoved)(SCRN_ARG_TYPE arg, int x, int y);
/* ShadowFB support */
Bool ShadowFB;
......
......@@ -884,7 +884,7 @@ static const unsigned short dstcol[] = { 0x0000, 0x8000, 0xc000 };
static void
SiSEXASync(ScreenPtr pScreen, int marker)
{
SISPtr pSiS = SISPTR(xf86Screens[pScreen->myNum]);
SISPtr pSiS = SISPTR(xf86ScreenToScrn(pScreen));
SiSIdle
}
......@@ -892,7 +892,7 @@ SiSEXASync(ScreenPtr pScreen, int marker)
static Bool
SiSPrepareSolid(PixmapPtr pPixmap, int alu, Pixel planemask, Pixel fg)
{
ScrnInfoPtr pScrn = xf86Screens[pPixmap->drawable.pScreen->myNum];
ScrnInfoPtr pScrn = xf86ScreenToScrn(pPixmap->drawable.pScreen);
SISPtr pSiS = SISPTR(pScrn);
CARD32 dstbase;
......@@ -940,7 +940,7 @@ SiSPrepareSolid(PixmapPtr pPixmap, int alu, Pixel planemask, Pixel fg)
static void
SiSSolid(PixmapPtr pPixmap, int x1, int y1, int x2, int y2)
{
ScrnInfoPtr pScrn = xf86Screens[pPixmap->drawable.pScreen->myNum];
ScrnInfoPtr pScrn = xf86ScreenToScrn(pPixmap->drawable.pScreen);
SISPtr pSiS = SISPTR(pScrn);
SiSSetupDSTXY(x1, y1)
......@@ -960,7 +960,7 @@ static Bool
SiSPrepareCopy(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);
SISPtr pSiS = SISPTR(pScrn);
CARD32 srcbase, dstbase;
......@@ -1015,7 +1015,7 @@ SiSPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir, int ydir,
static void
SiSCopy(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);
SISPtr pSiS = SISPTR(pScrn);
if(!(pSiS->CommandReg & X_INC)) {
......@@ -1064,7 +1064,7 @@ SiSDGABlitRect(ScrnInfoPtr pScrn, int srcx, int srcy, int dstx, int dsty, int w,
Bool
SiS300AccelInit(ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
SISPtr pSiS = SISPTR(pScrn);
#ifdef SIS_USE_XAA
XAAInfoRecPtr infoPtr = NULL;
......
......@@ -199,7 +199,7 @@ SiSCalcRenderAccelArray(ScrnInfoPtr pScrn)
void
SiSScratchSave(ScreenPtr pScreen, ExaOffscreenArea *area)
{
SISPtr pSiS = SISPTR(xf86Screens[pScreen->myNum]);
SISPtr pSiS = SISPTR(xf86ScreenToScrn(pScreen));
pSiS->exa_scratch = NULL;
}
......@@ -1689,7 +1689,7 @@ SiSSubsequentCPUToScreenTexture(ScrnInfoPtr pScrn,
static void
SiSEXASync(ScreenPtr pScreen, int marker)
{
SISPtr pSiS = SISPTR(xf86Screens[pScreen->myNum]);
SISPtr pSiS = SISPTR(xf86ScreenToScrn(pScreen));
SiSIdle
}
......@@ -1697,7 +1697,7 @@ SiSEXASync(ScreenPtr pScreen, int marker)
static Bool
SiSPrepareSolid(PixmapPtr pPixmap, int alu, Pixel planemask, Pixel fg)
{
ScrnInfoPtr pScrn = xf86Screens[pPixmap->drawable.pScreen->myNum];
ScrnInfoPtr pScrn = xf86ScreenToScrn(pPixmap->drawable.pScreen);
SISPtr pSiS = SISPTR(pScrn);
/* Planemask not supported */
......@@ -1738,7 +1738,7 @@ SiSPrepareSolid(PixmapPtr pPixmap, int alu, Pixel planemask, Pixel fg)
static void
SiSSolid(PixmapPtr pPixmap, int x1, int y1, int x2, int y2)
{
ScrnInfoPtr pScrn = xf86Screens[pPixmap->drawable.pScreen->myNum];
ScrnInfoPtr pScrn = xf86ScreenToScrn(pPixmap->drawable.pScreen);
SISPtr pSiS = SISPTR(pScrn);
/* SiSSetupCMDFlag(BITBLT) - BITBLT = 0 */
......@@ -1757,7 +1757,7 @@ static Bool
SiSPrepareCopy(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);
SISPtr pSiS = SISPTR(pScrn);
CARD32 srcbase, dstbase;
......@@ -1805,7 +1805,7 @@ SiSPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir, int ydir,
static void
SiSCopy(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);
SISPtr pSiS = SISPTR(pScrn);
SiSCheckQueue(16 * 2);
......@@ -1823,7 +1823,7 @@ static Bool
SiSCheckComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture,
PicturePtr pDstPicture)
{
ScrnInfoPtr pScrn = xf86Screens[pDstPicture->pDrawable->pScreen->myNum];
ScrnInfoPtr pScrn = xf86ScreenToScrn(pDstPicture->pDrawable->pScreen);
SISPtr pSiS = SISPTR(pScrn);
xf86DrvMsg(0, 0, "CC: %d Src %x (fi %d ca %d) Msk %x (%d %d) Dst %x (%d %d)\n",
......@@ -1847,7 +1847,7 @@ SiSPrepareComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture,
PicturePtr pDstPicture, PixmapPtr pSrc, PixmapPtr pMask, PixmapPtr pDst)
{
#if 0
ScrnInfoPtr pScrn = xf86Screens[pDst->drawable.pScreen->myNum];
ScrnInfoPtr pScrn = xf86ScreenToScrn(pDst->drawable.pScreen);
SISPtr pSiS = SISPTR(pScrn);
#endif
return FALSE;
......@@ -1858,7 +1858,7 @@ SiSComposite(PixmapPtr pDst, int srcX, int srcY, int maskX, int maskY, int dstX,
int width, int height)
{
#if 0
ScrnInfoPtr pScrn = xf86Screens[pDst->drawable.pScreen->myNum];
ScrnInfoPtr pScrn = xf86ScreenToScrn(pDst->drawable.pScreen);
SISPtr pSiS = SISPTR(pScrn);
#endif
}
......@@ -1872,7 +1872,7 @@ SiSDoneComposite(PixmapPtr pDst)
Bool
SiSUploadToScreen(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);
SISPtr pSiS = SISPTR(pScrn);
unsigned char *dst = pDst->devPrivate.ptr;
int dst_pitch = exaGetPixmapPitch(pDst);
......@@ -1896,7 +1896,7 @@ SiSUploadToScreen(PixmapPtr pDst, int x, int y, int w, int h, char *src, int src
Bool
SiSUploadToScratch(PixmapPtr pSrc, PixmapPtr pDst)
{
ScrnInfoPtr pScrn = xf86Screens[pSrc->drawable.pScreen->myNum];
ScrnInfoPtr pScrn = xf86ScreenToScrn(pSrc->drawable.pScreen);
SISPtr pSiS = SISPTR(pScrn);
unsigned char *src, *dst;
int src_pitch = exaGetPixmapPitch(pSrc);
......@@ -1951,7 +1951,7 @@ SiSUploadToScratch(PixmapPtr pSrc, PixmapPtr pDst)
Bool
SiSDownloadFromScreen(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);
SISPtr pSiS = SISPTR(pScrn);
unsigned char *src = pSrc->devPrivate.ptr;
int src_pitch = exaGetPixmapPitch(pSrc);
......@@ -2013,7 +2013,7 @@ SiSDGABlitRect(ScrnInfoPtr pScrn, int srcx, int srcy, int dstx, int dsty, int w,
Bool
SiS315AccelInit(ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
SISPtr pSiS = SISPTR(pScrn);
#ifdef SIS_USE_XAA
XAAInfoRecPtr infoPtr = NULL;
......
......@@ -152,7 +152,7 @@ static CARD32 get_scanline_CRT1(SISPtr pSiS)
void SIS6326InitVideo(ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
XF86VideoAdaptorPtr *adaptors, *newAdaptors = NULL;
XF86VideoAdaptorPtr newAdaptor = NULL;
int num_adaptors;
......@@ -519,7 +519,7 @@ SIS6326ResetVideo(ScrnInfoPtr pScrn)
static XF86VideoAdaptorPtr
SIS6326SetupImageVideo(ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
SISPtr pSiS = SISPTR(pScrn);
XF86VideoAdaptorPtr adapt;
SISPortPrivPtr pPriv;
......
......@@ -466,7 +466,7 @@ SiSSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno)
static void
SiSEXASync(ScreenPtr pScreen, int marker)
{
SISPtr pSiS = SISPTR(xf86Screens[pScreen->myNum]);
SISPtr pSiS = SISPTR(xf86ScreenToScrn(pScreen));
sisBLTSync;
}
......@@ -474,7 +474,7 @@ SiSEXASync(ScreenPtr pScreen, int marker)
static Bool
SiSPrepareSolid(PixmapPtr pPixmap, int alu, Pixel planemask, Pixel fg)
{
ScrnInfoPtr pScrn = xf86Screens[pPixmap->drawable.pScreen->myNum];
ScrnInfoPtr pScrn = xf86ScreenToScrn(pPixmap->drawable.pScreen);
SISPtr pSiS = SISPTR(pScrn);
/* Planemask not supported */
......@@ -509,7 +509,7 @@ SiSPrepareSolid(PixmapPtr pPixmap, int alu, Pixel planemask, Pixel fg)
static void
SiSSolid(PixmapPtr pPixmap, int x1, int y1, int x2, int y2)
{
ScrnInfoPtr pScrn = xf86Screens[pPixmap->drawable.pScreen->myNum];
ScrnInfoPtr pScrn = xf86ScreenToScrn(pPixmap->drawable.pScreen);
SISPtr pSiS = SISPTR(pScrn);
sisBLTSync;
......@@ -527,7 +527,7 @@ static Bool
SiSPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir, int ydir,
int alu, Pixel planemask)
{
ScrnInfoPtr pScrn = xf86Screens[pSrcPixmap->drawable.pScreen->myNum];
ScrnInfoPtr pScrn = xf86ScreenToScrn(pSrcPixmap->drawable.pScreen);
SISPtr pSiS = SISPTR(pScrn);
/* Planemask not supported */
......@@ -567,7 +567,7 @@ SiSPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir, int ydir,
static void
SiSCopy(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);
SISPtr pSiS = SISPTR(pScrn);
CARD32 srcbase, dstbase, cmd;
int bpp = pSiS->copyBpp;
......@@ -644,7 +644,7 @@ SiSDGABlitRect(ScrnInfoPtr pScrn, int srcx, int srcy, int dstx, int dsty, int w,
Bool
SiSAccelInit(ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
SISPtr pSiS = SISPTR(pScrn);
#ifdef SIS_USE_XAA
XAAInfoRecPtr infoPtr = NULL;
......
......@@ -908,7 +908,7 @@ SiS310LoadCursorImage(ScrnInfoPtr pScrn, UChar *src)
static Bool
SiSUseHWCursor(ScreenPtr pScreen, CursorPtr pCurs)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
SISPtr pSiS = SISPTR(pScrn);
DisplayModePtr mode = pSiS->CurrentLayout.mode;
......@@ -924,7 +924,7 @@ SiSUseHWCursor(ScreenPtr pScreen, CursorPtr pCurs)
static Bool
SiS300UseHWCursor(ScreenPtr pScreen, CursorPtr pCurs)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
SISPtr pSiS = SISPTR(pScrn);
DisplayModePtr mode = pSiS->CurrentLayout.mode;
#ifdef SISMERGED
......@@ -1000,7 +1000,7 @@ SiS300UseHWCursor(ScreenPtr pScreen, CursorPtr pCurs)
static Bool
SiSUseHWCursorARGB(ScreenPtr pScreen, CursorPtr pCurs)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
SISPtr pSiS = SISPTR(pScrn);
DisplayModePtr mode = pSiS->CurrentLayout.mode;
#ifdef SISMERGED
......@@ -1352,7 +1352,7 @@ static void SiS310LoadCursorImageARGB(ScrnInfoPtr pScrn, CursorPtr pCurs)
Bool
SiSHWCursorInit(ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
SISPtr pSiS = SISPTR(pScrn);
xf86CursorInfoPtr infoPtr;
......
......@@ -247,7 +247,7 @@ mode_nogood:
Bool
SISDGAInit(ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
SISPtr pSiS = SISPTR(pScrn);
DGAModePtr modes = NULL;
int num = 0;
......@@ -371,8 +371,8 @@ SIS_SetMode(
pScrn->currentMode = pSiS->CurrentLayout.mode;
pSiS->DGAactive = FALSE;
(*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));
} else { /* set new mode */
......@@ -387,10 +387,10 @@ SIS_SetMode(
pSiS->CurrentLayout.displayWidth = pMode->bytesPerScanline / (pMode->bitsPerPixel >> 3);
pSiS->CurrentLayout.displayHeight = pMode->imageHeight;
(*pScrn->SwitchMode)(index, pMode->mode, 0);
(*pScrn->SwitchMode)(SWITCH_MODE_ARGS(pScrn, pMode->mode));
/* Adjust viewport to 0/0 after mode switch */
/* This fixes the vmware-in-dualhead problems */
(*pScrn->AdjustFrame)(index, 0, 0, 0);
(*pScrn->AdjustFrame)(ADJUST_FRAME_ARGS(pScrn, 0, 0));
pSiS->CurrentLayout.DGAViewportX = pSiS->CurrentLayout.DGAViewportY = 0;
}
......@@ -414,7 +414,7 @@ SIS_SetViewport(
){
SISPtr pSiS = SISPTR(pScrn);
(*pScrn->AdjustFrame)(pScrn->pScreen->myNum, x, y, flags);
(*pScrn->AdjustFrame)(ADJUST_FRAME_ARGS(pScrn, x, y));
pSiS->DGAViewportStatus = 0; /* There are never pending Adjusts */
pSiS->CurrentLayout.DGAViewportX = x;
pSiS->CurrentLayout.DGAViewportY = y;
......
......@@ -128,7 +128,7 @@ static void SISDRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg,
static Bool
SISInitVisualConfigs(ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
SISPtr pSIS = SISPTR(pScrn);
int numConfigs = 0;
__GLXvisualConfig *pConfigs = 0;
......@@ -263,7 +263,7 @@ SISInitVisualConfigs(ScreenPtr pScreen)
Bool
SISDRIScreenInit(ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
SISPtr pSIS = SISPTR(pScrn);
DRIInfoPtr pDRIInfo;
SISDRIPtr pSISDRI;
......@@ -664,7 +664,7 @@ SISDRIScreenInit(ScreenPtr pScreen)
Bool
SISDRIFinishScreenInit(ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
SISPtr pSiS = SISPTR(pScrn);
SISDRIPtr pSISDRI;
......@@ -751,7 +751,7 @@ SISDRIFinishScreenInit(ScreenPtr pScreen)
void
SISDRICloseScreen(ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
SISPtr pSIS = SISPTR(pScrn);
switch(pSIS->VGAEngine) {
......@@ -835,7 +835,7 @@ SISDRISwapContext(ScreenPtr pScreen, DRISyncType syncType,
DRIContextType oldContextType, void *oldContext,
DRIContextType newContextType, void *newContext)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
SISPtr pSiS = SISPTR(pScrn);
#if 0
......@@ -871,7 +871,7 @@ static void
SISDRIInitBuffers(WindowPtr pWin, RegionPtr prgn, CARD32 index)
{
ScreenPtr pScreen = pWin->drawable.pScreen;
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
SISPtr pSiS = SISPTR(pScrn);
switch(pSiS->VGAEngine) {
......@@ -891,7 +891,7 @@ SISDRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg,
RegionPtr prgnSrc, CARD32 index)
{
ScreenPtr pScreen = pParent->drawable.pScreen;
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
SISPtr pSiS = SISPTR(pScrn);
switch(pSiS->VGAEngine) {
......
......@@ -7586,9 +7586,9 @@ SISModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
}
SiSPostSetMode(pScrn, &pSiS->ModeReg);
if(pSiSEnt->pScrn_2) {
SISAdjustFrame(pSiSEnt->pScrn_2->scrnIndex,
SISAdjustFrame(ADJUST_FRAME_ARGS(pSiSEnt->pScrn_2,
pSiSEnt->pScrn_2->frameX0,
pSiSEnt->pScrn_2->frameY0, 0);
pSiSEnt->pScrn_2->frameY0));
}
} else {
/* Head 2 (slave) is always CRT1 */
......@@ -7599,9 +7599,9 @@ SISModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
}
SiSPostSetMode(pScrn, &pSiS->ModeReg);
if(pSiSEnt->pScrn_1) {
SISAdjustFrame(pSiSEnt->pScrn_1->scrnIndex,
SISAdjustFrame(ADJUST_FRAME_ARGS(pSiSEnt->pScrn_1,
pSiSEnt->pScrn_1->frameX0,
pSiSEnt->pScrn_1->frameY0, 0);
pSiSEnt->pScrn_1->frameY0));
}
}
......@@ -8212,14 +8212,14 @@ SISBridgeRestore(ScrnInfoPtr pScrn)
/* Our BlockHandler */
static void
SISBlockHandler(int i, pointer blockData, pointer pTimeout, pointer pReadmask)
SISBlockHandler(BLOCKHANDLER_ARGS_DECL)
{
ScreenPtr pScreen = screenInfo.screens[i];
ScrnInfoPtr pScrn = xf86Screens[i];
SCREEN_PTR(arg);
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
SISPtr pSiS = SISPTR(pScrn);
pScreen->BlockHandler = pSiS->BlockHandler;
(*pScreen->BlockHandler) (i, blockData, pTimeout, pReadmask);
(*pScreen->BlockHandler) (BLOCKHANDLER_ARGS);
pScreen->BlockHandler = SISBlockHandler;
#ifdef SISDUALHEAD
......@@ -8297,7 +8297,7 @@ SiSHandleBackLight(SISPtr pSiS, Bool blon)
static Bool
SISSaveScreen(ScreenPtr pScreen, int mode)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
SISPtr pSiS;
Bool IsUnblank = xf86IsUnblank(mode) ? TRUE : FALSE;
......@@ -8325,7 +8325,7 @@ SISSaveScreen(ScreenPtr pScreen, int mode)
static Bool
SISSaveScreenDH(ScreenPtr pScreen, int mode)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
SISPtr pSiS;
Bool IsUnblank = xf86IsUnblank(mode) ? TRUE : FALSE;
......@@ -8517,9 +8517,9 @@ SISDisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int fla
* depth, bitsPerPixel)
*/
static Bool
SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
SISScreenInit(SCREEN_INIT_ARGS_DECL)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
SISPtr pSiS = SISPTR(pScrn);
VisualPtr visual;
ULong OnScreenSize;
......@@ -8671,7 +8671,7 @@ SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
SISSaveScreen(pScreen, SCREEN_SAVER_ON);
/* Set the viewport */
SISAdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
SISAdjustFrame(ADJUST_FRAME_ARGS(pScrn, pScrn->frameX0, pScrn->frameY0));
/* Reset visual list. */
miClearVisualTypes();
......@@ -9084,7 +9084,7 @@ SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
pSiS->SiS_SD_Flags |= SiS_SD_PSEUDOXINERAMA;
if(pSiS->HaveNonRect) {
/* Reset the viewport (now eventually non-recangular) */
SISAdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
SISAdjustFrame(ADJUST_FRAME_ARGS(pScrn, pScrn->frameX0, pScrn->frameY0));
}
}
} else {
......@@ -9177,20 +9177,20 @@ SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
/* Usually mandatory */
Bool
SISSwitchMode(int scrnIndex, DisplayModePtr mode, int flags)
SISSwitchMode(SWITCH_MODE_ARGS_DECL)
{
ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
SCRN_INFO_PTR(arg);
SISPtr pSiS = SISPTR(pScrn);
if(!pSiS->skipswitchcheck) {
if(SISValidMode(scrnIndex, mode, TRUE, flags) != MODE_OK) {
if(SISValidMode(arg, mode, TRUE, 0) != MODE_OK) {
return FALSE;
}
}
(*pSiS->SyncAccel)(pScrn);
if(!(SISModeInit(xf86Screens[scrnIndex], mode))) return FALSE;
if(!(SISModeInit(pScrn, mode))) return FALSE;
/* Since RandR (indirectly) uses SwitchMode(), we need to
* update our Xinerama info here, too, in case of resizing
......@@ -9275,9 +9275,10 @@ SISAdjustFrameHW_CRT2(ScrnInfoPtr pScrn, int x, int y)
}
static void
SISMergedPointerMoved(int scrnIndex, int x, int y)
SISMergedPointerMoved(SCRN_ARG_TYPE arg, int x, int y)
{
ScrnInfoPtr pScrn1 = xf86Screens[scrnIndex];
SCRN_INFO_PTR(arg);
ScrnInfoPtr pScrn1 = pScrn;
SISPtr pSiS = SISPTR(pScrn1);
ScrnInfoPtr pScrn2 = pSiS->CRT2pScrn;
region out, in1, in2, f2, f1;
......@@ -9554,9 +9555,10 @@ SISMergedPointerMoved(int scrnIndex, int x, int y)
}
static void
SISAdjustFrameMerged(int scrnIndex, int x, int y, int flags)
SISAdjustFrameMerged(ADJUST_FRAME_ARGS_DECL)
{
ScrnInfoPtr pScrn1 = xf86Screens[scrnIndex];
SCRN_INFO_PTR(arg);
ScrnInfoPtr pScrn1 = pScrn;
SISPtr pSiS = SISPTR(pScrn1);
ScrnInfoPtr pScrn2 = pSiS->CRT2pScrn;
int HTotal = pSiS->CurrentLayout.mode->HDisplay;
......@@ -9658,16 +9660,16 @@ SISAdjustFrameMerged(int scrnIndex, int x, int y, int flags)
* Usually mandatory
*/
void
SISAdjustFrame(int scrnIndex, int x, int y, int flags)
SISAdjustFrame(ADJUST_FRAME_ARGS_DECL)
{
ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
SCRN_INFO_PTR(arg);
SISPtr pSiS = SISPTR(pScrn);
ULong base;
UChar temp, cr11backup;
#ifdef SISMERGED
if(pSiS->MergedFB) {
SISAdjustFrameMerged(scrnIndex, x, y, flags);
SISAdjustFrameMerged(ADJUST_FRAME_ARGS(arg, x, y));
return;
}
#endif
......@@ -9756,9 +9758,9 @@ SISAdjustFrame(int scrnIndex, int x, int y, int flags)
* Mandatory!
*/
static Bool
SISEnterVT(int scrnIndex, int flags)
SISEnterVT(VT_FUNC_ARGS_DECL)
{
ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
SCRN_INFO_PTR(arg);
SISPtr pSiS = SISPTR(pScrn);
SiS_SiSFB_Lock(pScrn, TRUE);
......@@ -9776,11 +9778,11 @@ SISEnterVT(int scrnIndex, int flags)
return FALSE;
}
SISAdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
SISAdjustFrame(ADJUST_FRAME_ARGS(pScrn, pScrn->frameX0, pScrn->frameY0));
#ifdef SISDRI
if(pSiS->directRenderingEnabled) {
DRIUnlock(screenInfo.screens[scrnIndex]);
DRIUnlock(xf86ScrnToScreen(pScrn));
}
#endif
......@@ -9800,15 +9802,15 @@ SISEnterVT(int scrnIndex, int flags)
* Mandatory!
*/
static void
SISLeaveVT(int scrnIndex, int flags)
SISLeaveVT(VT_FUNC_ARGS_DECL)
{
ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
SCRN_INFO_PTR(arg);
SISPtr pSiS = SISPTR(pScrn);
#ifdef SISDRI
ScreenPtr pScreen;
if(pSiS->directRenderingEnabled) {
pScreen = screenInfo.screens[scrnIndex];
pScreen = xf86ScrnToScreen(pScrn);
DRILock(pScreen, 0);
}
#endif
......@@ -9876,9 +9878,9 @@ SISLeaveVT(int scrnIndex, int flags)
* Mandatory!
*/
static Bool
SISCloseScreen(int scrnIndex, ScreenPtr pScreen)
SISCloseScreen(CLOSE_SCREEN_ARGS_DECL)
{
ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
SISPtr pSiS = SISPTR(pScrn);
#ifdef SISDUALHEAD
SISEntPtr pSiSEnt = pSiS->entityPrivate;
......@@ -10032,7 +10034,7 @@ SISCloseScreen(int scrnIndex, ScreenPtr pScreen)
pScreen->CloseScreen = pSiS->CloseScreen;
return(*pScreen->CloseScreen)(scrnIndex, pScreen);
return(*pScreen->CloseScreen)(CLOSE_SCREEN_ARGS);
}
......@@ -10040,10 +10042,10 @@ SISCloseScreen(int scrnIndex, ScreenPtr pScreen)
/* Optional */
static void
SISFreeScreen(int scrnIndex, int flags)
SISFreeScreen(FREE_SCREEN_ARGS_DECL)
{
SCRN_INFO_PTR(arg);
#ifdef SIS_NEED_MAP_IOP