diff -Nau -x CVS -x 'Makefile*' -x '*o' -x '*a' xf86-video-ati/src/atiaccel.c xf86-video-ati-exa/src/atiaccel.c --- xf86-video-ati/src/atiaccel.c 2006-02-05 16:26:43.000000000 +0200 +++ xf86-video-ati-exa/src/atiaccel.c 2006-02-28 15:04:56.000000000 +0200 @@ -49,7 +49,8 @@ { int maxScanlines = 32767, maxPixelArea, PixelArea; - if (pATI->OptionAccel) +#ifdef USE_XAA + if (!pATI->useEXA && pATI->OptionAccel) { if (!(pATI->pXAAInfo = XAACreateInfoRec())) return FALSE; @@ -57,13 +58,14 @@ switch (pATI->Adapter) { case ATI_ADAPTER_MACH64: - maxScanlines = ATIMach64AccelInit(pATI, pATI->pXAAInfo); + maxScanlines = ATIMach64XaaInit(pATI, pATI->pXAAInfo); break; default: break; } } +#endif #ifndef AVOID_CPIO @@ -73,8 +75,8 @@ #ifdef XF86DRI_DEVEL - /* If DRI is enabled, we've already set up the FB manager in ATIScreenInit */ - if (!pATI->directRenderingEnabled) + /* If DRI is enabled, we've already set up the FB manager in ATIScreenInit */ + if (!pATI->directRenderingEnabled) #endif /* XF86DRI */ { @@ -90,11 +92,24 @@ xf86InitFBManagerArea(pScreen, PixelArea, 2); } - if (!pATI->OptionAccel || XAAInit(pScreen, pATI->pXAAInfo)) + if (!pATI->OptionAccel) return TRUE; - XAADestroyInfoRec(pATI->pXAAInfo); - pATI->pXAAInfo = NULL; +#ifdef USE_XAA + if (!pATI->useEXA) { + if(XAAInit(pScreen, pATI->pXAAInfo)) + return TRUE; + + XAADestroyInfoRec(pATI->pXAAInfo); + pATI->pXAAInfo = NULL; + } +#endif +#ifdef USE_EXA + if (pATI->useEXA) { + ATIMach64ExaInit(pScreen); + return TRUE; + } +#endif return FALSE; } @@ -106,8 +121,13 @@ int Size ) { +#define DEBUG_OFFSCREEN +#undef DEBUG_OFFSCREEN if (Size <= 0) { +#ifdef DEBUG_OFFSCREEN + xf86DrvMsg(pScreen->myNum, X_INFO, "Offscreen: free %p\n", pLinear); +#endif xf86FreeOffscreenLinear(pLinear); return NULL; } @@ -117,11 +137,17 @@ if ((pLinear->size >= Size) || xf86ResizeOffscreenLinear(pLinear, Size)) { +#ifdef DEBUG_OFFSCREEN + xf86DrvMsg(pScreen->myNum, X_INFO, "Offscreen: resz %p ok (%lx -> %lx)\n", pLinear, pLinear->size, Size); +#endif pLinear->MoveLinearCallback = NULL; pLinear->RemoveLinearCallback = NULL; return pLinear; } +#ifdef DEBUG_OFFSCREEN + xf86DrvMsg(pScreen->myNum, X_INFO, "Offscreen: resz %p free\n", pLinear); +#endif xf86FreeOffscreenLinear(pLinear); } @@ -131,16 +157,25 @@ { int maxSize; +#ifdef DEBUG_OFFSCREEN + xf86DrvMsg(pScreen->myNum, X_INFO, "Offscreen: allo %p query largest\n", pLinear); +#endif xf86QueryLargestOffscreenLinear(pScreen, &maxSize, 16, PRIORITY_EXTREME); if (maxSize < Size) return NULL; +#ifdef DEBUG_OFFSCREEN + xf86DrvMsg(pScreen->myNum, X_INFO, "Offscreen: allo %p evict unlocked\n", pLinear); +#endif xf86PurgeUnlockedOffscreenAreas(pScreen); pLinear = xf86AllocateOffscreenLinear(pScreen, Size, 16, NULL, NULL, NULL); } +#ifdef DEBUG_OFFSCREEN + xf86DrvMsg(pScreen->myNum, X_INFO, "Offscreen: allo %p ok (%lx -> %lx)\n", pLinear, pLinear->size, Size); +#endif return pLinear; } diff -Nau -x CVS -x 'Makefile*' -x '*o' -x '*a' xf86-video-ati/src/aticonfig.c xf86-video-ati-exa/src/aticonfig.c --- xf86-video-ati/src/aticonfig.c 2006-02-05 16:26:43.000000000 +0200 +++ xf86-video-ati-exa/src/aticonfig.c 2006-02-20 23:05:36.000000000 +0200 @@ -151,6 +151,7 @@ # define ProbeClocks PublicOption[ATI_OPTION_PROBE_CLOCKS].value.bool # define ShadowFB PublicOption[ATI_OPTION_SHADOW_FB].value.bool # define SWCursor PublicOption[ATI_OPTION_SWCURSOR].value.bool +# define AccelMethod PublicOption[ATI_OPTION_ACCELMETHOD].value.str # define LCDSync PrivateOption[ATI_OPTION_LCDSYNC].value.bool # define ReferenceClock \ @@ -338,5 +339,25 @@ } } + pATI->useEXA = FALSE; + if (pATI->OptionAccel) + { + MessageType from = X_DEFAULT; +#if defined(USE_EXA) +#if defined(USE_XAA) + if (AccelMethod != NULL) { + from = X_CONFIG; + if (xf86NameCmp(AccelMethod, "EXA") == 0) + pATI->useEXA = TRUE; + } +#else /* USE_XAA */ + pATI->useEXA = TRUE; +#endif /* !USE_XAA */ +#endif /* USE_EXA */ + xf86DrvMsg(pScreenInfo->scrnIndex, from, + "Using %s acceleration architecture\n", + pATI->useEXA ? "EXA" : "XAA"); + } + xfree(PublicOption); } diff -Nau -x CVS -x 'Makefile*' -x '*o' -x '*a' xf86-video-ati/src/aticonsole.c xf86-video-ati-exa/src/aticonsole.c --- xf86-video-ati/src/aticonsole.c 2005-07-11 05:29:44.000000000 +0300 +++ xf86-video-ati-exa/src/aticonsole.c 2006-02-23 17:35:58.000000000 +0200 @@ -37,6 +37,7 @@ #include "atilock.h" #include "atimach64.h" #include "atimach64io.h" +#include "atimach64iodri.h" #include "atimode.h" #include "atistruct.h" #include "ativga.h" diff -Nau -x CVS -x 'Makefile*' -x '*o' -x '*a' xf86-video-ati/src/atidga.c xf86-video-ati-exa/src/atidga.c --- xf86-video-ati/src/atidga.c 2005-07-11 05:29:44.000000000 +0300 +++ xf86-video-ati-exa/src/atidga.c 2006-02-23 00:35:15.000000000 +0200 @@ -186,6 +186,8 @@ ) { ATIPtr pATI = ATIPTR(pScreenInfo); +/*FIXME : use EXA if available */ +#ifdef USE_XAA XAAInfoRecPtr pXAAInfo = pATI->pXAAInfo; (*pXAAInfo->SetupForSolidFill)(pScreenInfo, (int)colour, GXcopy, @@ -194,6 +196,7 @@ if (pScreenInfo->bitsPerPixel == pATI->bitsPerPixel) SET_SYNC_FLAG(pXAAInfo); +#endif } /* @@ -215,6 +218,8 @@ ) { ATIPtr pATI = ATIPTR(pScreenInfo); +/*FIXME : use EXA if available */ +#ifdef USE_XAA XAAInfoRecPtr pXAAInfo = pATI->pXAAInfo; int xdir = ((xSrc < xDst) && (ySrc == yDst)) ? -1 : 1; int ydir = (ySrc < yDst) ? -1 : 1; @@ -226,6 +231,7 @@ if (pScreenInfo->bitsPerPixel == pATI->bitsPerPixel) SET_SYNC_FLAG(pXAAInfo); +#endif } /* @@ -248,6 +254,8 @@ ) { ATIPtr pATI = ATIPTR(pScreenInfo); +/*FIXME : use EXA if available */ +#ifdef USE_XAA XAAInfoRecPtr pXAAInfo = pATI->pXAAInfo; int xdir = ((xSrc < xDst) && (ySrc == yDst)) ? -1 : 1; int ydir = (ySrc < yDst) ? -1 : 1; @@ -264,6 +272,7 @@ if (pScreenInfo->bitsPerPixel == pATI->bitsPerPixel) SET_SYNC_FLAG(pXAAInfo); +#endif } /* @@ -333,8 +342,10 @@ pDGAMode->flags |= DGA_PIXMAP_AVAILABLE; pDGAMode->address = pATI->pMemory; +#ifdef USE_XAA if (pATI->pXAAInfo) pDGAMode->flags &= ~DGA_CONCURRENT_ACCESS; +#endif } if ((pMode->Flags & V_DBLSCAN) || (pMode->VScan > 1)) pDGAMode->flags |= DGA_DOUBLESCAN; @@ -395,7 +406,9 @@ ATIPtr pATI ) { +#ifdef USE_XAA XAAInfoRecPtr pXAAInfo; +#endif int flags; if (!pATI->nDGAMode) @@ -420,6 +433,7 @@ pATI->ATIDGAFunctions.GetViewport = ATIDGAGetViewport; flags = 0; +#ifdef USE_XAA if ((pXAAInfo = pATI->pXAAInfo)) { pATI->ATIDGAFunctions.Sync = pXAAInfo->Sync; @@ -437,6 +451,7 @@ pATI->ATIDGAFunctions.BlitTransRect = ATIDGABlitTransRect; } } +#endif if (!flags) flags = DGA_CONCURRENT_ACCESS; diff -Nau -x CVS -x 'Makefile*' -x '*o' -x '*a' xf86-video-ati/src/atidri.c xf86-video-ati-exa/src/atidri.c --- xf86-video-ati/src/atidri.c 2006-02-20 15:32:57.000000000 +0200 +++ xf86-video-ati-exa/src/atidri.c 2006-02-27 17:58:34.000000000 +0200 @@ -40,6 +40,7 @@ #include "ativersion.h" #include "atimach64io.h" +#include "atimach64iodri.h" #include "mach64_dri.h" #include "mach64_common.h" #include "mach64_sarea.h" @@ -267,7 +268,11 @@ drm_context_t hwContext, void *pVisualConfigPriv, DRIContextType contextStore ) { - /* Nothing yet */ + ScrnInfoPtr pScreenInfo = xf86Screens[pScreen->myNum]; + ATIPtr pATI = ATIPTR(pScreenInfo); + + pATI->drmCtx = hwContext; + return TRUE; } @@ -289,9 +294,9 @@ ScrnInfoPtr pScreenInfo = xf86Screens[pScreen->myNum]; ATIPtr pATI = ATIPTR(pScreenInfo); - if ( pATI->directRenderingEnabled && pATI->pXAAInfo ) { - pATI->pXAAInfo->NeedToSync = TRUE; - pATI->NeedDRISync = TRUE; + if ( pATI->directRenderingEnabled ) { + ATIDRIMarkSyncInt(pScreenInfo); + ATIDRIMarkSyncExt(pScreenInfo); } } @@ -400,6 +405,7 @@ /* Initialize the state of the back and depth buffers. */ static void ATIDRIInitBuffers( WindowPtr pWin, RegionPtr prgn, CARD32 indx ) { +#ifdef USE_XAA ScreenPtr pScreen = pWin->drawable.pScreen; ScrnInfoPtr pScreenInfo = xf86Screens[pScreen->myNum]; ATIPtr pATI = ATIPTR(pScreenInfo); @@ -450,7 +456,8 @@ pbox->x2 - pbox->x1, pbox->y2 - pbox->y1); - pXAAInfo->NeedToSync = TRUE; + ATIDRIMarkSyncInt(pScreenInfo); +#endif } /* Copy the back and depth buffers when the X server moves a window. @@ -465,6 +472,7 @@ static void ATIDRIMoveBuffers( WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc, CARD32 indx ) { +#ifdef USE_XAA ScreenPtr pScreen = pWin->drawable.pScreen; ScrnInfoPtr pScreenInfo = xf86Screens[pScreen->myNum]; ATIPtr pATI = ATIPTR(pScreenInfo); @@ -628,7 +636,8 @@ DEALLOCATE_LOCAL(pptNew1); DEALLOCATE_LOCAL(pboxNew1); - pXAAInfo->NeedToSync = TRUE; + ATIDRIMarkSyncInt(pScreenInfo); +#endif } /* Compute log base 2 of val. */ diff -Nau -x CVS -x 'Makefile*' -x '*o' -x '*a' xf86-video-ati/src/atiload.c xf86-video-ati-exa/src/atiload.c --- xf86-video-ati/src/atiload.c 2005-07-11 05:29:44.000000000 +0300 +++ xf86-video-ati-exa/src/atiload.c 2006-02-27 15:39:41.000000000 +0200 @@ -144,6 +144,18 @@ NULL }; +#ifdef USE_EXA +const char *ATIexaSymbols[] = +{ + "exaDriverInit", + "exaDriverFini", + "exaOffscreenAlloc", + "exaOffscreenFree", + NULL +}; +#endif + +#ifdef USE_XAA const char *ATIxaaSymbols[] = { "XAACreateInfoRec", @@ -151,6 +163,7 @@ "XAAInit", NULL }; +#endif const char *ATIramdacSymbols[] = { @@ -205,21 +218,13 @@ ATIPtr pATI ) { + pointer fbPtr = NULL; + /* Load shadow frame buffer code if needed */ if (pATI->OptionShadowFB && !ATILoadModule(pScreenInfo, "shadowfb", ATIshadowfbSymbols)) return NULL; - /* Load XAA if needed */ - if (pATI->OptionAccel && - !ATILoadModule(pScreenInfo, "xaa", ATIxaaSymbols)) - return NULL; - - /* Load ramdac module if needed */ - if ((pATI->Cursor > ATI_CURSOR_SOFTWARE) && - !ATILoadModule(pScreenInfo, "ramdac", ATIramdacSymbols)) - return NULL; - /* Load depth-specific entry points */ switch (pATI->bitsPerPixel) { @@ -227,10 +232,12 @@ #ifndef AVOID_CPIO case 1: - return ATILoadModule(pScreenInfo, "xf1bpp", ATIxf1bppSymbols); + fbPtr = ATILoadModule(pScreenInfo, "xf1bpp", ATIxf1bppSymbols); + break; case 4: - return ATILoadModule(pScreenInfo, "xf4bpp", ATIxf4bppSymbols); + fbPtr = ATILoadModule(pScreenInfo, "xf4bpp", ATIxf4bppSymbols); + break; #endif /* AVOID_CPIO */ @@ -238,11 +245,34 @@ case 16: case 24: case 32: - return ATILoadModule(pScreenInfo, "fb", ATIfbSymbols); + fbPtr = ATILoadModule(pScreenInfo, "fb", ATIfbSymbols); + break; default: return NULL; } + if (!fbPtr) + return NULL; + + /* Load ramdac module if needed */ + if ((pATI->Cursor > ATI_CURSOR_SOFTWARE) && + !ATILoadModule(pScreenInfo, "ramdac", ATIramdacSymbols)) + return NULL; + +#ifdef USE_EXA + /* Load EXA if needed */ + if (pATI->useEXA && pATI->OptionAccel && + !ATILoadModule(pScreenInfo, "exa", ATIexaSymbols)) + return NULL; +#endif +#ifdef USE_XAA + /* Load XAA if needed */ + if (!pATI->useEXA && pATI->OptionAccel && + !ATILoadModule(pScreenInfo, "xaa", ATIxaaSymbols)) + return NULL; +#endif + + return fbPtr; } #endif /* XFree86LOADER */ diff -Nau -x CVS -x 'Makefile*' -x '*o' -x '*a' xf86-video-ati/src/atiload.h xf86-video-ati-exa/src/atiload.h --- xf86-video-ati/src/atiload.h 2004-09-21 21:10:34.000000000 +0300 +++ xf86-video-ati-exa/src/atiload.h 2006-02-20 21:42:24.000000000 +0200 @@ -47,7 +47,20 @@ #endif /* XF86DRI_DEVEL */ - *ATIfbSymbols[], *ATIshadowfbSymbols[], *ATIxaaSymbols[], + *ATIfbSymbols[], *ATIshadowfbSymbols[], + +#ifdef USE_EXA + + *ATIexaSymbols[], + +#endif /* USE_EXA */ + +#ifdef USE_XAA + + *ATIxaaSymbols[], + +#endif /* USE_XAA */ + *ATIramdacSymbols[], *ATIi2cSymbols[]; extern pointer ATILoadModule(ScrnInfoPtr, const char *, const char **); diff -Nau -x CVS -x 'Makefile*' -x '*o' -x '*a' xf86-video-ati/src/atimach64accel.c xf86-video-ati-exa/src/atimach64accel.c --- xf86-video-ati/src/atimach64accel.c 2006-02-05 16:26:44.000000000 +0200 +++ xf86-video-ati-exa/src/atimach64accel.c 2006-02-23 17:40:31.000000000 +0200 @@ -57,11 +57,13 @@ #include "atichip.h" #include "atimach64accel.h" #include "atimach64io.h" +#include "atimach64iodri.h" #include "atipriv.h" #include "atiregs.h" #ifdef XF86DRI_DEVEL #include "mach64_common.h" +#include "mach64_sarea.h" #endif #include "miline.h" @@ -79,7 +81,7 @@ /* * X-to-Mach64 mix translation table. */ -static CARD8 ATIMach64ALU[16] = +CARD8 ATIMach64ALU[16] = { MIX_0, /* GXclear */ MIX_AND, /* GXand */ @@ -105,7 +107,7 @@ * This function ensures the current scissor settings do not interfere with * the current draw request. */ -static void +void ATIMach64ValidateClip ( ATIPtr pATI, @@ -130,6 +132,67 @@ } } +static __inline__ void TestRegisterCachingXV +( + ScrnInfoPtr pScreenInfo +) +{ + ATIPtr pATI = ATIPTR(pScreenInfo); + + if (pATI->Block1Base) + { + TestRegisterCaching(OVERLAY_Y_X_START); + TestRegisterCaching(OVERLAY_Y_X_END); + + TestRegisterCaching(OVERLAY_GRAPHICS_KEY_CLR); + TestRegisterCaching(OVERLAY_GRAPHICS_KEY_MSK); + + TestRegisterCaching(OVERLAY_KEY_CNTL); + + TestRegisterCaching(OVERLAY_SCALE_INC); + TestRegisterCaching(OVERLAY_SCALE_CNTL); + + TestRegisterCaching(SCALER_HEIGHT_WIDTH); + + TestRegisterCaching(SCALER_TEST); + + TestRegisterCaching(VIDEO_FORMAT); + + if (pATI->Chip < ATI_CHIP_264VTB) + { + TestRegisterCaching(BUF0_OFFSET); + TestRegisterCaching(BUF0_PITCH); + TestRegisterCaching(BUF1_OFFSET); + TestRegisterCaching(BUF1_PITCH); + } + else + { + TestRegisterCaching(SCALER_BUF0_OFFSET); + TestRegisterCaching(SCALER_BUF1_OFFSET); + TestRegisterCaching(SCALER_BUF_PITCH); + + TestRegisterCaching(OVERLAY_EXCLUSIVE_HORZ); + TestRegisterCaching(OVERLAY_EXCLUSIVE_VERT); + + if (pATI->Chip >= ATI_CHIP_264GTPRO) + { + TestRegisterCaching(SCALER_COLOUR_CNTL); + + TestRegisterCaching(SCALER_H_COEFF0); + TestRegisterCaching(SCALER_H_COEFF1); + TestRegisterCaching(SCALER_H_COEFF2); + TestRegisterCaching(SCALER_H_COEFF3); + TestRegisterCaching(SCALER_H_COEFF4); + + TestRegisterCaching(SCALER_BUF0_OFFSET_U); + TestRegisterCaching(SCALER_BUF0_OFFSET_V); + TestRegisterCaching(SCALER_BUF1_OFFSET_U); + TestRegisterCaching(SCALER_BUF1_OFFSET_V); + } + } + } +} + /* * ATIMach64Sync -- * @@ -219,61 +282,8 @@ TestRegisterCaching(CLR_CMP_CLR); TestRegisterCaching(CLR_CMP_MSK); - if (pATI->Block1Base) - { - TestRegisterCaching(OVERLAY_Y_X_START); - TestRegisterCaching(OVERLAY_Y_X_END); - - TestRegisterCaching(OVERLAY_GRAPHICS_KEY_CLR); - TestRegisterCaching(OVERLAY_GRAPHICS_KEY_MSK); - - TestRegisterCaching(OVERLAY_KEY_CNTL); - - TestRegisterCaching(OVERLAY_SCALE_INC); - TestRegisterCaching(OVERLAY_SCALE_CNTL); - - TestRegisterCaching(SCALER_HEIGHT_WIDTH); - - TestRegisterCaching(SCALER_TEST); - - TestRegisterCaching(VIDEO_FORMAT); - - if (pATI->Chip < ATI_CHIP_264VTB) - { - TestRegisterCaching(BUF0_OFFSET); - TestRegisterCaching(BUF0_PITCH); - TestRegisterCaching(BUF1_OFFSET); - TestRegisterCaching(BUF1_PITCH); - } - else - { - TestRegisterCaching(SCALER_BUF0_OFFSET); - TestRegisterCaching(SCALER_BUF1_OFFSET); - TestRegisterCaching(SCALER_BUF_PITCH); - - TestRegisterCaching(OVERLAY_EXCLUSIVE_HORZ); - TestRegisterCaching(OVERLAY_EXCLUSIVE_VERT); - - if (pATI->Chip >= ATI_CHIP_264GTPRO) - { - TestRegisterCaching(SCALER_COLOUR_CNTL); - - TestRegisterCaching(SCALER_H_COEFF0); - TestRegisterCaching(SCALER_H_COEFF1); - TestRegisterCaching(SCALER_H_COEFF2); - TestRegisterCaching(SCALER_H_COEFF3); - TestRegisterCaching(SCALER_H_COEFF4); - - TestRegisterCaching(SCALER_BUF0_OFFSET_U); - TestRegisterCaching(SCALER_BUF0_OFFSET_V); - TestRegisterCaching(SCALER_BUF1_OFFSET_U); - TestRegisterCaching(SCALER_BUF1_OFFSET_V); - } - } - } - } - pATI->NeedDRISync = FALSE; - + TestRegisterCachingXV(pScreenInfo); + } } else @@ -322,73 +332,22 @@ TestRegisterCaching(CLR_CMP_MSK); TestRegisterCaching(CLR_CMP_CNTL); - if (pATI->Block1Base) - { - TestRegisterCaching(OVERLAY_Y_X_START); - TestRegisterCaching(OVERLAY_Y_X_END); - - TestRegisterCaching(OVERLAY_GRAPHICS_KEY_CLR); - TestRegisterCaching(OVERLAY_GRAPHICS_KEY_MSK); - - TestRegisterCaching(OVERLAY_KEY_CNTL); - - TestRegisterCaching(OVERLAY_SCALE_INC); - TestRegisterCaching(OVERLAY_SCALE_CNTL); - - TestRegisterCaching(SCALER_HEIGHT_WIDTH); - - TestRegisterCaching(SCALER_TEST); - - TestRegisterCaching(VIDEO_FORMAT); - - if (pATI->Chip < ATI_CHIP_264VTB) - { - TestRegisterCaching(BUF0_OFFSET); - TestRegisterCaching(BUF0_PITCH); - TestRegisterCaching(BUF1_OFFSET); - TestRegisterCaching(BUF1_PITCH); - } - else - { - TestRegisterCaching(SCALER_BUF0_OFFSET); - TestRegisterCaching(SCALER_BUF1_OFFSET); - TestRegisterCaching(SCALER_BUF_PITCH); - - TestRegisterCaching(OVERLAY_EXCLUSIVE_HORZ); - TestRegisterCaching(OVERLAY_EXCLUSIVE_VERT); - - if (pATI->Chip >= ATI_CHIP_264GTPRO) - { - TestRegisterCaching(SCALER_COLOUR_CNTL); - - TestRegisterCaching(SCALER_H_COEFF0); - TestRegisterCaching(SCALER_H_COEFF1); - TestRegisterCaching(SCALER_H_COEFF2); - TestRegisterCaching(SCALER_H_COEFF3); - TestRegisterCaching(SCALER_H_COEFF4); - - TestRegisterCaching(SCALER_BUF0_OFFSET_U); - TestRegisterCaching(SCALER_BUF0_OFFSET_V); - TestRegisterCaching(SCALER_BUF1_OFFSET_U); - TestRegisterCaching(SCALER_BUF1_OFFSET_V); - } - } - } + TestRegisterCachingXV(pScreenInfo); } } + ATIDRIUnmarkSync(pScreenInfo); + /* * For VTB's and later, the first CPU read of the framebuffer will return * zeroes, so do it here. This appears to be due to some kind of engine * caching of framebuffer data I haven't found any way of disabling, or * otherwise circumventing. Thanks to Mark Vojkovich for the suggestion. */ - if (pATI->pXAAInfo) - pATI->pXAAInfo->NeedToSync = FALSE; - pATI = *(volatile ATIPtr *)pATI->pMemory; } +#ifdef USE_XAA /* * ATIMach64SetupForScreenToScreenCopy -- * @@ -947,7 +906,7 @@ * variants. */ int -ATIMach64AccelInit +ATIMach64XaaInit ( ATIPtr pATI, XAAInfoRecPtr pXAAInfo @@ -1035,3 +994,4 @@ return ATIMach64MaxY; } +#endif diff -Nau -x CVS -x 'Makefile*' -x '*o' -x '*a' xf86-video-ati/src/atimach64accel.h xf86-video-ati-exa/src/atimach64accel.h --- xf86-video-ati/src/atimach64accel.h 2006-02-05 16:26:44.000000000 +0200 +++ xf86-video-ati-exa/src/atimach64accel.h 2006-02-21 10:57:11.000000000 +0200 @@ -27,11 +27,17 @@ #include "atipriv.h" #include "xaa.h" +#include "exa.h" #define ATIMach64MaxX 8191 #define ATIMach64MaxY 32767 -extern int ATIMach64AccelInit(ATIPtr, XAAInfoRecPtr); +#ifdef USE_EXA +extern Bool ATIMach64ExaInit(ScreenPtr); +#endif +#ifdef USE_XAA +extern int ATIMach64XaaInit(ATIPtr, XAAInfoRecPtr); +#endif extern void ATIMach64Sync(ScrnInfoPtr); #endif /* ___ATIMACH64ACCEL_H___ */ diff -Nau -x CVS -x 'Makefile*' -x '*o' -x '*a' xf86-video-ati/src/atimach64.c xf86-video-ati-exa/src/atimach64.c --- xf86-video-ati/src/atimach64.c 2005-07-11 05:29:44.000000000 +0300 +++ xf86-video-ati-exa/src/atimach64.c 2006-02-23 17:35:39.000000000 +0200 @@ -60,6 +60,7 @@ #include "atimach64.h" #include "atimach64accel.h" #include "atimach64io.h" +#include "atimach64iodri.h" #include "atirgb514.h" #ifndef DPMS_SERVER @@ -850,9 +851,11 @@ outf(HOST_CNTL, pATIHW->host_cntl); /* Set host transfer window address and size clamp */ +#ifdef USE_XAA pATI->pHOST_DATA = (CARD8 *)pATI->pBlock[GetBits(HOST_DATA_0, BLOCK_SELECT)] + (HOST_DATA_0 & MM_IO_SELECT); +#endif pATI->nHostFIFOEntries = pATI->nFIFOEntries >> 1; if (pATI->nHostFIFOEntries > 16) pATI->nHostFIFOEntries = 16; diff -Nau -x CVS -x 'Makefile*' -x '*o' -x '*a' xf86-video-ati/src/atimach64cursor.c xf86-video-ati-exa/src/atimach64cursor.c --- xf86-video-ati/src/atimach64cursor.c 2005-07-11 05:29:44.000000000 +0300 +++ xf86-video-ati-exa/src/atimach64cursor.c 2006-02-23 17:36:35.000000000 +0200 @@ -30,6 +30,7 @@ #include "atimach64accel.h" #include "atimach64cursor.h" #include "atimach64io.h" +#include "atimach64iodri.h" /* * ATIMach64SetCursorColours -- diff -Nau -x CVS -x 'Makefile*' -x '*o' -x '*a' xf86-video-ati/src/atimach64exa.c xf86-video-ati-exa/src/atimach64exa.c --- xf86-video-ati/src/atimach64exa.c 1970-01-01 02:00:00.000000000 +0200 +++ xf86-video-ati-exa/src/atimach64exa.c 2006-02-28 14:57:21.000000000 +0200 @@ -0,0 +1,538 @@ +/* + * FIXME: someone put copyright here + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "ati.h" +#include "atichip.h" +#include "atimach64accel.h" +#include "atimach64io.h" +#include "atimach64iodri.h" +#include "atipriv.h" +#include "atiregs.h" +#ifdef XF86DRI_DEVEL +#include "mach64_drm.h" +#endif + +#ifdef USE_EXA +static void +ATIMach64WaitMarker +( + ScreenPtr pScreenInfo, + int Marker +) +{ + ATIMach64Sync(xf86Screens[pScreenInfo->myNum]); +} + +/* Copied from radeon_exa.c */ + +static Bool +ATIGetOffsetPitch(PixmapPtr pPix, int bpp, CARD32 *pitch_offset, + int offset, int pitch) +{ + ScrnInfoPtr pScreenInfo = xf86Screens[pPix->drawable.pScreen->myNum]; + ATIPtr info = ATIPTR(pScreenInfo); + + /* On the R128, depending on the bpp the screen can be set up so that it + * doesn't meet the pitchAlign requirement but can still be + * accelerated, so we check the specific pitch requirement of alignment + * to 8 pixels. + */ +/* if (pitch % info->exa.card.pixmapPitchAlign != 0) + ATI_FALLBACK(("Bad pitch 0x%08x\n", pitch)); */ + +/* if (offset % info->exa.card.pixmapOffsetAlign != 0) + ATI_FALLBACK(("Bad offset 0x%08x\n", offset)); */ + + *pitch_offset = ((pitch/bpp) << 22) | (offset >> 3 ); + return TRUE; +} + +static Bool +ATIGetPixmapOffsetPitch(PixmapPtr pPix, CARD32 *pitch_offset) +{ + ScrnInfoPtr pScreenInfo = xf86Screens[pPix->drawable.pScreen->myNum]; + ATIPtr pATI = ATIPTR(pScreenInfo); + CARD32 pitch, offset; + int bpp; + + bpp = pPix->drawable.bitsPerPixel; + if (bpp == 24) + bpp = 8; + + offset = (CARD8 *)pPix->devPrivate.ptr - pATI->pExa->card.memoryBase; + pitch = pPix->devKind; + + return ATIGetOffsetPitch(pPix, bpp, pitch_offset, offset, pitch); +} + + +extern CARD8 ATIMach64ALU[]; + +extern void +ATIMach64ValidateClip(ATIPtr pATI, + int sc_left, int sc_right, int sc_top, int sc_bottom); + + +static Bool +ATIMach64PrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir, int ydir, + int alu, Pixel planemask) +{ + ScrnInfoPtr pScreenInfo = xf86Screens[pSrcPixmap->drawable.pScreen->myNum]; + ATIPtr pATI = ATIPTR(pScreenInfo); + CARD32 src_pitch_offset, dst_pitch_offset; + + ATIDRISync(pScreenInfo); + + ATIGetPixmapOffsetPitch(pSrcPixmap,&src_pitch_offset); + ATIGetPixmapOffsetPitch(pDstPixmap,&dst_pitch_offset); + ATIMach64WaitForFIFO(pATI, 5); + outf(DP_WRITE_MASK, planemask); + outf(SRC_OFF_PITCH,src_pitch_offset); + outf(DST_OFF_PITCH,dst_pitch_offset); + + outf(DP_SRC, DP_MONO_SRC_ALLONES | + SetBits(SRC_BLIT, DP_FRGD_SRC) | SetBits(SRC_BKGD, DP_BKGD_SRC)); + outf(DP_MIX, SetBits(ATIMach64ALU[alu], DP_FRGD_MIX)); + + outf(CLR_CMP_CNTL, CLR_CMP_FN_FALSE); + pATI->dst_cntl = 0; + + if (ydir > 0) + pATI->dst_cntl |= DST_Y_DIR; + if (xdir > 0) + pATI->dst_cntl |= DST_X_DIR; + + if (pATI->XModifier == 1) + outf(DST_CNTL, pATI->dst_cntl); + else + pATI->dst_cntl |= DST_24_ROT_EN; + + return TRUE; +} + +static void +ATIMach64Copy (PixmapPtr pDstPixmap, int srcX, int srcY, int dstX, int dstY, int w, int h) +{ + ScrnInfoPtr pScreenInfo = xf86Screens[pDstPixmap->drawable.pScreen->myNum]; + ATIPtr pATI = ATIPTR(pScreenInfo); + + srcX *= pATI->XModifier; + dstY *= pATI->XModifier; + w *= pATI->XModifier; + + ATIDRISync(pScreenInfo); + + /* Disable clipping if it gets in the way */ + ATIMach64ValidateClip(pATI, dstX, dstX + w - 1, dstY, dstY + h - 1); + + if (!(pATI->dst_cntl & DST_X_DIR)) + { + srcX += w - 1; + dstX += w - 1; + } + + if (!(pATI->dst_cntl & DST_Y_DIR)) + { + srcY += h - 1; + dstY += h - 1; + } + + if (pATI->XModifier != 1) + outf(DST_CNTL, pATI->dst_cntl | SetBits((dstX / 4) % 6, DST_24_ROT)); + + ATIMach64WaitForFIFO(pATI, 4); + outf(SRC_Y_X, SetWord(srcX, 1) | SetWord(srcY, 0)); + outf(SRC_WIDTH1, w); + outf(DST_Y_X, SetWord(dstX, 1) | SetWord(dstY, 0)); + outf(DST_HEIGHT_WIDTH, SetWord(w, 1) | SetWord(h, 0)); +} + +static void +ATIMach64DoneCopy (PixmapPtr pDstPixmap) +{ +} + +static Bool +ATIMach64PrepareSolid +( + PixmapPtr pPixmap, + int alu, + Pixel planemask, + Pixel fg +) +{ + ScrnInfoPtr pScreenInfo = xf86Screens[pPixmap->drawable.pScreen->myNum]; + ATIPtr pATI = ATIPTR(pScreenInfo); + + CARD32 dst_pitch_offset; + + ATIDRISync(pScreenInfo); + + ATIGetPixmapOffsetPitch(pPixmap,&dst_pitch_offset); + ATIMach64WaitForFIFO(pATI, 6); + outf(DP_WRITE_MASK, planemask); + outf(DST_OFF_PITCH,dst_pitch_offset); + outf(DP_SRC, DP_MONO_SRC_ALLONES | + SetBits(SRC_FRGD, DP_FRGD_SRC) | SetBits(SRC_BKGD, DP_BKGD_SRC)); + outf(DP_FRGD_CLR, fg); + outf(DP_MIX, SetBits(ATIMach64ALU[alu], DP_FRGD_MIX)); + + outf(CLR_CMP_CNTL, CLR_CMP_FN_FALSE); + + if (pATI->XModifier == 1) + outf(DST_CNTL, DST_X_DIR | DST_Y_DIR); + return TRUE; +} + +static void +ATIMach64Solid +( + PixmapPtr pPixmap, + int x1, + int y1, + int x2, + int y2 +) +{ + /* FIXME? */ + int w = x2-x1; + ScrnInfoPtr pScreenInfo = xf86Screens[pPixmap->drawable.pScreen->myNum]; + ATIPtr pATI = ATIPTR(pScreenInfo); + + ATIDRISync(pScreenInfo); + + if (pATI->XModifier != 1) + { + x1 *= pATI->XModifier; + w *= pATI->XModifier; + + outf(DST_CNTL, SetBits((x1 / 4) % 6, DST_24_ROT) | + (DST_X_DIR | DST_Y_DIR | DST_24_ROT_EN)); + } + + /* Disable clipping if it gets in the way */ + ATIMach64ValidateClip(pATI, x1, x1 + w - 1, y1, y2 - 1); + + ATIMach64WaitForFIFO(pATI, 2); + outf(DST_Y_X, SetWord(x1, 1) | SetWord(y1, 0)); + outf(DST_HEIGHT_WIDTH, SetWord(w, 1) | SetWord(y2-y1, 0)); +} + +static void +ATIMach64DoneSolid(PixmapPtr pPixmap) +{ +} + +static Bool +ATIMach64PrepareComposite (int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture, PicturePtr pDstPicture, PixmapPtr pSrc, PixmapPtr pMask, PixmapPtr pDst) +{ + return FALSE; +} + +#ifdef XF86DRI_DEVEL +/* FIXME: profile for thresholds */ +#define ATI_DMA_MIN_UPLOAD 2048 +#define ATI_DMA_MIN_DOWNLOAD 256 + +/* See dri/mach64/mach64_reg.h */ +#define ATI_DMA_DATATYPE_CI8 2 +#define ATI_DMA_DATATYPE_RGB565 4 +#define ATI_DMA_DATATYPE_ARGB8888 6 + +/* FIXME: compute this */ +#define ATI_DMA_MAX_BUFFERS 16 +static drmDMAReq dma; +static int req_list[ATI_DMA_MAX_BUFFERS]; +static int req_sizes[ATI_DMA_MAX_BUFFERS]; + +/* See dri/mach64/mach64_ioctl.c */ +static Bool +mach64GetBufferLocked( ScreenPtr pScreen, int req_count ) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ATIPtr pATI = ATIPTR(pScrn); + + int ret; + int i; + + dma.context = pATI->drmCtx; + dma.send_count = 0; + dma.send_list = NULL; + dma.send_sizes = NULL; + dma.flags = DRM_DMA_LARGER_OK; + dma.request_count = req_count; + dma.request_size = MACH64_BUFFER_SIZE; + dma.request_list = req_list; + dma.request_sizes = req_sizes; + dma.granted_count = 0; + + ret = drmDMA( pATI->drmFD, &dma ); + + if (ret) + return FALSE; + + if (dma.granted_count < req_count) { + drmFreeBufs( pATI->drmFD, dma.granted_count, dma.request_list ); + return FALSE; + } + + for (i = 0; i < req_count; i++) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "drm index: %d, size :%d\n", + req_list[i], req_sizes[i]); + } + + return TRUE; +} + +/* See dri/mach64/mach64_ioctl.c */ +static void +mach64FireBlitLocked( ScreenPtr pScreen, drmBufPtr buffer, + int offset, int pitch, int format, + int x, int y, int width, int height ) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ATIPtr pATI = ATIPTR(pScrn); + + drm_mach64_blit_t blit; + int ret; + + blit.idx = buffer->idx; + blit.offset = offset; + blit.pitch = pitch; + blit.format = format; + blit.x = x; + blit.y = y; + blit.width = width; + blit.height = height; + + ret = drmCommandWrite( pATI->drmFD, DRM_MACH64_BLIT, + &blit, sizeof(drm_mach64_blit_t) ); + + if (ret) { + xf86DrvMsg( pScrn->scrnIndex, X_ERROR, + "DRM_MACH64_BLIT: return = %d\n", ret ); + exit(-1); + } +} + +/** + * This is a port of mach64UploadLocalSubImage from dri to exa. + * See dri/mach64/mach64_texmem.c + */ +static Bool +ATIMach64UploadToScreen(PixmapPtr pDst, int x, int y, int w, int h, + char *src, int src_pitch) +{ + ScrnInfoPtr pScrn = xf86Screens[pDst->drawable.pScreen->myNum]; + ATIPtr pATI = ATIPTR(pScrn); + + int buffer_size; /* size (payload) of DMA buffer in bytes */ + int pixmap_size; /* size of pixmap in bytes */ + int passes; /* number of DMA buffers required for the pixmap */ + int rows_buffer; /* number of pixmap rows that fit in the DMA buffer */ + int rows_pixmap; /* number of pixmap rows that have been blt */ + int rows_remain; /* number of pixmap rows that remain to be blt */ + int i; + + char *dst; + int dst_pitch = exaGetPixmapPitch(pDst); + int dst_offset = exaGetPixmapOffset(pDst); + + /* width of pixmap in bytes, i.e. pitch of the DMA buffer */ + int wBytes = w * ((pDst->drawable.bitsPerPixel + 7) / 8); + + buffer_size = MACH64_BUFFER_SIZE - MACH64_HOSTDATA_BLIT_OFFSET; + pixmap_size = h * wBytes; + + /* Fallback for small pixmaps, it is faster to do a memcpy. + * Also fallback for pixmaps with pitch smaller than 64, + * since they require special handling. FIXME + */ + if (pixmap_size < ATI_DMA_MIN_UPLOAD || wBytes <= 64) { + dst = (char *)pATI->pExa->card.memoryBase + dst_offset; + + exaWaitSync(pScrn->pScreen); + while (h--) { + memcpy(dst, src, wBytes); + dst += dst_pitch; + src += src_pitch; + } + return TRUE; + } + + /* Bail out if direct rendering is not enabled */ + if (!pATI->directRenderingEnabled) + return FALSE; + + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "pSrc: %p (%4d), pDst: %p (%4d), (%3d, %3d)\n", + src, src_pitch, pDst, dst_pitch, w, h); + + /* number of pixmap rows that fit in the DMA buffer */ + if (pixmap_size <= buffer_size) { + rows_buffer = h; + } else { + rows_buffer = buffer_size / wBytes; + } + + /* number of DMA buffers required for the pixmap */ + passes = h / rows_buffer; + if (h % rows_buffer) + passes++; + + if(passes > ATI_DMA_MAX_BUFFERS) + return FALSE; + + if(!mach64GetBufferLocked( pScrn->pScreen, passes )) + return FALSE; + + rows_remain = h; + rows_pixmap = 0; + for (i = 0; i < passes; i++) + { + int idx; + drmBufPtr buffer; + char *pix_data; + char *buf_data; + int width, height; + + idx = dma.request_list[i]; + buffer = &pATI->pDRIServerInfo->drmBuffers->list[idx]; + buffer->used = 0; + + pix_data = src + rows_pixmap * src_pitch; + buf_data = (char *)buffer->address + MACH64_HOSTDATA_BLIT_OFFSET; + + width = w; + height = (rows_remain > rows_buffer) ? rows_buffer : rows_remain; + + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "blit %d, idx %d, buffer: %p, pix_data %p (%d), buf_data %p (%d)\n", + i, idx, buffer, pix_data, src_pitch, buf_data, wBytes); + + /* FIXME: LOCK + * FIXME: When I try to write data to the allocated DMA buffer, + * FIXME: the machine locks. DMA buffer allocation seems ok, + * FIXME: i.e. buf_data does point to the address at which + * FIXME: the drm reports that DMA buffers get allocated. + */ +#if 0 + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "buf_data[%d]\n", 0); + buf_data[0] = 0; + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "buf_data[%d]\n", 1); + buf_data[1] = 1; +#endif + +#if 0 + if (src_pitch == wBytes) { + memcpy(buf_data, pix_data, height * wBytes); + } else { + int count = height; + while(count--) { + memcpy(buf_data, pix_data, wBytes); + pix_data += src_pitch; + buf_data += wBytes; + } + } +#endif + +#if 0 + mach64FireBlitLocked( pScrn->pScreen, + buffer, + rows_pixmap * dst_pitch, + dst_pitch, + ATI_DMA_DATATYPE_CI8, + 0, rows_pixmap, + width, height ); +#endif + + rows_remain -= rows_buffer; + rows_pixmap += rows_buffer; + } + + /* FIXME: LEAK + * FIXME: DMA buffers seem to not get freed. Allocation succeeds for + * FIXME: the first 128 requests (this is what drm allocates) and + * FIXME: then fails. + */ + drmFreeBufs( pATI->drmFD, dma.granted_count, dma.request_list ); + +/* No workie :-( */ + + return FALSE; + + return TRUE; +} + +static Bool +ATIMach64DownloadFromScreen(PixmapPtr pSrc, int x, int y, int w, int h, + char *dst, int dst_pitch) +{ + return FALSE; +} +#endif + +Bool +ATIMach64ExaInit +( + ScreenPtr pScreen +) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ATIPtr pATI = ATIPTR(pScrn); + ExaDriverPtr pExa; + unsigned bytesPerPixel = (pScrn->bitsPerPixel + 7) / 8; + + pExa = xnfcalloc(sizeof(ExaDriverRec), 1); + if (!pExa) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Failed to allocate EXADriverRec.\n"); + return FALSE; + } + + /* FIXME */ + pExa->card.memoryBase = pATI->pMemory; + pExa->card.memorySize = pScrn->videoRam * 1024; + pExa->card.offScreenBase = pScrn->virtualX * pScrn->virtualY * bytesPerPixel * 2; + pExa->card.flags = EXA_OFFSCREEN_PIXMAPS; + pExa->card.pixmapOffsetAlign = 8; + pExa->card.pixmapPitchAlign = (bytesPerPixel == 2) ? 16 : 8; + pExa->card.maxX = ATIMach64MaxX; + pExa->card.maxY = ATIMach64MaxY; + + xf86DrvMsg(pScreen->myNum, X_INFO, + "FB base %lx, cursori %lx, linear %lx, cursorb %lx\n", + pATI->pMemory, pATI->pCursorImage, pATI->LinearBase, pATI->CursorBase); + + xf86DrvMsg(pScreen->myNum, X_INFO, + "EXA base %lx, EXA size %lx, EXA offscreen %lx\n", + pExa->card.memoryBase, pExa->card.memorySize, pExa->card.offScreenBase); + + pExa->accel.WaitMarker=ATIMach64WaitMarker; + + pExa->accel.PrepareSolid=ATIMach64PrepareSolid; + pExa->accel.Solid=ATIMach64Solid; + pExa->accel.DoneSolid=ATIMach64DoneSolid; + + pExa->accel.PrepareCopy=ATIMach64PrepareCopy; + pExa->accel.Copy=ATIMach64Copy; + pExa->accel.DoneCopy=ATIMach64DoneCopy; + + pExa->accel.PrepareComposite=ATIMach64PrepareComposite; + +#ifdef XF86DRI_DEVEL + pExa->accel.UploadToScreen=ATIMach64UploadToScreen; + pExa->accel.DownloadFromScreen=ATIMach64DownloadFromScreen; +#endif + + pATI->pExa = pExa; + + return exaDriverInit(pScreen, pATI->pExa); +} +#endif diff -Nau -x CVS -x 'Makefile*' -x '*o' -x '*a' xf86-video-ati/src/atimach64iodri.h xf86-video-ati-exa/src/atimach64iodri.h --- xf86-video-ati/src/atimach64iodri.h 1970-01-01 02:00:00.000000000 +0200 +++ xf86-video-ati-exa/src/atimach64iodri.h 2006-02-23 18:38:05.000000000 +0200 @@ -0,0 +1,139 @@ +/* + * Copyright 2000 through 2004 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting documentation, and + * that the name of Marc Aurele La France not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. Marc Aurele La France makes no representations + * about the suitability of this software for any purpose. It is provided + * "as-is" without express or implied warranty. + * + * MARC AURELE LA FRANCE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO + * EVENT SHALL MARC AURELE LA FRANCE BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + * DRI support by: + * Manuel Teira + * Leif Delgass + */ + +#ifndef ___ATIMACH64IODRI_H___ +#define ___ATIMACH64IODRI_H___ 1 + +#ifdef XF86DRI_DEVEL + +#define ATIDRIWaitForIdle(_pATI) \ +do { \ + ATIDRIServerInfoPtr pATIDRIServer = _pATI->pDRIServerInfo; \ + int ret; \ + \ + if (pATIDRIServer && pATI->directRenderingEnabled) { \ + /* Wait for DMA to complete */ \ + ret = drmCommandNone(_pATI->drmFD, DRM_MACH64_IDLE); \ + if (ret) { \ + drmCommandNone(_pATI->drmFD, DRM_MACH64_RESET); \ + } \ + \ + /* Force updating of FIFO entry counters */ \ + pATI->EngineIsBusy = TRUE; \ + ATIMach64PollEngineStatus(_pATI); \ + } else { \ + ATIMach64WaitForIdle(_pATI); \ + } \ +} while (0) + +/* + * Set upon DRISwapContext and when DRI accesses the engine + * from within the server, see DRIInitBuffers/DRIMoveBuffers in atidri.c. + */ +static __inline__ void ATIDRIMarkSyncInt(ScrnInfoPtr _pScrInfo) +{ + ATIPtr _pATI=ATIPTR(_pScrInfo); +#ifdef USE_EXA + if (_pATI->useEXA) + exaMarkSync(_pScrInfo->pScreen); +#endif +#ifdef USE_XAA + if (!_pATI->useEXA) + SET_SYNC_FLAG(_pATI->pXAAInfo); /* NeedToSync = TRUE */ +#endif +} + +/* + * Set upon DRISwapContext and when the server acquires the DRI lock + */ +static __inline__ void ATIDRIMarkSyncExt(ScrnInfoPtr _pScrInfo) +{ + ATIPtr _pATI=ATIPTR(_pScrInfo); + _pATI->NeedDRISync = TRUE; +} + +static __inline__ void ATIDRISync(ScrnInfoPtr _pScrInfo) +{ + ATIPtr _pATI=ATIPTR(_pScrInfo); +#ifdef USE_EXA + if (_pATI->directRenderingEnabled && _pATI->pExa) + { + exaWaitSync(_pScrInfo->pScreen); + } +#endif +#ifdef USE_XAA + if (_pATI->directRenderingEnabled && _pATI->pXAAInfo) + { + if (_pATI->NeedDRISync) (*_pATI->pXAAInfo->Sync)(_pScrInfo); + } +#endif +} + +static __inline__ void ATIDRIUnmarkSync(ScrnInfoPtr _pScrInfo) +{ + ATIPtr _pATI=ATIPTR(_pScrInfo); +#ifdef USE_XAA + if (!_pATI->useEXA) { + if (_pATI->directRenderingEnabled) + _pATI->NeedDRISync = FALSE; + if (_pATI->pXAAInfo) + _pATI->pXAAInfo->NeedToSync = FALSE; + } +#endif +} + +#define ATIDRILock(_pScrInfo) \ +do \ +{ \ + ATIPtr _pATI=ATIPTR(_pScrInfo); \ + if (_pATI->directRenderingEnabled) \ + { \ + DRILock(_pScrInfo->pScreen, 0); \ + ATIDRIMarkSyncExt(_pScrInfo); \ + } \ +} while (0) + +#define ATIDRIUnlock(_pScrInfo) \ +do \ +{ \ + ATIPtr _pATI=ATIPTR(_pScrInfo); \ + if (_pATI->directRenderingEnabled) \ + { \ + DRIUnlock(_pScrInfo->pScreen); \ + } \ +} while (0) + +#else /* XF86DRI_DEVEL */ + + +#define ATIDRIWaitForIdle(_pATI) +#define ATIDRILock(_pScrInfo) +#define ATIDRIUnlock(_pScrInfo) +#define ATIDRISync(_pScrInfo) + +#endif /* XF86DRI_DEVEL */ + +#endif /* ___ATIMACH64IODRI_H___ */ diff -Nau -x CVS -x 'Makefile*' -x '*o' -x '*a' xf86-video-ati/src/atimach64io.h xf86-video-ati-exa/src/atimach64io.h --- xf86-video-ati/src/atimach64io.h 2004-09-21 21:10:34.000000000 +0300 +++ xf86-video-ati-exa/src/atimach64io.h 2006-02-23 17:34:22.000000000 +0200 @@ -204,70 +204,6 @@ while ((_pATI)->EngineIsBusy) \ ATIMach64PollEngineStatus(_pATI) -#ifdef XF86DRI_DEVEL - -#define ATIDRIWaitForIdle(_pATI) \ -do { \ - ATIDRIServerInfoPtr pATIDRIServer = _pATI->pDRIServerInfo; \ - int ret; \ - \ - if (pATIDRIServer && pATI->directRenderingEnabled) { \ - /* Wait for DMA to complete */ \ - ret = drmCommandNone(_pATI->drmFD, DRM_MACH64_IDLE); \ - if (ret) { \ - drmCommandNone(_pATI->drmFD, DRM_MACH64_RESET); \ - } \ - \ - /* Force updating of FIFO entry counters */ \ - pATI->EngineIsBusy = TRUE; \ - ATIMach64PollEngineStatus(_pATI); \ - } else { \ - ATIMach64WaitForIdle(_pATI); \ - } \ -} while (0) - -#define ATIDRILock(_pScrInfo) \ -do \ -{ \ - ATIPtr _pATI=ATIPTR(_pScrInfo); \ - if (_pATI->directRenderingEnabled) \ - { \ - DRILock(_pScrInfo->pScreen, 0); \ - pATI->NeedDRISync = TRUE; \ - } \ -} while (0) - -#define ATIDRIUnlock(_pScrInfo) \ -do \ -{ \ - ATIPtr _pATI=ATIPTR(_pScrInfo); \ - if (_pATI->directRenderingEnabled) \ - { \ - DRIUnlock(_pScrInfo->pScreen); \ - } \ -} while (0) - -#define ATIDRISync(_pScrInfo) \ -do \ -{ \ - ATIPtr _pATI=ATIPTR(_pScrInfo); \ - if (_pATI->directRenderingEnabled && _pATI->pXAAInfo) \ - { \ - if (_pATI->NeedDRISync) (*_pATI->pXAAInfo->Sync)(_pScrInfo); \ - } \ -} while (0) - -#else /* XF86DRI_DEVEL */ - - -#define ATIDRIWaitForIdle(_pATI) -#define ATIDRILock(_pScrInfo) -#define ATIDRIUnlock(_pScrInfo) -#define ATIDRISync(_pScrInfo) - -#endif /* XF86DRI_DEVEL */ - - /* * An outf() variant to write two registers such that the second register is * is always written whenever either is to be changed. diff -Nau -x CVS -x 'Makefile*' -x '*o' -x '*a' xf86-video-ati/src/atimisc.c xf86-video-ati-exa/src/atimisc.c --- xf86-video-ati/src/atimisc.c 2005-07-11 05:29:44.000000000 +0300 +++ xf86-video-ati-exa/src/atimisc.c 2006-02-20 21:42:24.000000000 +0200 @@ -127,7 +127,19 @@ ATIfbSymbols, ATIshadowfbSymbols, + +#ifdef USE_EXA + + ATIexaSymbols, + +#endif /* USE_EXA */ + +#ifdef USE_XAA + ATIxaaSymbols, + +#endif /* USE_XAA */ + ATIramdacSymbols, ATIi2cSymbols, NULL); diff -Nau -x CVS -x 'Makefile*' -x '*o' -x '*a' xf86-video-ati/src/atioption.c xf86-video-ati-exa/src/atioption.c --- xf86-video-ati/src/atioption.c 2006-02-05 16:26:44.000000000 +0200 +++ xf86-video-ati-exa/src/atioption.c 2006-02-20 21:42:25.000000000 +0200 @@ -219,6 +219,13 @@ FALSE, }, { + ATI_OPTION_ACCELMETHOD, + "AccelMethod", + OPTV_STRING, + {0}, + FALSE + }, + { -1, NULL, OPTV_NONE, diff -Nau -x CVS -x 'Makefile*' -x '*o' -x '*a' xf86-video-ati/src/atioption.h xf86-video-ati-exa/src/atioption.h --- xf86-video-ati/src/atioption.h 2006-02-05 16:26:44.000000000 +0200 +++ xf86-video-ati-exa/src/atioption.h 2006-02-20 21:42:25.000000000 +0200 @@ -69,7 +69,8 @@ ATI_OPTION_PROBE_CLOCKS, ATI_OPTION_REFERENCE_CLOCK, ATI_OPTION_SHADOW_FB, - ATI_OPTION_SWCURSOR + ATI_OPTION_SWCURSOR, + ATI_OPTION_ACCELMETHOD } ATIPublicOptionType; #ifdef TV_OUT diff -Nau -x CVS -x 'Makefile*' -x '*o' -x '*a' xf86-video-ati/src/atipreinit.c xf86-video-ati-exa/src/atipreinit.c --- xf86-video-ati/src/atipreinit.c 2005-08-28 21:10:34.000000000 +0300 +++ xf86-video-ati-exa/src/atipreinit.c 2006-02-25 14:23:44.000000000 +0200 @@ -1,5 +1,5 @@ /* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atipreinit.c,v 1.74 2003/12/22 17:48:09 tsi Exp $ */ -/* $XdotOrg: driver/xf86-video-ati/src/atipreinit.c,v 1.9 2005/08/28 18:10:34 ajax Exp $ */ +/* $XdotOrg: driver/xf86-video-ati/src/atipreinit.c,v 1.9 2005-08-28 18:10:34 ajax Exp $ */ /* * Copyright 1999 through 2004 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * diff -Nau -x CVS -x 'Makefile*' -x '*o' -x '*a' xf86-video-ati/src/atiscreen.c xf86-video-ati-exa/src/atiscreen.c --- xf86-video-ati/src/atiscreen.c 2006-02-23 15:42:09.000000000 +0200 +++ xf86-video-ati-exa/src/atiscreen.c 2006-02-22 17:46:18.000000000 +0200 @@ -207,6 +207,7 @@ int maxY = pScreenInfo->videoRam * 1024 / (pATI->displayWidth * cpp); int requiredY; + /*FIXME*/ requiredY = pScreenInfo->virtualY * 2 /* front, back buffers */ + (pScreenInfo->virtualY * 2 / cpp); /* depth buffer (always 16-bit) */ @@ -621,11 +622,20 @@ ATICloseXVideo(pScreen, pScreenInfo, pATI); +#ifdef USE_EXA + if (pATI->pExa) { + exaDriverFini(pScreen); + xfree(pATI->pExa); + pATI->pExa = NULL; + } +#endif +#ifdef USE_XAA if (pATI->pXAAInfo) { XAADestroyInfoRec(pATI->pXAAInfo); pATI->pXAAInfo = NULL; } +#endif if ((pScreen->CloseScreen = pATI->CloseScreen)) { @@ -643,9 +653,14 @@ ATILeaveGraphics(pScreenInfo, pATI); - xfree(pATI->ExpansionBitmapScanlinePtr[1]); - pATI->ExpansionBitmapScanlinePtr[0] = +#ifdef USE_XAA + if (!pATI->useEXA) + { + xfree(pATI->ExpansionBitmapScanlinePtr[1]); + pATI->ExpansionBitmapScanlinePtr[0] = NULL; pATI->ExpansionBitmapScanlinePtr[1] = NULL; + } +#endif xfree(pATI->pShadow); pATI->pShadow = NULL; diff -Nau -x CVS -x 'Makefile*' -x '*o' -x '*a' xf86-video-ati/src/atistruct.h xf86-video-ati-exa/src/atistruct.h --- xf86-video-ati/src/atistruct.h 2005-07-31 20:19:27.000000000 +0300 +++ xf86-video-ati-exa/src/atistruct.h 2006-02-27 17:56:47.000000000 +0200 @@ -52,7 +52,13 @@ #endif /* TV_OUT */ +#ifdef USE_EXA +#include "exa.h" +#include "xf86fbman.h" +#endif +#ifdef USE_XAA #include "xaa.h" +#endif #include "xf86Cursor.h" #include "xf86Pci.h" #include "xf86Resources.h" @@ -296,15 +302,23 @@ /* * XAA interface. */ + Bool useEXA; +#ifdef USE_EXA + ExaDriverPtr pExa; +#endif +#ifdef USE_XAA XAAInfoRecPtr pXAAInfo; +#endif int nAvailableFIFOEntries, nFIFOEntries, nHostFIFOEntries; CARD8 EngineIsBusy, EngineIsLocked, XModifier; CARD32 dst_cntl; /* For SetupFor/Subsequent communication */ CARD32 sc_left_right, sc_top_bottom; CARD16 sc_left, sc_right, sc_top, sc_bottom; /* Current scissors */ +#ifdef USE_XAA pointer pHOST_DATA; /* Current HOST_DATA_* transfer window address */ CARD32 *ExpansionBitmapScanlinePtr[2]; int ExpansionBitmapWidth; +#endif /* * Cursor-related definitions. @@ -477,6 +491,7 @@ DRIInfoPtr pDRIInfo; int drmFD; int irq; + drm_context_t drmCtx; int numVisualConfigs; __GLXvisualConfig *pVisualConfigs; ATIConfigPrivPtr pVisualConfigsPriv;