diff options
author | Dave Airlie <airlied@redhat.com> | 2012-06-06 10:41:11 +0100 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2012-06-06 10:41:11 +0100 |
commit | a9f3a66e355b9f19c312d399771fb1d8eb2e046d (patch) | |
tree | 1f86ca50a5ccaf835a84722458954b97b757f478 | |
parent | 84468ba28853fa57170025d9c25cb0029a386ff4 (diff) |
mach64: port to new compat API.
Signed-off-by: Dave Airlie <airlied@redhat.com>
-rw-r--r-- | src/Makefile.am | 3 | ||||
-rw-r--r-- | src/atiadjust.c | 14 | ||||
-rw-r--r-- | src/atiadjust.h | 2 | ||||
-rw-r--r-- | src/aticonsole.c | 45 | ||||
-rw-r--r-- | src/aticonsole.h | 8 | ||||
-rw-r--r-- | src/atidga.c | 9 | ||||
-rw-r--r-- | src/atidri.c | 50 | ||||
-rw-r--r-- | src/atimach64accel.c | 2 | ||||
-rw-r--r-- | src/atimach64cursor.c | 4 | ||||
-rw-r--r-- | src/atimach64exa.c | 16 | ||||
-rw-r--r-- | src/atimach64render.c | 8 | ||||
-rw-r--r-- | src/atimach64xv.c | 4 | ||||
-rw-r--r-- | src/atipreinit.c | 2 | ||||
-rw-r--r-- | src/atiscreen.c | 48 | ||||
-rw-r--r-- | src/atiscreen.h | 4 | ||||
-rw-r--r-- | src/atistruct.h | 2 | ||||
-rw-r--r-- | src/ativalid.c | 6 | ||||
-rw-r--r-- | src/ativalid.h | 2 | ||||
-rw-r--r-- | src/compat-api.h | 101 |
19 files changed, 200 insertions, 130 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 7331cb1..4c1498f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -107,4 +107,5 @@ EXTRA_DIST = \ mach64_common.h \ mach64_dri.h \ mach64_sarea.h \ - atipcirename.h + atipcirename.h \ + compat-api.h diff --git a/src/atiadjust.c b/src/atiadjust.c index 267186f..7e3e4f8 100644 --- a/src/atiadjust.c +++ b/src/atiadjust.c @@ -25,12 +25,14 @@ #endif #include "ati.h" -#include "atiadjust.h" +#include "atistruct.h" #include "atichip.h" #include "atilock.h" #include "atimach64io.h" #include "atiwonderio.h" +#include "atiadjust.h" + /* * The display start address is expressed in units of 32-bit (VGA) or 64-bit * (accelerator) words where all planar modes are considered as 4bpp modes. @@ -83,15 +85,9 @@ ATIAdjustPreInit * window. */ void -ATIAdjustFrame -( - int scrnIndex, - int x, - int y, - int flags -) +ATIAdjustFrame(ADJUST_FRAME_ARGS_DECL) { - ScrnInfoPtr pScreenInfo = xf86Screens[scrnIndex]; + SCRN_INFO_PTR(arg); ATIPtr pATI = ATIPTR(pScreenInfo); int Base, xy; diff --git a/src/atiadjust.h b/src/atiadjust.h index 58c6efc..9509596 100644 --- a/src/atiadjust.h +++ b/src/atiadjust.h @@ -26,6 +26,6 @@ #include "atipriv.h" extern void ATIAdjustPreInit(ATIPtr); -extern void ATIAdjustFrame(int, int, int, int); +extern void ATIAdjustFrame(ADJUST_FRAME_ARGS_DECL); #endif /* ___ATIADJUST_H___ */ diff --git a/src/aticonsole.c b/src/aticonsole.c index 50cc6e1..47e9edd 100644 --- a/src/aticonsole.c +++ b/src/aticonsole.c @@ -30,7 +30,6 @@ #include "xorgVersion.h" #include "ati.h" -#include "aticonsole.h" #include "atii2c.h" #include "atilock.h" #include "atimach64.h" @@ -39,6 +38,7 @@ #include "atistruct.h" #include "ativga.h" #include "atividmem.h" +#include "aticonsole.h" #ifdef XF86DRI_DEVEL #include "mach64_common.h" @@ -75,7 +75,7 @@ ATISaveScreen if (!pScreen) return TRUE; - pScreenInfo = xf86Screens[pScreen->myNum]; + pScreenInfo = xf86ScreenToScrn(pScreen); if (!pScreenInfo->vtSema) return TRUE; @@ -558,8 +558,8 @@ ATIEnterGraphics (void)ATISaveScreen(pScreen, SCREEN_SAVER_ON); /* Position the screen */ - (*pScreenInfo->AdjustFrame)(pScreenInfo->scrnIndex, - pScreenInfo->frameX0, pScreenInfo->frameY0, 0); + (*pScreenInfo->AdjustFrame)(ADJUST_FRAME_ARGS(pScreenInfo, + pScreenInfo->frameX0, pScreenInfo->frameY0)); SetTimeSinceLastInputEvent(); @@ -621,18 +621,13 @@ ATILeaveGraphics * This function switches to another graphics video state. */ Bool -ATISwitchMode -( - int iScreen, - DisplayModePtr pMode, - int flags -) +ATISwitchMode(SWITCH_MODE_ARGS_DECL) { - ScrnInfoPtr pScreenInfo = xf86Screens[iScreen]; + SCRN_INFO_PTR(arg); ATIPtr pATI = ATIPTR(pScreenInfo); /* Calculate new hardware data */ - if (!ATIModeCalculate(iScreen, pATI, &pATI->NewHW, pMode)) + if (!ATIModeCalculate(pScreenInfo->scrnIndex, pATI, &pATI->NewHW, pMode)) return FALSE; /* Set new hardware state */ @@ -680,13 +675,9 @@ ATISwitchMode * This function sets the server's virtual console to a graphics video state. */ Bool -ATIEnterVT -( - int iScreen, - int flags -) +ATIEnterVT(VT_FUNC_ARGS_DECL) { - ScrnInfoPtr pScreenInfo = xf86Screens[iScreen]; + SCRN_INFO_PTR(arg); ScreenPtr pScreen = pScreenInfo->pScreen; ATIPtr pATI = ATIPTR(pScreenInfo); PixmapPtr pScreenPixmap; @@ -757,13 +748,9 @@ ATIEnterVT * entry. */ void -ATILeaveVT -( - int iScreen, - int flags -) +ATILeaveVT(VT_FUNC_ARGS_DECL) { - ScrnInfoPtr pScreenInfo = xf86Screens[iScreen]; + SCRN_INFO_PTR(arg); ScreenPtr pScreen = pScreenInfo->pScreen; ATIPtr pATI = ATIPTR(pScreenInfo); @@ -786,16 +773,12 @@ ATILeaveVT * This function frees all driver data related to a screen. */ void -ATIFreeScreen -( - int iScreen, - int flags -) +ATIFreeScreen(FREE_SCREEN_ARGS_DECL) { - ScrnInfoPtr pScreenInfo = xf86Screens[iScreen]; + SCRN_INFO_PTR(arg); ATIPtr pATI = ATIPTR(pScreenInfo); - ATII2CFreeScreen(iScreen); + ATII2CFreeScreen(pScreenInfo->scrnIndex); #ifndef AVOID_CPIO diff --git a/src/aticonsole.h b/src/aticonsole.h index 7e1084a..0dd18cc 100644 --- a/src/aticonsole.h +++ b/src/aticonsole.h @@ -33,11 +33,11 @@ extern void ATISetDPMSMode(ScrnInfoPtr, int, int); extern Bool ATIEnterGraphics(ScreenPtr, ScrnInfoPtr, ATIPtr); extern void ATILeaveGraphics(ScrnInfoPtr, ATIPtr); -extern Bool ATISwitchMode(int, DisplayModePtr, int); +extern Bool ATISwitchMode(SWITCH_MODE_ARGS_DECL); -extern Bool ATIEnterVT(int, int); -extern void ATILeaveVT(int, int); +extern Bool ATIEnterVT(VT_FUNC_ARGS_DECL); +extern void ATILeaveVT(VT_FUNC_ARGS_DECL); -extern void ATIFreeScreen(int, int); +extern void ATIFreeScreen(FREE_SCREEN_ARGS_DECL); #endif /* ___ATICONSOLE_H___ */ diff --git a/src/atidga.c b/src/atidga.c index c1cd163..2560e6b 100644 --- a/src/atidga.c +++ b/src/atidga.c @@ -28,12 +28,12 @@ #include <string.h> #include "ati.h" -#include "atiadjust.h" #include "atichip.h" #include "atidac.h" #include "atidga.h" #include "atimode.h" #include "atistruct.h" +#include "atiadjust.h" #include "dgaproc.h" @@ -94,7 +94,6 @@ ATIDGASetMode { ATIPtr pATI = ATIPTR(pScreenInfo); DisplayModePtr pMode; - int iScreen = pScreenInfo->scrnIndex; int frameX0, frameY0; if (pDGAMode) @@ -128,11 +127,11 @@ ATIDGASetMode ATIAdjustPreInit(pATI); ATIModePreInit(pScreenInfo, pATI, &pATI->NewHW); - if (!(*pScreenInfo->SwitchMode)(iScreen, pMode, 0)) + if (!(*pScreenInfo->SwitchMode)(SWITCH_MODE_ARGS(pScreenInfo, pMode))) return FALSE; if (!pDGAMode) pATI->currentMode = NULL; - (*pScreenInfo->AdjustFrame)(iScreen, frameX0, frameY0, 0); + (*pScreenInfo->AdjustFrame)(ADJUST_FRAME_ARGS(pScreenInfo, frameX0, frameY0)); return TRUE; } @@ -151,7 +150,7 @@ ATIDGASetViewport int flags ) { - (*pScreenInfo->AdjustFrame)(pScreenInfo->pScreen->myNum, x, y, flags); + (*pScreenInfo->AdjustFrame)(ADJUST_FRAME_ARGS(pScreenInfo, x, y)); } /* diff --git a/src/atidri.c b/src/atidri.c index 9c6719b..96804ff 100644 --- a/src/atidri.c +++ b/src/atidri.c @@ -67,7 +67,7 @@ static char ATIClientDriverName[] = "mach64"; */ static Bool ATIInitVisualConfigs( ScreenPtr pScreen ) { - ScrnInfoPtr pScreenInfo = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScreenInfo = xf86ScreenToScrn(pScreen); ATIPtr pATI = ATIPTR(pScreenInfo); int numConfigs = 0; __GLXvisualConfig *pConfigs = NULL; @@ -290,7 +290,7 @@ static void ATIDestroyContext( ScreenPtr pScreen, drm_context_t hwContext, */ static void ATIEnterServer( ScreenPtr pScreen ) { - ScrnInfoPtr pScreenInfo = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScreenInfo = xf86ScreenToScrn(pScreen); ATIPtr pATI = ATIPTR(pScreenInfo); if ( pATI->directRenderingEnabled ) { @@ -336,7 +336,7 @@ static void ATIDRISwapContext( ScreenPtr pScreen, #ifdef USE_XAA static void ATIDRITransitionTo2d(ScreenPtr pScreen) { - ScrnInfoPtr pScreenInfo = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScreenInfo = xf86ScreenToScrn(pScreen); ATIPtr pATI = ATIPTR(pScreenInfo); if (pATI->backArea) { @@ -352,7 +352,7 @@ static void ATIDRITransitionTo2d(ScreenPtr pScreen) static void ATIDRITransitionTo3d(ScreenPtr pScreen) { - ScrnInfoPtr pScreenInfo = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScreenInfo = xf86ScreenToScrn(pScreen); ATIPtr pATI = ATIPTR(pScreenInfo); FBAreaPtr fbArea; int width, height; @@ -406,31 +406,31 @@ static void ATIDRITransitionTo3d(ScreenPtr pScreen) #ifdef USE_EXA static void ATIDRITransitionTo2d_EXA(ScreenPtr pScreen) { - ScrnInfoPtr pScreenInfo = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScreenInfo = xf86ScreenToScrn(pScreen); ATIPtr pATI = ATIPTR(pScreenInfo); ATIDRIServerInfoPtr pATIDRIServer = pATI->pDRIServerInfo; - exaEnableDisableFBAccess(pScreen->myNum, FALSE); + exaEnableDisableFBAccess(SCREEN_ARG(pScreen), FALSE); pATI->pExa->offScreenBase = pATIDRIServer->backOffset; - exaEnableDisableFBAccess(pScreen->myNum, TRUE); + exaEnableDisableFBAccess(SCREEN_ARG(pScreen), TRUE); pATI->have3DWindows = FALSE; } static void ATIDRITransitionTo3d_EXA(ScreenPtr pScreen) { - ScrnInfoPtr pScreenInfo = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScreenInfo = xf86ScreenToScrn(pScreen); ATIPtr pATI = ATIPTR(pScreenInfo); ATIDRIServerInfoPtr pATIDRIServer = pATI->pDRIServerInfo; - exaEnableDisableFBAccess(pScreen->myNum, FALSE); + exaEnableDisableFBAccess(SCREEN_ARG(pScreen), FALSE); pATI->pExa->offScreenBase = pATIDRIServer->textureOffset + pATIDRIServer->textureSize; - exaEnableDisableFBAccess(pScreen->myNum, TRUE); + exaEnableDisableFBAccess(SCREEN_ARG(pScreen), TRUE); pATI->have3DWindows = TRUE; } @@ -441,7 +441,7 @@ static void ATIDRIInitBuffers( WindowPtr pWin, RegionPtr prgn, CARD32 indx ) { #ifdef USE_XAA ScreenPtr pScreen = pWin->drawable.pScreen; - ScrnInfoPtr pScreenInfo = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScreenInfo = xf86ScreenToScrn(pScreen); ATIPtr pATI = ATIPTR(pScreenInfo); ATIDRIServerInfoPtr pATIDRIServer = pATI->pDRIServerInfo; XAAInfoRecPtr pXAAInfo = pATI->pXAAInfo; @@ -508,7 +508,7 @@ static void ATIDRIMoveBuffers( WindowPtr pWin, DDXPointRec ptOldOrg, { #ifdef USE_XAA ScreenPtr pScreen = pWin->drawable.pScreen; - ScrnInfoPtr pScreenInfo = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScreenInfo = xf86ScreenToScrn(pScreen); ATIPtr pATI = ATIPTR(pScreenInfo); XAAInfoRecPtr pXAAInfo = pATI->pXAAInfo; @@ -686,7 +686,7 @@ static int Mach64MinBits(int val) static Bool ATIDRISetBufSize( ScreenPtr pScreen, unsigned int maxSize ) { - ScrnInfoPtr pScreenInfo = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScreenInfo = xf86ScreenToScrn(pScreen); ATIPtr pATI = ATIPTR(pScreenInfo); ATIDRIServerInfoPtr pATIDRIServer = pATI->pDRIServerInfo; @@ -716,7 +716,7 @@ static Bool ATIDRISetBufSize( ScreenPtr pScreen, unsigned int maxSize ) static Bool ATIDRISetAgpMode( ScreenPtr pScreen ) { - ScrnInfoPtr pScreenInfo = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScreenInfo = xf86ScreenToScrn(pScreen); ATIPtr pATI = ATIPTR(pScreenInfo); ATIDRIServerInfoPtr pATIDRIServer = pATI->pDRIServerInfo; @@ -791,7 +791,7 @@ static Bool ATIDRISetAgpMode( ScreenPtr pScreen ) */ static Bool ATIDRIAgpInit( ScreenPtr pScreen ) { - ScrnInfoPtr pScreenInfo = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScreenInfo = xf86ScreenToScrn(pScreen); ATIPtr pATI = ATIPTR(pScreenInfo); ATIDRIServerInfoPtr pATIDRIServer = pATI->pDRIServerInfo; @@ -961,7 +961,7 @@ static Bool ATIDRIAgpInit( ScreenPtr pScreen ) static Bool ATIDRIPciInit( ScreenPtr pScreen ) { - ScrnInfoPtr pScreenInfo = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScreenInfo = xf86ScreenToScrn(pScreen); ATIPtr pATI = ATIPTR(pScreenInfo); ATIDRIServerInfoPtr pATIDRIServer = pATI->pDRIServerInfo; @@ -1013,7 +1013,7 @@ static Bool ATIDRIPciInit( ScreenPtr pScreen ) */ static Bool ATIDRIMapInit( ScreenPtr pScreen ) { - ScrnInfoPtr pScreenInfo = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScreenInfo = xf86ScreenToScrn(pScreen); ATIPtr pATI = ATIPTR(pScreenInfo); ATIDRIServerInfoPtr pATIDRIServer = pATI->pDRIServerInfo; @@ -1036,7 +1036,7 @@ static Bool ATIDRIMapInit( ScreenPtr pScreen ) /* Initialize the kernel data structures. */ static Bool ATIDRIKernelInit( ScreenPtr pScreen ) { - ScrnInfoPtr pScreenInfo = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScreenInfo = xf86ScreenToScrn(pScreen); ATIPtr pATI = ATIPTR(pScreenInfo); ATIDRIServerInfoPtr pATIDRIServer = pATI->pDRIServerInfo; drmMach64Init info; @@ -1077,7 +1077,7 @@ static Bool ATIDRIKernelInit( ScreenPtr pScreen ) */ static Bool ATIDRIAddBuffers( ScreenPtr pScreen ) { - ScrnInfoPtr pScreenInfo = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScreenInfo = xf86ScreenToScrn(pScreen); ATIPtr pATI = ATIPTR(pScreenInfo); ATIDRIServerInfoPtr pATIDRIServer = pATI->pDRIServerInfo; @@ -1109,7 +1109,7 @@ static Bool ATIDRIAddBuffers( ScreenPtr pScreen ) static Bool ATIDRIMapBuffers( ScreenPtr pScreen ) { - ScrnInfoPtr pScreenInfo = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScreenInfo = xf86ScreenToScrn(pScreen); ATIPtr pATI = ATIPTR(pScreenInfo); ATIDRIServerInfoPtr pATIDRIServer = pATI->pDRIServerInfo; @@ -1129,7 +1129,7 @@ static Bool ATIDRIMapBuffers( ScreenPtr pScreen ) static Bool ATIDRIIrqInit( ScreenPtr pScreen ) { - ScrnInfoPtr pScreenInfo = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScreenInfo = xf86ScreenToScrn(pScreen); ATIPtr pATI = ATIPTR(pScreenInfo); if ( pATI->irq <= 0 ) { @@ -1173,7 +1173,7 @@ static Bool ATIDRIIrqInit( ScreenPtr pScreen ) */ Bool ATIDRIScreenInit( ScreenPtr pScreen ) { - ScrnInfoPtr pScreenInfo = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScreenInfo = xf86ScreenToScrn(pScreen); ATIPtr pATI = ATIPTR(pScreenInfo); DRIInfoPtr pDRIInfo; ATIDRIPtr pATIDRI; @@ -1445,7 +1445,7 @@ Bool ATIDRIScreenInit( ScreenPtr pScreen ) */ Bool ATIDRIFinishScreenInit( ScreenPtr pScreen ) { - ScrnInfoPtr pScreenInfo = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScreenInfo = xf86ScreenToScrn(pScreen); ATIPtr pATI = ATIPTR(pScreenInfo); ATISAREAPrivPtr pSAREAPriv; ATIDRIPtr pATIDRI; @@ -1538,7 +1538,7 @@ Bool ATIDRIFinishScreenInit( ScreenPtr pScreen ) */ void ATIDRIResume( ScreenPtr pScreen ) { - ScrnInfoPtr pScreenInfo = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScreenInfo = xf86ScreenToScrn(pScreen); ATIPtr pATI = ATIPTR(pScreenInfo); ATIDRIServerInfoPtr pATIDRIServer = pATI->pDRIServerInfo; @@ -1558,7 +1558,7 @@ void ATIDRIResume( ScreenPtr pScreen ) */ void ATIDRICloseScreen( ScreenPtr pScreen ) { - ScrnInfoPtr pScreenInfo = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScreenInfo = xf86ScreenToScrn(pScreen); ATIPtr pATI = ATIPTR(pScreenInfo); ATIDRIServerInfoPtr pATIDRIServer = pATI->pDRIServerInfo; drmMach64Init info; diff --git a/src/atimach64accel.c b/src/atimach64accel.c index 276fc86..f40155d 100644 --- a/src/atimach64accel.c +++ b/src/atimach64accel.c @@ -976,7 +976,7 @@ ATIMach64AccelInit ScreenPtr pScreen ) { - ScrnInfoPtr pScreenInfo = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScreenInfo = xf86ScreenToScrn(pScreen); ATIPtr pATI = ATIPTR(pScreenInfo); XAAInfoRecPtr pXAAInfo; diff --git a/src/atimach64cursor.c b/src/atimach64cursor.c index a3488bb..c7a8a0a 100644 --- a/src/atimach64cursor.c +++ b/src/atimach64cursor.c @@ -346,7 +346,7 @@ ATIMach64UseHWCursor CursorPtr pCursor ) { - ScrnInfoPtr pScreenInfo = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScreenInfo = xf86ScreenToScrn(pScreen); ATIPtr pATI = ATIPTR(pScreenInfo); if (!pATI->CursorBase) @@ -367,7 +367,7 @@ ATIMach64CursorInit ScreenPtr pScreen ) { - ScrnInfoPtr pScreenInfo = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScreenInfo = xf86ScreenToScrn(pScreen); ATIPtr pATI = ATIPTR(pScreenInfo); xf86CursorInfoPtr pCursorInfo; diff --git a/src/atimach64exa.c b/src/atimach64exa.c index a3e49bf..e4d5307 100644 --- a/src/atimach64exa.c +++ b/src/atimach64exa.c @@ -108,7 +108,7 @@ do { \ static void Mach64WaitMarker(ScreenPtr pScreenInfo, int Marker) { - ATIMach64Sync(xf86Screens[pScreenInfo->myNum]); + ATIMach64Sync(xf86ScreenToScrn(pScreenInfo)); } static Bool @@ -159,7 +159,7 @@ Mach64GetOffsetPitch(PixmapPtr pPix, int bpp, CARD32 *pitch_offset, unsigned int offset, unsigned int pitch) { #if 0 - ScrnInfoPtr pScreenInfo = xf86Screens[pPix->drawable.pScreen->myNum]; + ScrnInfoPtr pScreenInfo = xf86ScreenToScrn(pPix->drawable.pScreen); ATIPtr pATI = ATIPTR(pScreenInfo); if (pitch % pATI->pExa->pixmapPitchAlign != 0) @@ -207,7 +207,7 @@ Mach64PrepareCopy Pixel planemask ) { - ScrnInfoPtr pScreenInfo = xf86Screens[pDstPixmap->drawable.pScreen->myNum]; + ScrnInfoPtr pScreenInfo = xf86ScreenToScrn(pDstPixmap->drawable.pScreen); ATIPtr pATI = ATIPTR(pScreenInfo); CARD32 src_pitch_offset, dst_pitch_offset, dp_pix_width; @@ -259,7 +259,7 @@ Mach64Copy int h ) { - ScrnInfoPtr pScreenInfo = xf86Screens[pDstPixmap->drawable.pScreen->myNum]; + ScrnInfoPtr pScreenInfo = xf86ScreenToScrn(pDstPixmap->drawable.pScreen); ATIPtr pATI = ATIPTR(pScreenInfo); srcX *= pATI->XModifier; @@ -319,7 +319,7 @@ Mach64PrepareSolid Pixel fg ) { - ScrnInfoPtr pScreenInfo = xf86Screens[pPixmap->drawable.pScreen->myNum]; + ScrnInfoPtr pScreenInfo = xf86ScreenToScrn(pPixmap->drawable.pScreen); ATIPtr pATI = ATIPTR(pScreenInfo); CARD32 dst_pitch_offset, dp_pix_width; @@ -358,7 +358,7 @@ Mach64Solid int y2 ) { - ScrnInfoPtr pScreenInfo = xf86Screens[pPixmap->drawable.pScreen->myNum]; + ScrnInfoPtr pScreenInfo = xf86ScreenToScrn(pPixmap->drawable.pScreen); ATIPtr pATI = ATIPTR(pScreenInfo); int x = x1; @@ -468,7 +468,7 @@ static __inline__ int Mach64Log2(int val) static void Mach64SetupMemEXA(ScreenPtr pScreen) { - ScrnInfoPtr pScreenInfo = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScreenInfo = xf86ScreenToScrn(pScreen); ATIPtr pATI = ATIPTR(pScreenInfo); int cpp = (pScreenInfo->bitsPerPixel + 7) / 8; @@ -634,7 +634,7 @@ Mach64SetupMemEXA(ScreenPtr pScreen) Bool ATIMach64ExaInit(ScreenPtr pScreen) { - ScrnInfoPtr pScreenInfo = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScreenInfo = xf86ScreenToScrn(pScreen); ATIPtr pATI = ATIPTR(pScreenInfo); ExaDriverPtr pExa; diff --git a/src/atimach64render.c b/src/atimach64render.c index 1e9485e..4862cd4 100644 --- a/src/atimach64render.c +++ b/src/atimach64render.c @@ -583,7 +583,7 @@ Mach64BlendCntl(Mach64ContextRegs3D *m3d, int op) static Bool Mach64PrepareTexture(PicturePtr pPict, PixmapPtr pPix) { - ScrnInfoPtr pScreenInfo = xf86Screens[pPix->drawable.pScreen->myNum]; + ScrnInfoPtr pScreenInfo = xf86ScreenToScrn(pPix->drawable.pScreen); ATIPtr pATI = ATIPTR(pScreenInfo); Mach64ContextRegs3D *m3d = &pATI->m3d; @@ -671,7 +671,7 @@ Mach64PrepareComposite PixmapPtr pDst ) { - ScrnInfoPtr pScreenInfo = xf86Screens[pDst->drawable.pScreen->myNum]; + ScrnInfoPtr pScreenInfo = xf86ScreenToScrn(pDst->drawable.pScreen); ATIPtr pATI = ATIPTR(pScreenInfo); Mach64ContextRegs3D *m3d = &pATI->m3d; @@ -818,7 +818,7 @@ Mach64Composite int h ) { - ScrnInfoPtr pScreenInfo = xf86Screens[pDst->drawable.pScreen->myNum]; + ScrnInfoPtr pScreenInfo = xf86ScreenToScrn(pDst->drawable.pScreen); ATIPtr pATI = ATIPTR(pScreenInfo); Mach64ContextRegs3D *m3d = &pATI->m3d; @@ -895,7 +895,7 @@ Mach64Composite void Mach64DoneComposite(PixmapPtr pDst) { - ScrnInfoPtr pScreenInfo = xf86Screens[pDst->drawable.pScreen->myNum]; + ScrnInfoPtr pScreenInfo = xf86ScreenToScrn(pDst->drawable.pScreen); ATIPtr pATI = ATIPTR(pScreenInfo); ATIDRISync(pScreenInfo); diff --git a/src/atimach64xv.c b/src/atimach64xv.c index 66bd953..5e43ab8 100644 --- a/src/atimach64xv.c +++ b/src/atimach64xv.c @@ -524,7 +524,7 @@ ATIMach64RemoveLinearCallback FBLinearPtr pLinear ) { - ATIPtr pATI = ATIPTR(xf86Screens[pLinear->pScreen->myNum]); + ATIPtr pATI = ATIPTR(xf86ScreenToScrn(pLinear->pScreen)); pATI->pXVBuffer = NULL; outf(OVERLAY_SCALE_CNTL, SCALE_EN); @@ -1349,7 +1349,7 @@ ATIMach64XVInitialiseAdaptor XF86VideoAdaptorPtr **pppAdaptor ) { - ScreenPtr pScreen = screenInfo.screens[pScreenInfo->scrnIndex]; + ScreenPtr pScreen = xf86ScrnToScreen(pScreenInfo); ATIPtr pATI = ATIPTR(pScreenInfo); XF86VideoAdaptorPtr *ppAdaptor = NULL; XF86VideoAdaptorPtr pAdaptor; diff --git a/src/atipreinit.c b/src/atipreinit.c index 2776a48..0f5c785 100644 --- a/src/atipreinit.c +++ b/src/atipreinit.c @@ -28,7 +28,6 @@ #include <stdio.h> #include "ati.h" -#include "atiadjust.h" #include "atiaudio.h" #include "atibus.h" #include "atichip.h" @@ -50,6 +49,7 @@ #include "atividmem.h" #include "atiwonderio.h" #include "atixv.h" +#include "atiadjust.h" #include "vbe.h" #if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 6 diff --git a/src/atiscreen.c b/src/atiscreen.c index f8e23c9..2957877 100644 --- a/src/atiscreen.c +++ b/src/atiscreen.c @@ -34,17 +34,17 @@ #include "ati.h" #include "atibus.h" #include "atichip.h" -#include "aticonsole.h" #include "aticursor.h" #include "atidac.h" #include "atidga.h" #include "atidri.h" #include "atimach64.h" #include "atimode.h" -#include "atiscreen.h" #include "atistruct.h" +#include "atiscreen.h" #include "atixv.h" #include "atimach64accel.h" +#include "aticonsole.h" #ifdef XF86DRI_DEVEL #include "mach64_dri.h" @@ -124,11 +124,10 @@ ATIMinBits static Bool ATIMach64SetupMemXAA_NoDRI ( - int iScreen, + ScrnInfoPtr pScreenInfo, ScreenPtr pScreen ) { - ScrnInfoPtr pScreenInfo = xf86Screens[iScreen]; ATIPtr pATI = ATIPTR(pScreenInfo); int maxScanlines = ATIMach64MaxY; @@ -166,11 +165,10 @@ ATIMach64SetupMemXAA_NoDRI static Bool ATIMach64SetupMemXAA ( - int iScreen, + ScrnInfoPtr pScreenInfo, ScreenPtr pScreen ) { - ScrnInfoPtr pScreenInfo = xf86Screens[iScreen]; ATIPtr pATI = ATIPTR(pScreenInfo); ATIDRIServerInfoPtr pATIDRIServer = pATI->pDRIServerInfo; @@ -276,7 +274,7 @@ ATIMach64SetupMemXAA if (scanlines > ATIMach64MaxY) scanlines = ATIMach64MaxY; if ( pATIDRIServer->IsPCI && pATIDRIServer->textureSize == 0 ) { - xf86DrvMsg(iScreen, X_WARNING, + xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING, "Not enough memory for local textures, disabling DRI\n"); ATIDRICloseScreen(pScreen); pATI->directRenderingEnabled = FALSE; @@ -322,13 +320,13 @@ ATIMach64SetupMemXAA } - xf86DrvMsg(iScreen, X_INFO, "Will use %d kB of offscreen memory for XAA\n", + xf86DrvMsg(pScreenInfo->scrnIndex, X_INFO, "Will use %d kB of offscreen memory for XAA\n", (offscreenBytes - pATIDRIServer->textureSize)/1024); - xf86DrvMsg(iScreen, X_INFO, "Will use back buffer at offset 0x%x\n", + xf86DrvMsg(pScreenInfo->scrnIndex, X_INFO, "Will use back buffer at offset 0x%x\n", pATIDRIServer->backOffset); - xf86DrvMsg(iScreen, X_INFO, "Will use depth buffer at offset 0x%x\n", + xf86DrvMsg(pScreenInfo->scrnIndex, X_INFO, "Will use depth buffer at offset 0x%x\n", pATIDRIServer->depthOffset); if (pATIDRIServer->textureSize > 0) { @@ -350,15 +348,9 @@ ATIMach64SetupMemXAA * This function is called by DIX to initialise the screen. */ Bool -ATIScreenInit -( - int iScreen, - ScreenPtr pScreen, - int argc, - char **argv -) +ATIScreenInit(SCREEN_INIT_ARGS_DECL) { - ScrnInfoPtr pScreenInfo = xf86Screens[iScreen]; + ScrnInfoPtr pScreenInfo = xf86ScreenToScrn(pScreen); ATIPtr pATI = ATIPTR(pScreenInfo); pointer pFB; int VisualMask; @@ -411,7 +403,7 @@ ATIScreenInit * 3D triangle setup (the VERTEX_* registers) */ if (pATI->Chip < ATI_CHIP_264GTPRO) { - xf86DrvMsg(iScreen, X_WARNING, + xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING, "Direct rendering is not supported for ATI chips earlier than " "the ATI 3D Rage Pro.\n"); pATI->directRenderingEnabled = FALSE; @@ -428,13 +420,13 @@ ATIScreenInit + (pScreenInfo->virtualY * 2 / cpp); /* depth buffer (always 16-bit) */ if (!pATI->OptionAccel) { - xf86DrvMsg(iScreen, X_WARNING, + xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING, "Acceleration disabled, not initializing the DRI\n"); pATI->directRenderingEnabled = FALSE; } else if ( maxY > requiredY ) { pATI->directRenderingEnabled = ATIDRIScreenInit(pScreen); } else { - xf86DrvMsg(iScreen, X_WARNING, + xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING, "DRI static buffer allocation failed -- " "need at least %d kB video memory\n", (pScreenInfo->displayWidth * requiredY * cpp ) / 1024); @@ -512,13 +504,13 @@ ATIScreenInit #ifdef XF86DRI_DEVEL if (pATI->directRenderingEnabled) { - if (!ATIMach64SetupMemXAA(iScreen, pScreen)) + if (!ATIMach64SetupMemXAA(pScreenInfo, pScreen)) return FALSE; } else #endif /* XF86DRI_DEVEL */ { - if (!ATIMach64SetupMemXAA_NoDRI(iScreen, pScreen)) + if (!ATIMach64SetupMemXAA_NoDRI(pScreenInfo, pScreen)) return FALSE; } @@ -620,13 +612,9 @@ ATIScreenInit * This function is called by DIX to close the screen. */ Bool -ATICloseScreen -( - int iScreen, - ScreenPtr pScreen -) +ATICloseScreen (CLOSE_SCREEN_ARGS_DECL) { - ScrnInfoPtr pScreenInfo = xf86Screens[iScreen]; + ScrnInfoPtr pScreenInfo = xf86ScreenToScrn(pScreen); ATIPtr pATI = ATIPTR(pScreenInfo); #ifdef XF86DRI_DEVEL @@ -680,5 +668,5 @@ ATICloseScreen pScreenInfo->pScreen = NULL; pScreen->CloseScreen = pATI->CloseScreen; - return (*pScreen->CloseScreen)(iScreen, pScreen); + return (*pScreen->CloseScreen)(CLOSE_SCREEN_ARGS); } diff --git a/src/atiscreen.h b/src/atiscreen.h index cf2b23d..e180a72 100644 --- a/src/atiscreen.h +++ b/src/atiscreen.h @@ -25,7 +25,7 @@ #include "screenint.h" -extern Bool ATIScreenInit(int, ScreenPtr, int, char **); -extern Bool ATICloseScreen(int, ScreenPtr); +extern Bool ATIScreenInit(SCREEN_INIT_ARGS_DECL); +extern Bool ATICloseScreen(CLOSE_SCREEN_ARGS_DECL); #endif /* ___ATISCREEN_H___ */ diff --git a/src/atistruct.h b/src/atistruct.h index 87f2a5d..702360b 100644 --- a/src/atistruct.h +++ b/src/atistruct.h @@ -65,6 +65,8 @@ #include "atipcirename.h" +#include "compat-api.h" + #define CacheSlotOf(____Register) ((____Register) / UnitOf(DWORD_SELECT)) /* diff --git a/src/ativalid.c b/src/ativalid.c index 51cf5ae..122f594 100644 --- a/src/ativalid.c +++ b/src/ativalid.c @@ -24,11 +24,11 @@ #include "config.h" #endif +#include "xf86.h" #include "atichip.h" #include "atistruct.h" #include "ativalid.h" -#include "xf86.h" /* * ATIValidMode -- @@ -38,13 +38,13 @@ ModeStatus ATIValidMode ( - int iScreen, + SCRN_ARG_TYPE arg, DisplayModePtr pMode, Bool Verbose, int flags ) { - ScrnInfoPtr pScreenInfo = xf86Screens[iScreen]; + SCRN_INFO_PTR(arg); ATIPtr pATI = ATIPTR(pScreenInfo); int HBlankWidth, HAdjust, VScan, VInterlace; diff --git a/src/ativalid.h b/src/ativalid.h index 608e1b5..1e057b5 100644 --- a/src/ativalid.h +++ b/src/ativalid.h @@ -25,6 +25,6 @@ #include "xf86str.h" -extern ModeStatus ATIValidMode(int, DisplayModePtr, Bool, int); +extern ModeStatus ATIValidMode(SCRN_ARG_TYPE arg, DisplayModePtr, Bool, int); #endif /* ___ATIVALID_H___ */ diff --git a/src/compat-api.h b/src/compat-api.h new file mode 100644 index 0000000..34d88b4 --- /dev/null +++ b/src/compat-api.h @@ -0,0 +1,101 @@ +/* + * 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 pScreenInfo = 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 pMode, 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 pScreenInfo->scrnIndex, 0 + +#define XF86_SCRN_ARG(x) ((x)->scrnIndex) +#define SCREEN_ARG(x) ((x)->myNum) +#else +#define SCRN_ARG_TYPE ScrnInfoPtr +#define SCRN_INFO_PTR(arg1) ScrnInfoPtr pScreenInfo = (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 pMode +#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 pScreenInfo + +#define XF86_SCRN_ARG(x) (x) + +#define SCREEN_ARG(x) (x) +#endif + +#endif |