apm_accel.c revision 17a48c7c
117a48c7cSmrg/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_accel.c,v 1.20tsi Exp $ */ 217a48c7cSmrg 317a48c7cSmrg#ifdef HAVE_CONFIG_H 417a48c7cSmrg#include "config.h" 517a48c7cSmrg#endif 617a48c7cSmrg 717a48c7cSmrg#include "apm.h" 817a48c7cSmrg#include "miline.h" 917a48c7cSmrg 1017a48c7cSmrg/* Defines */ 1117a48c7cSmrg#define MAXLOOP 1000000 1217a48c7cSmrg 1317a48c7cSmrg/* Translation from X ROP's to APM ROP's. */ 1417a48c7cSmrgstatic unsigned char apmROP[] = { 1517a48c7cSmrg 0, 1617a48c7cSmrg 0x88, 1717a48c7cSmrg 0x44, 1817a48c7cSmrg 0xCC, 1917a48c7cSmrg 0x22, 2017a48c7cSmrg 0xAA, 2117a48c7cSmrg 0x66, 2217a48c7cSmrg 0xEE, 2317a48c7cSmrg 0x11, 2417a48c7cSmrg 0x99, 2517a48c7cSmrg 0x55, 2617a48c7cSmrg 0xDD, 2717a48c7cSmrg 0x33, 2817a48c7cSmrg 0xBB, 2917a48c7cSmrg 0x77, 3017a48c7cSmrg 0xFF 3117a48c7cSmrg}; 3217a48c7cSmrg 3317a48c7cSmrg 3417a48c7cSmrg#include "apm_funcs.c" 3517a48c7cSmrg 3617a48c7cSmrg#define IOP_ACCESS 3717a48c7cSmrg#include "apm_funcs.c" 3817a48c7cSmrg 3917a48c7cSmrg#define PSZ 24 4017a48c7cSmrg#include "apm_funcs.c" 4117a48c7cSmrg 4217a48c7cSmrg#define PSZ 24 4317a48c7cSmrg#define IOP_ACCESS 4417a48c7cSmrg#include "apm_funcs.c" 4517a48c7cSmrg 4617a48c7cSmrgstatic void 4717a48c7cSmrgApmRemoveStipple(FBAreaPtr area) 4817a48c7cSmrg{ 4917a48c7cSmrg ((struct ApmStippleCacheRec *)area->devPrivate.ptr)->apmStippleCached = FALSE; 5017a48c7cSmrg} 5117a48c7cSmrg 5217a48c7cSmrgstatic void 5317a48c7cSmrgApmMoveStipple(FBAreaPtr from, FBAreaPtr to) 5417a48c7cSmrg{ 5517a48c7cSmrg struct ApmStippleCacheRec *pApm = (struct ApmStippleCacheRec *)to->devPrivate.ptr; 5617a48c7cSmrg 5717a48c7cSmrg pApm->apmStippleCache.x = to->box.x1; 5817a48c7cSmrg pApm->apmStippleCache.y += to->box.y1 - from->box.y1; 5917a48c7cSmrg /* TODO : move data */ 6017a48c7cSmrg} 6117a48c7cSmrg 6217a48c7cSmrg/* 6317a48c7cSmrg * ApmCacheMonoStipple 6417a48c7cSmrg * because my poor AT3D needs stipples stored linearly in memory. 6517a48c7cSmrg */ 6617a48c7cSmrgstatic XAACacheInfoPtr 6717a48c7cSmrgApmCacheMonoStipple(ScrnInfoPtr pScrn, PixmapPtr pPix) 6817a48c7cSmrg{ 6917a48c7cSmrg APMDECL(pScrn); 7017a48c7cSmrg int w = pPix->drawable.width, W = (w + 31) & ~31; 7117a48c7cSmrg int h = pPix->drawable.height; 7217a48c7cSmrg int i, j, dwords, mem, width, funcNo; 7317a48c7cSmrg FBAreaPtr draw; 7417a48c7cSmrg struct ApmStippleCacheRec *pCache; 7517a48c7cSmrg unsigned char *srcPtr; 7617a48c7cSmrg CARD32 *dstPtr; 7717a48c7cSmrg static StippleScanlineProcPtr *StippleTab = NULL; 7817a48c7cSmrg 7917a48c7cSmrg if (!StippleTab) 8017a48c7cSmrg StippleTab = XAAGetStippleScanlineFuncMSBFirst(); 8117a48c7cSmrg 8217a48c7cSmrg for (i = 0; i < APM_CACHE_NUMBER; i++) 8317a48c7cSmrg if ((pApm->apmCache[i].apmStippleCache.serialNumber == pPix->drawable.serialNumber) 8417a48c7cSmrg && pApm->apmCache[i].apmStippleCached && 8517a48c7cSmrg (pApm->apmCache[i].apmStippleCache.fg == -1) && 8617a48c7cSmrg (pApm->apmCache[i].apmStippleCache.bg == -1)) { 8717a48c7cSmrg pApm->apmCache[i].apmStippleCache.trans_color = -1; 8817a48c7cSmrg return &pApm->apmCache[i].apmStippleCache; 8917a48c7cSmrg } 9017a48c7cSmrg if ((i = ++pApm->apmCachePtr) >= APM_CACHE_NUMBER) 9117a48c7cSmrg i = pApm->apmCachePtr = 0; 9217a48c7cSmrg pCache = &pApm->apmCache[i]; 9317a48c7cSmrg if (pCache->apmStippleCached) { 9417a48c7cSmrg pCache->apmStippleCached = FALSE; 9517a48c7cSmrg xf86FreeOffscreenArea(pCache->area); 9617a48c7cSmrg } 9717a48c7cSmrg 9817a48c7cSmrg draw = xf86AllocateLinearOffscreenArea(pApm->pScreen, (W * h + 7) / 8, 9917a48c7cSmrg (pApm->CurrentLayout.mask32 + 1) << 1, 10017a48c7cSmrg ApmMoveStipple, ApmRemoveStipple, pCache); 10117a48c7cSmrg if (!draw) 10217a48c7cSmrg return NULL; /* Let's hope this will never happen... */ 10317a48c7cSmrg 10417a48c7cSmrg pCache->area = draw; 10517a48c7cSmrg pCache->apmStippleCache.serialNumber = pPix->drawable.serialNumber; 10617a48c7cSmrg pCache->apmStippleCache.trans_color = 10717a48c7cSmrg pCache->apmStippleCache.bg = 10817a48c7cSmrg pCache->apmStippleCache.fg = -1; 10917a48c7cSmrg pCache->apmStippleCache.orig_w = w; 11017a48c7cSmrg pCache->apmStippleCache.orig_h = h; 11117a48c7cSmrg pCache->apmStippleCache.x = draw->box.x1; 11217a48c7cSmrg pCache->apmStippleCache.y = draw->box.y1 + ((pCache - pApm->apmCache) + 1) * pApm->CurrentLayout.Scanlines; 11317a48c7cSmrg mem = ((draw->box.x2 - draw->box.x1) * (draw->box.y2 - draw->box.y1) * 11417a48c7cSmrg pScrn->bitsPerPixel) / (W * h); 11517a48c7cSmrg width = 2; 11617a48c7cSmrg while (width * width <= mem) 11717a48c7cSmrg width++; 11817a48c7cSmrg width--; 11917a48c7cSmrg pCache->apmStippleCache.w = (width * W + pScrn->bitsPerPixel - 1) / 12017a48c7cSmrg pScrn->bitsPerPixel; 12117a48c7cSmrg pCache->apmStippleCache.h = ((draw->box.x2 - draw->box.x1) * 12217a48c7cSmrg (draw->box.y2 - draw->box.y1)) / 12317a48c7cSmrg pCache->apmStippleCache.w; 12417a48c7cSmrg pCache->apmStippleCached = TRUE; 12517a48c7cSmrg 12617a48c7cSmrg if (w < 32) { 12717a48c7cSmrg if (w & (w - 1)) funcNo = 1; 12817a48c7cSmrg else funcNo = 0; 12917a48c7cSmrg } else funcNo = 2; 13017a48c7cSmrg 13117a48c7cSmrg dstPtr = ((CARD32 *)pApm->FbBase) + (draw->box.x1 + 13217a48c7cSmrg draw->box.y1*pApm->CurrentLayout.bytesPerScanline) / 4; 13317a48c7cSmrg j = 0; 13417a48c7cSmrg dwords = (pCache->apmStippleCache.w * pScrn->bitsPerPixel) / 32; 13517a48c7cSmrg while (j + h <= pCache->apmStippleCache.h) { 13617a48c7cSmrg srcPtr = (unsigned char *)pPix->devPrivate.ptr; 13717a48c7cSmrg for (i = h; --i >= 0; ) { 13817a48c7cSmrg StippleTab[funcNo](dstPtr, (CARD32 *)srcPtr, 0, w, dwords); 13917a48c7cSmrg srcPtr += pPix->devKind; 14017a48c7cSmrg dstPtr += dwords; 14117a48c7cSmrg } 14217a48c7cSmrg j += h; 14317a48c7cSmrg } 14417a48c7cSmrg srcPtr = (unsigned char *)pPix->devPrivate.ptr; 14517a48c7cSmrg for (i = pCache->apmStippleCache.h - j ; --i >= 0; ) { 14617a48c7cSmrg StippleTab[funcNo](dstPtr, (CARD32 *)srcPtr, 0, w, dwords); 14717a48c7cSmrg srcPtr += pPix->devKind; 14817a48c7cSmrg dstPtr += dwords; 14917a48c7cSmrg } 15017a48c7cSmrg 15117a48c7cSmrg return &pCache->apmStippleCache; 15217a48c7cSmrg} 15317a48c7cSmrg 15417a48c7cSmrg#if 0 15517a48c7cSmrgextern GCOps XAAPixmapOps; 15617a48c7cSmrgstatic RegionPtr (*SaveCopyAreaPixmap)(DrawablePtr, DrawablePtr, GC *, int, int, int, int, int, int); 15717a48c7cSmrg 15817a48c7cSmrgstatic RegionPtr 15917a48c7cSmrgApmCopyAreaPixmap(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GC *pGC, 16017a48c7cSmrg int srcx, int srcy, 16117a48c7cSmrg int width, int height, 16217a48c7cSmrg int dstx, int dsty ) 16317a48c7cSmrg{ 16417a48c7cSmrg register int Scanlines; 16517a48c7cSmrg int is; 16617a48c7cSmrg int id; 16717a48c7cSmrg int sx = 0, sy = 0, dx = 0, dy = 0, pitch; 16817a48c7cSmrg RegionPtr pReg; 16917a48c7cSmrg 17017a48c7cSmrg if (APMPTR(xf86Screens[(pGC)->pScreen->myNum])->Chipset == AT3D) { 17117a48c7cSmrg Scanlines = APMPTR(xf86Screens[(pGC)->pScreen->myNum])->CurrentLayout.Scanlines; 17217a48c7cSmrg is = (pSrcDrawable->type == DRAWABLE_PIXMAP) ? APM_GET_PIXMAP_PRIVATE(pSrcDrawable)->num : 0; 17317a48c7cSmrg id = (pDstDrawable->type == DRAWABLE_PIXMAP) ? APM_GET_PIXMAP_PRIVATE(pDstDrawable)->num : 0; 17417a48c7cSmrg if (is) { 17517a48c7cSmrg sx = pSrcDrawable->x; 17617a48c7cSmrg sy = pSrcDrawable->y % Scanlines; 17717a48c7cSmrg pitch = 2 * pSrcDrawable->width; 17817a48c7cSmrg pSrcDrawable->x = (sx + ((PixmapPtr)pSrcDrawable)->devKind * sy) % pitch; 17917a48c7cSmrg pSrcDrawable->y = (sx + ((PixmapPtr)pSrcDrawable)->devKind * sy) / pitch; 18017a48c7cSmrg ((PixmapPtr)pSrcDrawable)->devKind = pitch; 18117a48c7cSmrg pSrcDrawable->depth = 16; 18217a48c7cSmrg } 18317a48c7cSmrg if (id) { 18417a48c7cSmrg dx = pDstDrawable->x; 18517a48c7cSmrg dy = pDstDrawable->y % Scanlines; 18617a48c7cSmrg pitch = 2 * pDstDrawable->width; 18717a48c7cSmrg pDstDrawable->x = (dx + ((PixmapPtr)pDstDrawable)->devKind * dy) % pitch; 18817a48c7cSmrg pDstDrawable->y = (dx + ((PixmapPtr)pDstDrawable)->devKind * dy) / pitch; 18917a48c7cSmrg ((PixmapPtr)pDstDrawable)->devKind = pitch; 19017a48c7cSmrg pDstDrawable->depth = 16; 19117a48c7cSmrg } 19217a48c7cSmrg pReg = (*SaveCopyAreaPixmap)(pSrcDrawable, pDstDrawable, pGC, 19317a48c7cSmrg srcx, srcy % Scanlines, 19417a48c7cSmrg width, height, 19517a48c7cSmrg dstx, dsty % Scanlines); 19617a48c7cSmrg if (is) { 19717a48c7cSmrg pSrcDrawable->x = sx; 19817a48c7cSmrg pSrcDrawable->y = sy + is * Scanlines; 19917a48c7cSmrg } 20017a48c7cSmrg if (id) { 20117a48c7cSmrg pDstDrawable->x = dx; 20217a48c7cSmrg pDstDrawable->y = dy + id * Scanlines; 20317a48c7cSmrg } 20417a48c7cSmrg return pReg; 20517a48c7cSmrg } 20617a48c7cSmrg return (*SaveCopyAreaPixmap)(pSrcDrawable, pDstDrawable, pGC, 20717a48c7cSmrg srcx, srcy, 20817a48c7cSmrg width, height, 20917a48c7cSmrg dstx, dsty); 21017a48c7cSmrg} 21117a48c7cSmrg#endif 21217a48c7cSmrg 21317a48c7cSmrgvoid ApmAccelReserveSpace(ApmPtr pApm) 21417a48c7cSmrg{ 21517a48c7cSmrg memType mem, ScratchMemOffset; 21617a48c7cSmrg 21717a48c7cSmrg mem = xf86Screens[pApm->pScreen->myNum]->videoRam << 10; 21817a48c7cSmrg /* 21917a48c7cSmrg * Reserve at least four lines for mono to color expansion 22017a48c7cSmrg */ 22117a48c7cSmrg ScratchMemOffset = ((mem - pApm->OffscreenReserved) / 22217a48c7cSmrg pApm->CurrentLayout.bytesPerScanline - 4) * 22317a48c7cSmrg pApm->CurrentLayout.bytesPerScanline; 22417a48c7cSmrg pApm->ScratchMemSize= mem - ScratchMemOffset - pApm->OffscreenReserved; 22517a48c7cSmrg pApm->ScratchMemPtr = pApm->ScratchMemOffset 22617a48c7cSmrg = (memType)pApm->FbBase + ScratchMemOffset; 22717a48c7cSmrg pApm->ScratchMemEnd = (memType)pApm->FbBase + mem - pApm->OffscreenReserved; 22817a48c7cSmrg} 22917a48c7cSmrg 23017a48c7cSmrg/*********************************************************************************************/ 23117a48c7cSmrg 23217a48c7cSmrgint 23317a48c7cSmrgApmAccelInit(ScreenPtr pScreen) 23417a48c7cSmrg{ 23517a48c7cSmrg ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; 23617a48c7cSmrg APMDECL(pScrn); 23717a48c7cSmrg XAAInfoRecPtr pXAAinfo; 23817a48c7cSmrg BoxRec AvailFBArea; 23917a48c7cSmrg memType mem, ScratchMemOffset; 24017a48c7cSmrg int i, stat; 24117a48c7cSmrg 24217a48c7cSmrg pApm->AccelInfoRec = pXAAinfo = XAACreateInfoRec(); 24317a48c7cSmrg if (!pXAAinfo) 24417a48c7cSmrg return FALSE; 24517a48c7cSmrg 24617a48c7cSmrg mem = pScrn->videoRam << 10; 24717a48c7cSmrg ScratchMemOffset = pApm->ScratchMemOffset - (memType)pApm->FbBase; 24817a48c7cSmrg switch (pApm->CurrentLayout.bitsPerPixel) { 24917a48c7cSmrg case 8: 25017a48c7cSmrg case 24: 25117a48c7cSmrg pApm->ScratchMemWidth = 25217a48c7cSmrg (mem - ScratchMemOffset - pApm->OffscreenReserved) / 1; 25317a48c7cSmrg pApm->ScratchMem = 25417a48c7cSmrg ((ScratchMemOffset & 0xFFF000) << 4) | 25517a48c7cSmrg (ScratchMemOffset & 0xFFF); 25617a48c7cSmrg break; 25717a48c7cSmrg 25817a48c7cSmrg case 16: 25917a48c7cSmrg pApm->ScratchMemWidth = 26017a48c7cSmrg (mem - ScratchMemOffset - pApm->OffscreenReserved) / 2; 26117a48c7cSmrg pApm->ScratchMem = 26217a48c7cSmrg ((ScratchMemOffset & 0xFFE000) << 3) | 26317a48c7cSmrg ((ScratchMemOffset & 0x1FFE) >> 1); 26417a48c7cSmrg break; 26517a48c7cSmrg 26617a48c7cSmrg case 32: 26717a48c7cSmrg pApm->ScratchMemWidth = 26817a48c7cSmrg (mem - ScratchMemOffset - pApm->OffscreenReserved) / 4; 26917a48c7cSmrg pApm->ScratchMem = 27017a48c7cSmrg ((ScratchMemOffset & 0xFFC000) << 2) | 27117a48c7cSmrg ((ScratchMemOffset & 0x3FFC) >> 2); 27217a48c7cSmrg break; 27317a48c7cSmrg } 27417a48c7cSmrg pApm->OffscreenReserved = mem - ScratchMemOffset; 27517a48c7cSmrg 27617a48c7cSmrg /* 27717a48c7cSmrg * Abort 27817a48c7cSmrg */ 27917a48c7cSmrg if (pApm->Chipset == AP6422) 28017a48c7cSmrg i = 4; 28117a48c7cSmrg else 28217a48c7cSmrg i = 8; 28317a48c7cSmrg if (pApm->noLinear) { 28417a48c7cSmrg stat = RDXL_IOP(0x1FC); 28517a48c7cSmrg while ((stat & (STATUS_HOSTBLTBUSY | STATUS_ENGINEBUSY)) || 28617a48c7cSmrg ((stat & STATUS_FIFO) < i)) { 28717a48c7cSmrg WRXB_IOP(0x1FC, 0); 28817a48c7cSmrg stat = RDXL_IOP(0x1FC); 28917a48c7cSmrg } 29017a48c7cSmrg } 29117a48c7cSmrg else { 29217a48c7cSmrg stat = RDXL_M(0x1FC); 29317a48c7cSmrg while ((stat & (STATUS_HOSTBLTBUSY | STATUS_ENGINEBUSY)) || 29417a48c7cSmrg ((stat & STATUS_FIFO) < i)) { 29517a48c7cSmrg WRXB_M(0x1FC, 0); 29617a48c7cSmrg stat = RDXL_M(0x1FC); 29717a48c7cSmrg } 29817a48c7cSmrg } 29917a48c7cSmrg 30017a48c7cSmrg /* Setup current register values */ 30117a48c7cSmrg for (i = 0; i < sizeof(pApm->regcurr) / 4; i++) 30217a48c7cSmrg ((CARD32 *)curr)[i] = RDXL(0x30 + 4*i); 30317a48c7cSmrg 30417a48c7cSmrg SETCLIP_CTRL(1); 30517a48c7cSmrg SETCLIP_CTRL(0); 30617a48c7cSmrg SETBYTEMASK(0x00); 30717a48c7cSmrg SETBYTEMASK(0xFF); 30817a48c7cSmrg SETROP(ROP_S_xor_D); 30917a48c7cSmrg SETROP(ROP_S); 31017a48c7cSmrg 31117a48c7cSmrg#if 0 31217a48c7cSmrg if (XAAPixmapOps.CopyArea != ApmCopyAreaPixmap) { 31317a48c7cSmrg SaveCopyAreaPixmap = XAAPixmapOps.CopyArea; 31417a48c7cSmrg XAAPixmapOps.CopyArea = ApmCopyAreaPixmap; 31517a48c7cSmrg } 31617a48c7cSmrg#endif 31717a48c7cSmrg 31817a48c7cSmrg ApmSetupXAAInfo(pApm, pXAAinfo); 31917a48c7cSmrg 32017a48c7cSmrg if (!pApm->noLinear) { 32117a48c7cSmrg pApm->SetupForSolidFill = ApmSetupForSolidFill; 32217a48c7cSmrg pApm->SubsequentSolidFillRect = ApmSubsequentSolidFillRect; 32317a48c7cSmrg pApm->SetupForSolidFill24 = ApmSetupForSolidFill24; 32417a48c7cSmrg pApm->SubsequentSolidFillRect24 = ApmSubsequentSolidFillRect24; 32517a48c7cSmrg pApm->SetupForScreenToScreenCopy = ApmSetupForScreenToScreenCopy; 32617a48c7cSmrg pApm->SubsequentScreenToScreenCopy = ApmSubsequentScreenToScreenCopy; 32717a48c7cSmrg pApm->SetupForScreenToScreenCopy24 = ApmSetupForScreenToScreenCopy24; 32817a48c7cSmrg pApm->SubsequentScreenToScreenCopy24 = ApmSubsequentScreenToScreenCopy24; 32917a48c7cSmrg } 33017a48c7cSmrg else { 33117a48c7cSmrg pApm->SetupForSolidFill = ApmSetupForSolidFill_IOP; 33217a48c7cSmrg pApm->SubsequentSolidFillRect = ApmSubsequentSolidFillRect_IOP; 33317a48c7cSmrg pApm->SetupForSolidFill24 = ApmSetupForSolidFill24_IOP; 33417a48c7cSmrg pApm->SubsequentSolidFillRect24 = ApmSubsequentSolidFillRect24_IOP; 33517a48c7cSmrg pApm->SetupForScreenToScreenCopy = ApmSetupForScreenToScreenCopy_IOP; 33617a48c7cSmrg pApm->SubsequentScreenToScreenCopy = ApmSubsequentScreenToScreenCopy_IOP; 33717a48c7cSmrg pApm->SetupForScreenToScreenCopy24 = ApmSetupForScreenToScreenCopy24_IOP; 33817a48c7cSmrg pApm->SubsequentScreenToScreenCopy24 = ApmSubsequentScreenToScreenCopy24_IOP; 33917a48c7cSmrg } 34017a48c7cSmrg 34117a48c7cSmrg /* 34217a48c7cSmrg * Init Rush extension. 34317a48c7cSmrg * Must be initialized once per generation. 34417a48c7cSmrg */ 34517a48c7cSmrg#ifdef XF86RUSH_EXT 34617a48c7cSmrg if (!pApm->CreatePixmap) { 34717a48c7cSmrg pApm->CreatePixmap = pScreen->CreatePixmap; 34817a48c7cSmrg pApm->DestroyPixmap = pScreen->DestroyPixmap; 34917a48c7cSmrg } 35017a48c7cSmrg XFree86RushExtensionInit(pScreen); 35117a48c7cSmrg#endif 35217a48c7cSmrg 35317a48c7cSmrg /* Pixmap cache setup */ 35417a48c7cSmrg pXAAinfo->CachePixelGranularity = (pApm->CurrentLayout.mask32 + 1) << 1; 35517a48c7cSmrg AvailFBArea.x1 = 0; 35617a48c7cSmrg AvailFBArea.y1 = 0; 35717a48c7cSmrg AvailFBArea.x2 = pScrn->displayWidth; 35817a48c7cSmrg AvailFBArea.y2 = (pScrn->videoRam * 1024 - pApm->OffscreenReserved) / 35917a48c7cSmrg (pScrn->displayWidth * ((pScrn->bitsPerPixel + 7) >> 3)); 36017a48c7cSmrg 36117a48c7cSmrg xf86InitFBManager(pScreen, &AvailFBArea); 36217a48c7cSmrg 36317a48c7cSmrg bzero(pApm->apmCache, sizeof pApm->apmCache); 36417a48c7cSmrg 36517a48c7cSmrg return XAAInit(pScreen, pXAAinfo); 36617a48c7cSmrg} 36717a48c7cSmrg 36817a48c7cSmrgvoid ApmSetupXAAInfo(ApmPtr pApm, XAAInfoRecPtr pXAAinfo) 36917a48c7cSmrg{ 37017a48c7cSmrg pApm->CurrentLayout.Setup_DEC = 0; 37117a48c7cSmrg switch(pApm->CurrentLayout.bitsPerPixel) 37217a48c7cSmrg { 37317a48c7cSmrg case 8: 37417a48c7cSmrg pApm->CurrentLayout.Setup_DEC |= DEC_BITDEPTH_8; 37517a48c7cSmrg break; 37617a48c7cSmrg case 16: 37717a48c7cSmrg pApm->CurrentLayout.Setup_DEC |= DEC_BITDEPTH_16; 37817a48c7cSmrg break; 37917a48c7cSmrg case 24: 38017a48c7cSmrg /* Note : in 24 bpp, the accelerator wants linear coordinates */ 38117a48c7cSmrg pApm->CurrentLayout.Setup_DEC |= DEC_BITDEPTH_24 | DEC_SOURCE_LINEAR | 38217a48c7cSmrg DEC_DEST_LINEAR; 38317a48c7cSmrg break; 38417a48c7cSmrg case 32: 38517a48c7cSmrg pApm->CurrentLayout.Setup_DEC |= DEC_BITDEPTH_32; 38617a48c7cSmrg break; 38717a48c7cSmrg default: 38817a48c7cSmrg xf86DrvMsg(xf86Screens[pApm->pScreen->myNum]->scrnIndex, X_WARNING, 38917a48c7cSmrg "Cannot set up drawing engine control for bpp = %d\n", 39017a48c7cSmrg pApm->CurrentLayout.bitsPerPixel); 39117a48c7cSmrg break; 39217a48c7cSmrg } 39317a48c7cSmrg 39417a48c7cSmrg switch(pApm->CurrentLayout.displayWidth) 39517a48c7cSmrg { 39617a48c7cSmrg case 640: 39717a48c7cSmrg pApm->CurrentLayout.Setup_DEC |= DEC_WIDTH_640; 39817a48c7cSmrg break; 39917a48c7cSmrg case 800: 40017a48c7cSmrg pApm->CurrentLayout.Setup_DEC |= DEC_WIDTH_800; 40117a48c7cSmrg break; 40217a48c7cSmrg case 1024: 40317a48c7cSmrg pApm->CurrentLayout.Setup_DEC |= DEC_WIDTH_1024; 40417a48c7cSmrg break; 40517a48c7cSmrg case 1152: 40617a48c7cSmrg pApm->CurrentLayout.Setup_DEC |= DEC_WIDTH_1152; 40717a48c7cSmrg break; 40817a48c7cSmrg case 1280: 40917a48c7cSmrg pApm->CurrentLayout.Setup_DEC |= DEC_WIDTH_1280; 41017a48c7cSmrg break; 41117a48c7cSmrg case 1600: 41217a48c7cSmrg pApm->CurrentLayout.Setup_DEC |= DEC_WIDTH_1600; 41317a48c7cSmrg break; 41417a48c7cSmrg default: 41517a48c7cSmrg xf86DrvMsg(xf86Screens[pApm->pScreen->myNum]->scrnIndex, X_WARNING, 41617a48c7cSmrg "Cannot set up drawing engine control " 41717a48c7cSmrg "for screen width = %d\n", pApm->CurrentLayout.displayWidth); 41817a48c7cSmrg break; 41917a48c7cSmrg } 42017a48c7cSmrg 42117a48c7cSmrg if (!pXAAinfo) 42217a48c7cSmrg return; 42317a48c7cSmrg 42417a48c7cSmrg /* 42517a48c7cSmrg * Set up the main acceleration flags. 42617a48c7cSmrg */ 42717a48c7cSmrg pXAAinfo->Flags = PIXMAP_CACHE | LINEAR_FRAMEBUFFER | OFFSCREEN_PIXMAPS; 42817a48c7cSmrg pXAAinfo->CacheMonoStipple = ApmCacheMonoStipple; 42917a48c7cSmrg 43017a48c7cSmrg if (pApm->CurrentLayout.bitsPerPixel != 24) { 43117a48c7cSmrg if (!pApm->noLinear) { 43217a48c7cSmrg#define XAA(s) pXAAinfo->s = Apm##s 43317a48c7cSmrg if (pApm->Chipset < AT24) 43417a48c7cSmrg pXAAinfo->Sync = ApmSync6422; 43517a48c7cSmrg else 43617a48c7cSmrg XAA(Sync); 43717a48c7cSmrg 43817a48c7cSmrg /* Accelerated filled rectangles */ 43917a48c7cSmrg pXAAinfo->SolidFillFlags = NO_PLANEMASK; 44017a48c7cSmrg XAA(SetupForSolidFill); 44117a48c7cSmrg XAA(SubsequentSolidFillRect); 44217a48c7cSmrg 44317a48c7cSmrg /* Accelerated screen to screen color expansion */ 44417a48c7cSmrg pXAAinfo->ScreenToScreenColorExpandFillFlags = NO_PLANEMASK; 44517a48c7cSmrg XAA(SetupForScreenToScreenColorExpandFill); 44617a48c7cSmrg XAA(SubsequentScreenToScreenColorExpandFill); 44717a48c7cSmrg 44817a48c7cSmrg#if 0 44917a48c7cSmrg The constraints of the transfer range are incompatible with the 45017a48c7cSmrg XAA architecture. I rewrote the XAA functions using ImageWrite 45117a48c7cSmrg /* Accelerated CPU to screen color expansion */ 45217a48c7cSmrg if ((pApm->Chipset == AT24 && pApm->ChipRev >= 4) || 45317a48c7cSmrg pApm->Chipset == AT3D) { 45417a48c7cSmrg pXAAinfo->CPUToScreenColorExpandFillFlags = 45517a48c7cSmrg NO_PLANEMASK | SCANLINE_PAD_DWORD | CPU_TRANSFER_PAD_QWORD 45617a48c7cSmrg | BIT_ORDER_IN_BYTE_MSBFIRST | LEFT_EDGE_CLIPPING | 45717a48c7cSmrg LEFT_EDGE_CLIPPING_NEGATIVE_X | SYNC_AFTER_COLOR_EXPAND; 45817a48c7cSmrg XAA(SetupForCPUToScreenColorExpandFill); 45917a48c7cSmrg XAA(SubsequentCPUToScreenColorExpandFill); 46017a48c7cSmrg pXAAinfo->ColorExpandBase = pApm->BltMap; 46117a48c7cSmrg pXAAinfo->ColorExpandRange = (pApm->Chipset >= AT3D) ? 32*1024 : 30*1024; 46217a48c7cSmrg } 46317a48c7cSmrg 46417a48c7cSmrg /* Accelerated image transfers */ 46517a48c7cSmrg pXAAinfo->ImageWriteFlags = 46617a48c7cSmrg LEFT_EDGE_CLIPPING | NO_PLANEMASK | 46717a48c7cSmrg SCANLINE_PAD_DWORD | CPU_TRANSFER_PAD_QWORD | 46817a48c7cSmrg LEFT_EDGE_CLIPPING_NEGATIVE_X | 46917a48c7cSmrg SYNC_AFTER_IMAGE_WRITE; 47017a48c7cSmrg pXAAinfo->ImageWriteBase = pApm->BltMap; 47117a48c7cSmrg pXAAinfo->ImageWriteRange = (pApm->Chipset >= AT3D) ? 32*1024 : 30*1024; 47217a48c7cSmrg XAA(SetupForImageWrite); 47317a48c7cSmrg XAA(SubsequentImageWriteRect); 47417a48c7cSmrg#endif 47517a48c7cSmrg pXAAinfo->WritePixmapFlags = LEFT_EDGE_CLIPPING | NO_PLANEMASK | 47617a48c7cSmrg LEFT_EDGE_CLIPPING_NEGATIVE_X; 47717a48c7cSmrg XAA(WritePixmap); 47817a48c7cSmrg pXAAinfo->FillImageWriteRectsFlags = 47917a48c7cSmrg LEFT_EDGE_CLIPPING | NO_PLANEMASK | 48017a48c7cSmrg LEFT_EDGE_CLIPPING_NEGATIVE_X; 48117a48c7cSmrg XAA(FillImageWriteRects); 48217a48c7cSmrg pXAAinfo->WriteBitmapFlags = LEFT_EDGE_CLIPPING | NO_PLANEMASK | 48317a48c7cSmrg LEFT_EDGE_CLIPPING_NEGATIVE_X | 48417a48c7cSmrg BIT_ORDER_IN_BYTE_LSBFIRST; 48517a48c7cSmrg XAA(WriteBitmap); 48617a48c7cSmrg pXAAinfo->TEGlyphRendererFlags = LEFT_EDGE_CLIPPING | NO_PLANEMASK | 48717a48c7cSmrg LEFT_EDGE_CLIPPING_NEGATIVE_X; 48817a48c7cSmrg XAA(TEGlyphRenderer); 48917a48c7cSmrg 49017a48c7cSmrg /* Accelerated screen-screen bitblts */ 49117a48c7cSmrg pXAAinfo->ScreenToScreenCopyFlags = NO_PLANEMASK; 49217a48c7cSmrg XAA(SetupForScreenToScreenCopy); 49317a48c7cSmrg XAA(SubsequentScreenToScreenCopy); 49417a48c7cSmrg 49517a48c7cSmrg /* Accelerated Line drawing */ 49617a48c7cSmrg pXAAinfo->SolidLineFlags = NO_PLANEMASK | HARDWARE_CLIP_LINE; 49717a48c7cSmrg XAA(SetClippingRectangle); 49817a48c7cSmrg pXAAinfo->SolidBresenhamLineErrorTermBits = 15; 49917a48c7cSmrg 50017a48c7cSmrg if (pApm->Chipset >= AT24) { 50117a48c7cSmrg XAA(SubsequentSolidBresenhamLine); 50217a48c7cSmrg 50317a48c7cSmrg /* Pattern fill */ 50417a48c7cSmrg pXAAinfo->Mono8x8PatternFillFlags = NO_PLANEMASK | 50517a48c7cSmrg HARDWARE_PATTERN_PROGRAMMED_BITS | 50617a48c7cSmrg HARDWARE_PATTERN_SCREEN_ORIGIN; 50717a48c7cSmrg XAA(SetupForMono8x8PatternFill); 50817a48c7cSmrg XAA(SubsequentMono8x8PatternFillRect); 50917a48c7cSmrg if (pApm->CurrentLayout.bitsPerPixel == 8) { 51017a48c7cSmrg pXAAinfo->Color8x8PatternFillFlags = NO_PLANEMASK | 51117a48c7cSmrg HARDWARE_PATTERN_SCREEN_ORIGIN; 51217a48c7cSmrg XAA(SetupForColor8x8PatternFill); 51317a48c7cSmrg XAA(SubsequentColor8x8PatternFillRect); 51417a48c7cSmrg } 51517a48c7cSmrg } 51617a48c7cSmrg else 51717a48c7cSmrg pXAAinfo->SubsequentSolidBresenhamLine = 51817a48c7cSmrg ApmSubsequentSolidBresenhamLine6422; 51917a48c7cSmrg#undef XAA 52017a48c7cSmrg } 52117a48c7cSmrg else { 52217a48c7cSmrg#define XAA(s) pXAAinfo->s = Apm##s##_IOP 52317a48c7cSmrg if (pApm->Chipset < AT24) 52417a48c7cSmrg pXAAinfo->Sync = ApmSync6422_IOP; 52517a48c7cSmrg else 52617a48c7cSmrg XAA(Sync); 52717a48c7cSmrg 52817a48c7cSmrg /* Accelerated filled rectangles */ 52917a48c7cSmrg pXAAinfo->SolidFillFlags = NO_PLANEMASK; 53017a48c7cSmrg XAA(SetupForSolidFill); 53117a48c7cSmrg XAA(SubsequentSolidFillRect); 53217a48c7cSmrg 53317a48c7cSmrg /* Accelerated screen to screen color expansion */ 53417a48c7cSmrg pXAAinfo->ScreenToScreenColorExpandFillFlags = NO_PLANEMASK; 53517a48c7cSmrg XAA(SetupForScreenToScreenColorExpandFill); 53617a48c7cSmrg XAA(SubsequentScreenToScreenColorExpandFill); 53717a48c7cSmrg 53817a48c7cSmrg#if 0 53917a48c7cSmrg The constraints of the transfer range are incompatible with the 54017a48c7cSmrg XAA architecture. I rewrote the XAA functions using ImageWrite 54117a48c7cSmrg /* Accelerated CPU to screen color expansion */ 54217a48c7cSmrg if ((pApm->Chipset == AT24 && pApm->ChipRev >= 4) || 54317a48c7cSmrg pApm->Chipset == AT3D) { 54417a48c7cSmrg pXAAinfo->CPUToScreenColorExpandFillFlags = 54517a48c7cSmrg NO_PLANEMASK | SCANLINE_PAD_DWORD | CPU_TRANSFER_PAD_QWORD 54617a48c7cSmrg | BIT_ORDER_IN_BYTE_MSBFIRST | LEFT_EDGE_CLIPPING | 54717a48c7cSmrg LEFT_EDGE_CLIPPING_NEGATIVE_X | SYNC_AFTER_COLOR_EXPAND; 54817a48c7cSmrg XAA(SetupForCPUToScreenColorExpandFill); 54917a48c7cSmrg XAA(SubsequentCPUToScreenColorExpandFill); 55017a48c7cSmrg pXAAinfo->ColorExpandBase = pApm->BltMap; 55117a48c7cSmrg pXAAinfo->ColorExpandRange = (pApm->Chipset >= AT3D) ? 32*1024 : 30*1024; 55217a48c7cSmrg } 55317a48c7cSmrg 55417a48c7cSmrg /* Accelerated image transfers */ 55517a48c7cSmrg pXAAinfo->ImageWriteFlags = 55617a48c7cSmrg LEFT_EDGE_CLIPPING | NO_PLANEMASK | 55717a48c7cSmrg SCANLINE_PAD_DWORD | CPU_TRANSFER_PAD_QWORD; 55817a48c7cSmrg pXAAinfo->ImageWriteBase = pApm->BltMap; 55917a48c7cSmrg pXAAinfo->ImageWriteRange = (pApm->Chipset >= AT3D) ? 32*1024 : 30*1024; 56017a48c7cSmrg XAA(SetupForImageWrite); 56117a48c7cSmrg XAA(SubsequentImageWriteRect); 56217a48c7cSmrg#endif 56317a48c7cSmrg pXAAinfo->WritePixmapFlags = LEFT_EDGE_CLIPPING | NO_PLANEMASK | 56417a48c7cSmrg LEFT_EDGE_CLIPPING_NEGATIVE_X; 56517a48c7cSmrg XAA(WritePixmap); 56617a48c7cSmrg pXAAinfo->FillImageWriteRectsFlags = 56717a48c7cSmrg LEFT_EDGE_CLIPPING | NO_PLANEMASK | 56817a48c7cSmrg LEFT_EDGE_CLIPPING_NEGATIVE_X; 56917a48c7cSmrg XAA(FillImageWriteRects); 57017a48c7cSmrg pXAAinfo->WriteBitmapFlags = LEFT_EDGE_CLIPPING | NO_PLANEMASK | 57117a48c7cSmrg LEFT_EDGE_CLIPPING_NEGATIVE_X | 57217a48c7cSmrg BIT_ORDER_IN_BYTE_LSBFIRST; 57317a48c7cSmrg XAA(WriteBitmap); 57417a48c7cSmrg pXAAinfo->TEGlyphRendererFlags = LEFT_EDGE_CLIPPING | NO_PLANEMASK | 57517a48c7cSmrg LEFT_EDGE_CLIPPING_NEGATIVE_X; 57617a48c7cSmrg XAA(TEGlyphRenderer); 57717a48c7cSmrg 57817a48c7cSmrg /* Accelerated screen-screen bitblts */ 57917a48c7cSmrg pXAAinfo->ScreenToScreenCopyFlags = NO_PLANEMASK; 58017a48c7cSmrg XAA(SetupForScreenToScreenCopy); 58117a48c7cSmrg XAA(SubsequentScreenToScreenCopy); 58217a48c7cSmrg 58317a48c7cSmrg /* Accelerated Line drawing */ 58417a48c7cSmrg pXAAinfo->SolidLineFlags = NO_PLANEMASK | HARDWARE_CLIP_LINE; 58517a48c7cSmrg XAA(SetClippingRectangle); 58617a48c7cSmrg pXAAinfo->SolidBresenhamLineErrorTermBits = 15; 58717a48c7cSmrg 58817a48c7cSmrg if (pApm->Chipset >= AT24) { 58917a48c7cSmrg XAA(SubsequentSolidBresenhamLine); 59017a48c7cSmrg 59117a48c7cSmrg /* Pattern fill */ 59217a48c7cSmrg pXAAinfo->Mono8x8PatternFillFlags = NO_PLANEMASK | 59317a48c7cSmrg HARDWARE_PATTERN_PROGRAMMED_BITS | 59417a48c7cSmrg HARDWARE_PATTERN_SCREEN_ORIGIN; 59517a48c7cSmrg XAA(SetupForMono8x8PatternFill); 59617a48c7cSmrg XAA(SubsequentMono8x8PatternFillRect); 59717a48c7cSmrg if (pApm->CurrentLayout.bitsPerPixel == 8) { 59817a48c7cSmrg pXAAinfo->Color8x8PatternFillFlags = NO_PLANEMASK | 59917a48c7cSmrg HARDWARE_PATTERN_SCREEN_ORIGIN; 60017a48c7cSmrg XAA(SetupForColor8x8PatternFill); 60117a48c7cSmrg XAA(SubsequentColor8x8PatternFillRect); 60217a48c7cSmrg } 60317a48c7cSmrg } 60417a48c7cSmrg else 60517a48c7cSmrg pXAAinfo->SubsequentSolidBresenhamLine = 60617a48c7cSmrg ApmSubsequentSolidBresenhamLine6422_IOP; 60717a48c7cSmrg#undef XAA 60817a48c7cSmrg } 60917a48c7cSmrg } 61017a48c7cSmrg else { 61117a48c7cSmrg if (!pApm->noLinear) { 61217a48c7cSmrg#define XAA(s) pXAAinfo->s = Apm##s##24 61317a48c7cSmrg XAA(Sync); 61417a48c7cSmrg 61517a48c7cSmrg /* Accelerated filled rectangles */ 61617a48c7cSmrg pXAAinfo->SolidFillFlags = NO_PLANEMASK; 61717a48c7cSmrg XAA(SetupForSolidFill); 61817a48c7cSmrg XAA(SubsequentSolidFillRect); 61917a48c7cSmrg 62017a48c7cSmrg#if 0 62117a48c7cSmrg /* Accelerated screen to screen color expansion */ 62217a48c7cSmrg pXAAinfo->ScreenToScreenColorExpandFillFlags = NO_PLANEMASK; 62317a48c7cSmrg XAA(SetupForScreenToScreenColorExpandFill); 62417a48c7cSmrg XAA(SubsequentScreenToScreenColorExpandFill); 62517a48c7cSmrg 62617a48c7cSmrg#if 0 62717a48c7cSmrg The constraints of the transfer range are incompatible with the 62817a48c7cSmrg XAA architecture. I rewrote the XAA functions using ImageWrite 62917a48c7cSmrg /* Accelerated CPU to screen color expansion */ 63017a48c7cSmrg if (pApm->Chipset == AT3D && pApm->ChipRev >= 4) { 63117a48c7cSmrg pXAAinfo->CPUToScreenColorExpandFillFlags = 63217a48c7cSmrg NO_PLANEMASK | SCANLINE_PAD_DWORD | CPU_TRANSFER_PAD_QWORD 63317a48c7cSmrg | BIT_ORDER_IN_BYTE_MSBFIRST | LEFT_EDGE_CLIPPING | 63417a48c7cSmrg LEFT_EDGE_CLIPPING_NEGATIVE_X | SYNC_AFTER_COLOR_EXPAND; 63517a48c7cSmrg XAA(SetupForCPUToScreenColorExpandFill); 63617a48c7cSmrg XAA(SubsequentCPUToScreenColorExpandFill); 63717a48c7cSmrg pXAAinfo->ColorExpandBase = pApm->BltMap; 63817a48c7cSmrg pXAAinfo->ColorExpandRange = 32*1024; 63917a48c7cSmrg } 64017a48c7cSmrg 64117a48c7cSmrg /* Accelerated image transfers */ 64217a48c7cSmrg pXAAinfo->ImageWriteFlags = 64317a48c7cSmrg LEFT_EDGE_CLIPPING | NO_PLANEMASK | 64417a48c7cSmrg SCANLINE_PAD_DWORD | CPU_TRANSFER_PAD_QWORD | 64517a48c7cSmrg SYNC_AFTER_IMAGE_WRITE; 64617a48c7cSmrg pXAAinfo->ImageWriteBase = pApm->BltMap; 64717a48c7cSmrg pXAAinfo->ImageWriteRange = 32*1024; 64817a48c7cSmrg XAA(SetupForImageWrite); 64917a48c7cSmrg XAA(SubsequentImageWriteRect); 65017a48c7cSmrg#endif 65117a48c7cSmrg pXAAinfo->WritePixmapFlags = LEFT_EDGE_CLIPPING | NO_PLANEMASK | 65217a48c7cSmrg LEFT_EDGE_CLIPPING_NEGATIVE_X; 65317a48c7cSmrg XAA(WritePixmap); 65417a48c7cSmrg pXAAinfo->FillImageWriteRectsFlags = 65517a48c7cSmrg LEFT_EDGE_CLIPPING | NO_PLANEMASK | 65617a48c7cSmrg LEFT_EDGE_CLIPPING_NEGATIVE_X; 65717a48c7cSmrg XAA(FillImageWriteRects); 65817a48c7cSmrg pXAAinfo->WriteBitmapFlags = LEFT_EDGE_CLIPPING | NO_PLANEMASK | 65917a48c7cSmrg LEFT_EDGE_CLIPPING_NEGATIVE_X | 66017a48c7cSmrg BIT_ORDER_IN_BYTE_LSBFIRST; 66117a48c7cSmrg XAA(WriteBitmap); 66217a48c7cSmrg pXAAinfo->TEGlyphRendererFlags = LEFT_EDGE_CLIPPING | NO_PLANEMASK | 66317a48c7cSmrg LEFT_EDGE_CLIPPING_NEGATIVE_X; 66417a48c7cSmrg XAA(TEGlyphRenderer); 66517a48c7cSmrg 66617a48c7cSmrg /* Accelerated Line drawing */ 66717a48c7cSmrg pXAAinfo->SolidLineFlags = NO_PLANEMASK | HARDWARE_CLIP_LINE; 66817a48c7cSmrg XAA(SubsequentSolidBresenhamLine); 66917a48c7cSmrg XAA(SetClippingRectangle); 67017a48c7cSmrg pXAAinfo->SolidBresenhamLineErrorTermBits = 15; 67117a48c7cSmrg 67217a48c7cSmrg /* Pattern fill */ 67317a48c7cSmrg pXAAinfo->Mono8x8PatternFillFlags = NO_PLANEMASK | NO_TRANSPARENCY | 67417a48c7cSmrg HARDWARE_PATTERN_PROGRAMMED_BITS | 67517a48c7cSmrg HARDWARE_PATTERN_SCREEN_ORIGIN; 67617a48c7cSmrg XAA(SetupForMono8x8PatternFill); 67717a48c7cSmrg XAA(SubsequentMono8x8PatternFillRect); 67817a48c7cSmrg#endif 67917a48c7cSmrg 68017a48c7cSmrg /* Accelerated screen-screen bitblts */ 68117a48c7cSmrg pXAAinfo->ScreenToScreenCopyFlags = NO_PLANEMASK | NO_TRANSPARENCY; 68217a48c7cSmrg XAA(SetupForScreenToScreenCopy); 68317a48c7cSmrg XAA(SubsequentScreenToScreenCopy); 68417a48c7cSmrg#undef XAA 68517a48c7cSmrg } 68617a48c7cSmrg else { 68717a48c7cSmrg#define XAA(s) pXAAinfo->s = Apm##s##24##_IOP 68817a48c7cSmrg XAA(Sync); 68917a48c7cSmrg 69017a48c7cSmrg /* Accelerated filled rectangles */ 69117a48c7cSmrg pXAAinfo->SolidFillFlags = NO_PLANEMASK; 69217a48c7cSmrg XAA(SetupForSolidFill); 69317a48c7cSmrg XAA(SubsequentSolidFillRect); 69417a48c7cSmrg 69517a48c7cSmrg#if 0 69617a48c7cSmrg /* Accelerated screen to screen color expansion */ 69717a48c7cSmrg pXAAinfo->ScreenToScreenColorExpandFillFlags = NO_PLANEMASK; 69817a48c7cSmrg XAA(SetupForScreenToScreenColorExpandFill); 69917a48c7cSmrg XAA(SubsequentScreenToScreenColorExpandFill); 70017a48c7cSmrg 70117a48c7cSmrg#if 0 70217a48c7cSmrg The constraints of the transfer range are incompatible with the 70317a48c7cSmrg XAA architecture. I rewrote the XAA functions using ImageWrite 70417a48c7cSmrg /* Accelerated CPU to screen color expansion */ 70517a48c7cSmrg if (pApm->Chipset == AT3D && pApm->ChipRev >= 4) { 70617a48c7cSmrg pXAAinfo->CPUToScreenColorExpandFillFlags = 70717a48c7cSmrg NO_PLANEMASK | SCANLINE_PAD_DWORD | CPU_TRANSFER_PAD_QWORD 70817a48c7cSmrg | BIT_ORDER_IN_BYTE_MSBFIRST | LEFT_EDGE_CLIPPING | 70917a48c7cSmrg LEFT_EDGE_CLIPPING_NEGATIVE_X | SYNC_AFTER_COLOR_EXPAND; 71017a48c7cSmrg XAA(SetupForCPUToScreenColorExpandFill); 71117a48c7cSmrg XAA(SubsequentCPUToScreenColorExpandFill); 71217a48c7cSmrg pXAAinfo->ColorExpandBase = pApm->BltMap; 71317a48c7cSmrg pXAAinfo->ColorExpandRange = 32*1024; 71417a48c7cSmrg } 71517a48c7cSmrg 71617a48c7cSmrg /* Accelerated image transfers */ 71717a48c7cSmrg pXAAinfo->ImageWriteFlags = 71817a48c7cSmrg LEFT_EDGE_CLIPPING | NO_PLANEMASK | 71917a48c7cSmrg SCANLINE_PAD_DWORD | CPU_TRANSFER_PAD_QWORD; 72017a48c7cSmrg pXAAinfo->ImageWriteBase = pApm->BltMap; 72117a48c7cSmrg pXAAinfo->ImageWriteRange = 32*1024; 72217a48c7cSmrg XAA(SetupForImageWrite); 72317a48c7cSmrg XAA(SubsequentImageWriteRect); 72417a48c7cSmrg#endif 72517a48c7cSmrg pXAAinfo->WritePixmapFlags = LEFT_EDGE_CLIPPING | NO_PLANEMASK | 72617a48c7cSmrg LEFT_EDGE_CLIPPING_NEGATIVE_X; 72717a48c7cSmrg XAA(WritePixmap); 72817a48c7cSmrg pXAAinfo->FillImageWriteRectsFlags = 72917a48c7cSmrg LEFT_EDGE_CLIPPING | NO_PLANEMASK | 73017a48c7cSmrg LEFT_EDGE_CLIPPING_NEGATIVE_X; 73117a48c7cSmrg XAA(FillImageWriteRects); 73217a48c7cSmrg pXAAinfo->WriteBitmapFlags = LEFT_EDGE_CLIPPING | NO_PLANEMASK | 73317a48c7cSmrg LEFT_EDGE_CLIPPING_NEGATIVE_X | 73417a48c7cSmrg BIT_ORDER_IN_BYTE_LSBFIRST; 73517a48c7cSmrg XAA(WriteBitmap); 73617a48c7cSmrg pXAAinfo->TEGlyphRendererFlags = LEFT_EDGE_CLIPPING | NO_PLANEMASK | 73717a48c7cSmrg LEFT_EDGE_CLIPPING_NEGATIVE_X; 73817a48c7cSmrg XAA(TEGlyphRenderer); 73917a48c7cSmrg 74017a48c7cSmrg /* Accelerated Line drawing */ 74117a48c7cSmrg pXAAinfo->SolidLineFlags = NO_PLANEMASK | HARDWARE_CLIP_LINE; 74217a48c7cSmrg XAA(SubsequentSolidBresenhamLine); 74317a48c7cSmrg XAA(SetClippingRectangle); 74417a48c7cSmrg pXAAinfo->SolidBresenhamLineErrorTermBits = 15; 74517a48c7cSmrg 74617a48c7cSmrg /* Pattern fill */ 74717a48c7cSmrg pXAAinfo->Mono8x8PatternFillFlags = NO_PLANEMASK | NO_TRANSPARENCY | 74817a48c7cSmrg HARDWARE_PATTERN_PROGRAMMED_BITS | 74917a48c7cSmrg HARDWARE_PATTERN_SCREEN_ORIGIN; 75017a48c7cSmrg XAA(SetupForMono8x8PatternFill); 75117a48c7cSmrg XAA(SubsequentMono8x8PatternFillRect); 75217a48c7cSmrg#endif 75317a48c7cSmrg 75417a48c7cSmrg /* Accelerated screen-screen bitblts */ 75517a48c7cSmrg pXAAinfo->ScreenToScreenCopyFlags = NO_PLANEMASK | NO_TRANSPARENCY; 75617a48c7cSmrg XAA(SetupForScreenToScreenCopy); 75717a48c7cSmrg XAA(SubsequentScreenToScreenCopy); 75817a48c7cSmrg#undef XAA 75917a48c7cSmrg } 76017a48c7cSmrg } 76117a48c7cSmrg} 762