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-03-04 01:42:03.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; } 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-03-04 01:44:44.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" @@ -289,9 +290,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 +401,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 +452,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 +468,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 +632,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-03-04 01:47:27.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 -- * @@ -778,6 +737,12 @@ ATIDRISync(pScreenInfo); +#define CPU_TO_SCREEN +#ifdef CPU_TO_SCREEN + xf86DrvMsg(pScreenInfo->scrnIndex, X_INFO, + "CPUToScreen Setup : (%x, %x), rop: %d, mask %x\n", fg, bg, rop, planemask); +#endif + ATIMach64WaitForFIFO(pATI, 3); outf(DP_WRITE_MASK, planemask); outf(DP_SRC, DP_MONO_SRC_HOST | @@ -823,6 +788,11 @@ ATIDRISync(pScreenInfo); +#ifdef CPU_TO_SCREEN + xf86DrvMsg(pScreenInfo->scrnIndex, X_INFO, + "CPUToScreen Subseq: (%d, %d), (%d, %d), skip %d\n", x, y, w, h, skipleft); +#endif + if (pATI->XModifier != 1) { x *= pATI->XModifier; @@ -866,6 +836,11 @@ ATIDRISync(pScreenInfo); +#ifdef CPU_TO_SCREEN + xf86DrvMsg(pScreenInfo->scrnIndex, X_INFO, + "CPUToScreen ScanLn: %d, %p, %d, %p ( ", iBuffer, pBitmapData, w, pATI->pHOST_DATA); +#endif + while (w > 0) { /* @@ -879,8 +854,12 @@ /* Make enough FIFO slots available */ ATIMach64WaitForFIFO(pATI, nDWord); +#ifdef CPU_TO_SCREEN + xf86DrvMsg(pScreenInfo->scrnIndex, X_INFO, "%d ", w); +#endif + /* - * Always start transfers on a chuck-sized boundary. Note that + * Always start transfers on a chunk-sized boundary. Note that * HOST_DATA_0 is actually on a 512-byte boundary, but *pBitmapData can * only be guaranteed to be on a chunk-sized boundary. * @@ -937,6 +916,10 @@ pATI->nAvailableFIFOEntries -= nDWord; } +#ifdef CPU_TO_SCREEN + xf86DrvMsg(pScreenInfo->scrnIndex, X_INFO, ")\n"); +#endif + pATI->EngineIsBusy = TRUE; } @@ -947,7 +930,7 @@ * variants. */ int -ATIMach64AccelInit +ATIMach64XaaInit ( ATIPtr pATI, XAAInfoRecPtr pXAAInfo @@ -1035,3 +1018,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-03-02 22:26:56.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,7 @@ outf(HOST_CNTL, pATIHW->host_cntl); /* Set host transfer window address and size clamp */ - pATI->pHOST_DATA = - (CARD8 *)pATI->pBlock[GetBits(HOST_DATA_0, BLOCK_SELECT)] + - (HOST_DATA_0 & MM_IO_SELECT); + pATI->pHOST_DATA = inh(HOST_DATA_0); 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-03-04 04:29:42.000000000 +0200 @@ -0,0 +1,313 @@ +/* + * 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 USE_EXA +static void +ATIMach64WaitMarker +( + ScreenPtr pScreenInfo, + int Marker +) +{ + ATIMach64Sync(xf86Screens[pScreenInfo->myNum]); +} + +extern CARD8 ATIMach64ALU[]; + +extern void +ATIMach64ValidateClip(ATIPtr pATI, + int sc_left, int sc_right, int sc_top, int sc_bottom); + +void +ATIGetOffsetPitch(int bpp, CARD32 *pitch_offset, int offset, int pitch) +{ + if (bpp == 24) + bpp = 8; + + /* pixels / 8 = ((bytes * 8) / bpp) / 8 = bytes / bpp */ + pitch = pitch / bpp; + + /* bytes / 8 */ + offset = offset >> 3; + + *pitch_offset = ((pitch << 22) | /* USR1_DST_PITCH */ + (offset << 0) | /* USR1_DST_OFFSET */ + 0); +} + +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; + + pitch = exaGetPixmapPitch(pPix); + offset = exaGetPixmapOffset(pPix); + + ATIGetOffsetPitch(bpp, pitch_offset, offset, pitch); + + return TRUE; +} + +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 +) +{ + int x = x1; + int y = y1; + int w = x2-x1; + int h = y2-y1; + ScrnInfoPtr pScreenInfo = xf86Screens[pPixmap->drawable.pScreen->myNum]; + ATIPtr pATI = ATIPTR(pScreenInfo); + + ATIDRISync(pScreenInfo); + + if (pATI->XModifier != 1) + { + x *= pATI->XModifier; + w *= pATI->XModifier; + + outf(DST_CNTL, SetBits((x / 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, x, x + w - 1, y, y + h - 1); + + ATIMach64WaitForFIFO(pATI, 2); + outf(DST_Y_X, SetWord(x, 1) | SetWord(y, 0)); + outf(DST_HEIGHT_WIDTH, SetWord(w, 1) | SetWord(h, 0)); +} + +static void +ATIMach64DoneSolid(PixmapPtr pPixmap) +{ +} + +static Bool +ATIMach64PrepareComposite (int op, + PicturePtr pSrcPicture, PicturePtr pMaskPicture, PicturePtr pDstPicture, + PixmapPtr pSrc, PixmapPtr pMask, PixmapPtr pDst) +{ + ScrnInfoPtr pScrn = xf86Screens[pSrc->drawable.pScreen->myNum]; + ATIPtr pATI = ATIPTR(pScrn); + + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Comp: pSrc: %p (%4d), pDst: %p (%4d), (%3d, %3d)\n", + pSrc, 0, pDst, 0, 0, 0); + + return FALSE; +} + +extern Bool +ATIMach64UploadToScreen(PixmapPtr pDst, int x, int y, int w, int h, + char *src, int src_pitch); + +extern Bool +ATIMach64DownloadFromScreen(PixmapPtr pSrc, int x, int y, int w, int h, + char *dst, int dst_pitch); + +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; + +#if 0 + /* Rage 128 compositing wants power-of-two pitches. */ + pExa->card.flags |= EXA_OFFSCREEN_ALIGN_POT; +#endif + + /* FIXME: set to 64 if that helps for hostdata blits */ + /* FIXME: 32 is ok for 16bpp, 24bpp */ + pExa->card.pixmapOffsetAlign = 64; + pExa->card.pixmapPitchAlign = 64; + + 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; + +#if 0 + pExa->accel.PrepareComposite=ATIMach64PrepareComposite; +#endif + +#if 0 + 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/atimach64host.c xf86-video-ati-exa/src/atimach64host.c --- xf86-video-ati/src/atimach64host.c 1970-01-01 02:00:00.000000000 +0200 +++ xf86-video-ati-exa/src/atimach64host.c 2006-03-04 04:28:08.000000000 +0200 @@ -0,0 +1,277 @@ +/* + * FIXME: someone put copyright here + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +//#define ATIMove32 + +#include "ati.h" +#include "atichip.h" +#include "atimach64accel.h" +#include "atimach64io.h" +#include "atimach64iodri.h" +#include "atipriv.h" +#include "atiregs.h" + +#ifdef USE_EXA +#define DEBUG + +#define HOSTDATA_BLIT +#ifdef HOSTDATA_BLIT +/* FIXME: profile for thresholds */ +#define ATI_DMA_MIN_UPLOAD 2048 +#define ATI_DMA_MIN_DOWNLOAD 256 + +extern void +ATIGetOffsetPitch(int bpp, CARD32 *pitch_offset, int offset, int pitch); + +extern void +ATIMach64ValidateClip(ATIPtr pATI, + int sc_left, int sc_right, int sc_top, int sc_bottom); + +/** + * Based on CPUToScreenColorExpand from XAA + */ +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); + + char *dst; + int dst_pitch = exaGetPixmapPitch(pDst); + int dst_offset= exaGetPixmapOffset(pDst); + int bpp = pDst->drawable.bitsPerPixel; + int cpp = (bpp == 24) ? 4 : (bpp + 7) / 8; + int wBytes = w * cpp; + int i, j; + + CARD32 dst_pitch_offset; + int format; + + /* Do we need that sync here ? */ + exaWaitSync(pScrn->pScreen); + + /* Fallback: + * "small" pixmaps go faster with memcpy, + * "narrow" pixmaps (<= 64 byte) require special handling ??? FIXME + */ +#if 0 + if (h * wBytes < ATI_DMA_MIN_UPLOAD || wBytes <= 64) { + dst = pATI->pExa->card.memoryBase + dst_offset; + + while (h--) { + memcpy(dst, src, wBytes); + dst += dst_pitch; + src += src_pitch; + } + return TRUE; + } +#endif + +#ifdef DEBUG + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Up : pSrc: %p (%4d), pDst: %p (%4d), (%3d, %3d)\n", + src, src_pitch, pDst, dst_pitch, w, h); +#endif + + /* HostData Blit */ + ATIDRISync(pScrn); + + /* Prepare */ + ATIGetOffsetPitch(bpp, &dst_pitch_offset, dst_offset, dst_pitch); + ATIMach64WaitForFIFO(pATI, 6); + outf(DP_WRITE_MASK, 0xffffffff); /* enable all planes */ + outf(DST_OFF_PITCH, dst_pitch_offset); + + outf(DP_SRC, + DP_MONO_SRC_ALLONES | + SetBits(SRC_HOST, DP_FRGD_SRC) | /* get src from host */ + SetBits(SRC_BKGD, DP_BKGD_SRC) ); + + outf(DP_MIX, + SetBits(MIX_SRC, DP_FRGD_MIX) | /* copy src */ + SetBits(MIX_DST, DP_BKGD_MIX) ); + + outf(CLR_CMP_CNTL, CLR_CMP_FN_FALSE); + + if (pATI->XModifier == 1) + outf(DST_CNTL, DST_X_DIR | DST_Y_DIR); + + /* Do */ + if (pATI->XModifier != 1) + { + x *= pATI->XModifier; + w *= pATI->XModifier; + + outf(DST_CNTL, SetBits((x / 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, x, x + w - 1, y, y + h - 1); + +#if 0 + format = PIX_WIDTH_8BPP; + format = PIX_WIDTH_16BPP; + format = PIX_WIDTH_24BPP; + format = PIX_WIDTH_32BPP; + + outf(DP_PIX_WIDTH, + SetBits(format, DP_DST_PIX_WIDTH) | + SetBits(format, COMPOSITE_PIX_WIDTH) | + SetBits(format, DP_SRC_PIX_WIDTH) | + SetBits(format, DP_HOST_PIX_WIDTH) | + SetBits(format, DP_SCALE_PIX_WIDTH) + ); +#endif + + ATIMach64WaitForFIFO(pATI, 2); + outf(DST_Y_X, SetWord(x, 1) | SetWord(y, 0)); + outf(DST_HEIGHT_WIDTH, SetWord(w, 1) | SetWord(h, 0)); + +#if 0 + for (i = 0; i < h; i++) + for (j = 0; j < src_pitch; j++) + //src[i * src_pitch + j] = j; + //src[i * src_pitch + j] = 0; + src[i * src_pitch + j] = ~0; +#endif + + /* Done */ + for (i = 0; i < h; i++) { + CARD32 *row = (CARD32 *)(src + i * src_pitch); + int j = dst_pitch / 4; + int nDWord; + + ATIDRISync(pScrn); + + while (j > 0) { + /* + * Transfers are done in chunks of up to 64 bytes in length, + * 16 HOST_DATA x 4 bytes per HOST_DATA ??? + */ + nDWord = j; + if (nDWord > pATI->nHostFIFOEntries) + nDWord = pATI->nHostFIFOEntries; + + /* Make enough FIFO slots available */ + ATIMach64WaitForFIFO(pATI, nDWord); + +# if defined(ATIMove32) + { + ATIMove32(pATI->pHOST_DATA, row, nDWord); + } +# else + { + volatile CARD32 *pDst; + CARD32 *pSrc; + unsigned int iDWord; + + iDWord = 16 - nDWord; + pDst = (volatile CARD32 *)pATI->pHOST_DATA - iDWord; + pSrc = row - iDWord; + +/* FIXME + * it seems that the value of each MMIO_MOVE32 affects + * 32 continuous bytes of the dst pixmap *across* rows ... + */ + switch (iDWord) + { + case 0: MMIO_MOVE32(pDst + 0, 0, 0x0U); + case 1: MMIO_MOVE32(pDst + 1, 0, 0x0U); + case 2: MMIO_MOVE32(pDst + 2, 0, 0x0U); + case 3: MMIO_MOVE32(pDst + 3, 0, 0x0U); + case 4: MMIO_MOVE32(pDst + 4, 0, 0x0U); + case 5: MMIO_MOVE32(pDst + 5, 0, 0x0U); + case 6: MMIO_MOVE32(pDst + 6, 0, 0x0U); + case 7: MMIO_MOVE32(pDst + 7, 0, 0x0U); + case 8: MMIO_MOVE32(pDst + 8, 0, 0x0U); + case 9: MMIO_MOVE32(pDst + 9, 0, 0x0U); + case 10: MMIO_MOVE32(pDst + 10, 0, 0x0U); + case 11: MMIO_MOVE32(pDst + 11, 0, 0x0U); + case 12: MMIO_MOVE32(pDst + 12, 0, 0x0U); + case 13: MMIO_MOVE32(pDst + 13, 0, 0x0U); + case 14: MMIO_MOVE32(pDst + 14, 0, 0x0U); + case 15: MMIO_MOVE32(pDst + 15, 0, i); +#if 0 + case 0: MMIO_MOVE32(pDst + 0, 0, *(pSrc + 0)); + case 1: MMIO_MOVE32(pDst + 1, 0, *(pSrc + 1)); + case 2: MMIO_MOVE32(pDst + 2, 0, *(pSrc + 2)); + case 3: MMIO_MOVE32(pDst + 3, 0, *(pSrc + 3)); + case 4: MMIO_MOVE32(pDst + 4, 0, *(pSrc + 4)); + case 5: MMIO_MOVE32(pDst + 5, 0, *(pSrc + 5)); + case 6: MMIO_MOVE32(pDst + 6, 0, *(pSrc + 6)); + case 7: MMIO_MOVE32(pDst + 7, 0, *(pSrc + 7)); + case 8: MMIO_MOVE32(pDst + 8, 0, *(pSrc + 8)); + case 9: MMIO_MOVE32(pDst + 9, 0, *(pSrc + 9)); + case 10: MMIO_MOVE32(pDst + 10, 0, *(pSrc + 10)); + case 11: MMIO_MOVE32(pDst + 11, 0, *(pSrc + 11)); + case 12: MMIO_MOVE32(pDst + 12, 0, *(pSrc + 12)); + case 13: MMIO_MOVE32(pDst + 13, 0, *(pSrc + 13)); + case 14: MMIO_MOVE32(pDst + 14, 0, *(pSrc + 14)); + case 15: MMIO_MOVE32(pDst + 15, 0, *(pSrc + 15)); +#endif + + default: /* Muffle compiler */ + break; + } + } +# endif + + /* Step to next chunk */ + row += nDWord; + j -= nDWord; + pATI->nAvailableFIFOEntries -= nDWord; + } + + pATI->EngineIsBusy = TRUE; + } + +#if 0 + ATIDRISync(pScrn); + dst = pATI->pExa->card.memoryBase + dst_offset; + for (i = 0; i < h; i++) { + CARD32 *pDst = dst; + CARD32 *pSrc = src; + int W = w * cpp / 4; + + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%3d) ", i); + for (j = 0; j < W; j++) { + //pDst[i * dst_pitch / 4 + j] = pSrc[i * src_pitch / 4 + j]; + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%08x ", + pDst[i * dst_pitch / 4 + j] & 0xffffffff); + } + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "\n"); + } +#endif + + return TRUE; +} + +Bool +ATIMach64DownloadFromScreen(PixmapPtr pSrc, int x, int y, int w, int h, + char *dst, int dst_pitch) +{ + ScrnInfoPtr pScrn = xf86Screens[pSrc->drawable.pScreen->myNum]; + ATIPtr pATI = ATIPTR(pScrn); + + char *src; + int src_pitch = exaGetPixmapPitch(pSrc); + int src_offset = exaGetPixmapOffset(pSrc); + int bpp = pSrc->drawable.bitsPerPixel; + +#ifdef DEBUG + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Down: pSrc: %p (%4d), pDst: %p (%4d), (%3d, %3d)\n", + pSrc, src_pitch, dst, dst_pitch, w, h); +#endif + + return FALSE; +} +#endif /* HOSTDATA_BLIT */ +#endif /* EXA */ 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-03-04 02:36:20.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. @@ -345,6 +281,11 @@ * Block transfer definitions. */ +/* for HOST_DATA_XX only, used in hostdata blits */ +#define inh(_Register) \ + ((CARD8 *)pATI->pBlock[GetBits(_Register, BLOCK_SELECT)] + \ + ((_Register) & MM_IO_SELECT)) + #if defined(GCCUSESGAS) && \ (defined(i386) || defined(__i386) || defined(__i386__)) 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/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-03-02 14:42:31.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,12 @@ ATILeaveGraphics(pScreenInfo, pATI); - xfree(pATI->ExpansionBitmapScanlinePtr[1]); - pATI->ExpansionBitmapScanlinePtr[0] = + if (!pATI->useEXA) + { + xfree(pATI->ExpansionBitmapScanlinePtr[1]); + pATI->ExpansionBitmapScanlinePtr[0] = NULL; pATI->ExpansionBitmapScanlinePtr[1] = NULL; + } 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-03-04 01:58:35.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,7 +302,13 @@ /* * 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 */