1301ea0f4Smrg 2301ea0f4Smrg/************************************************************************** 3301ea0f4Smrg 4301ea0f4SmrgCopyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. 5301ea0f4SmrgAll Rights Reserved. 6301ea0f4Smrg 7301ea0f4SmrgPermission is hereby granted, free of charge, to any person obtaining a 8301ea0f4Smrgcopy of this software and associated documentation files (the 9301ea0f4Smrg"Software"), to deal in the Software without restriction, including 10301ea0f4Smrgwithout limitation the rights to use, copy, modify, merge, publish, 11301ea0f4Smrgdistribute, sub license, and/or sell copies of the Software, and to 12301ea0f4Smrgpermit persons to whom the Software is furnished to do so, subject to 13301ea0f4Smrgthe following conditions: 14301ea0f4Smrg 15301ea0f4SmrgThe above copyright notice and this permission notice (including the 16301ea0f4Smrgnext paragraph) shall be included in all copies or substantial portions 17301ea0f4Smrgof the Software. 18301ea0f4Smrg 19301ea0f4SmrgTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 20301ea0f4SmrgOR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 21301ea0f4SmrgMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 22301ea0f4SmrgIN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR 23301ea0f4SmrgANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 24301ea0f4SmrgTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 25301ea0f4SmrgSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 26301ea0f4Smrg 27301ea0f4Smrg**************************************************************************/ 28301ea0f4Smrg 29301ea0f4Smrg/* 30301ea0f4Smrg * Authors: 31301ea0f4Smrg * Daryll Strauss <daryll@precisioninsight.com> 32301ea0f4Smrg * 33301ea0f4Smrg */ 34301ea0f4Smrg 35301ea0f4Smrg#ifdef HAVE_CONFIG_H 36301ea0f4Smrg#include "config.h" 37301ea0f4Smrg#endif 38301ea0f4Smrg 39301ea0f4Smrg#include "xf86.h" 40301ea0f4Smrg#include "xf86_OSproc.h" 41301ea0f4Smrg 42301ea0f4Smrg#include "compiler.h" 43301ea0f4Smrg 44301ea0f4Smrg#include "xf86Pci.h" 45301ea0f4Smrg 46301ea0f4Smrg#include "vgaHW.h" 47301ea0f4Smrg 48301ea0f4Smrg#include "xf86xv.h" 49301ea0f4Smrg#include "i740.h" 50301ea0f4Smrg 51213fdd94Smrg#ifdef HAVE_XAA_H 52301ea0f4Smrgstatic unsigned int i740Rop[16] = { 53301ea0f4Smrg 0x00, /* GXclear */ 54301ea0f4Smrg 0x88, /* GXand */ 55301ea0f4Smrg 0x44, /* GXandReverse */ 56301ea0f4Smrg 0xCC, /* GXcopy */ 57301ea0f4Smrg 0x22, /* GXandInvert */ 58301ea0f4Smrg 0xAA, /* GXnoop */ 59301ea0f4Smrg 0x66, /* GXxor */ 60301ea0f4Smrg 0xEE, /* GXor */ 61301ea0f4Smrg 0x11, /* GXnor */ 62301ea0f4Smrg 0x99, /* GXequiv */ 63301ea0f4Smrg 0x55, /* GXinvert */ 64301ea0f4Smrg 0xDD, /* GXorReverse */ 65301ea0f4Smrg 0x33, /* GXcopyInvert */ 66301ea0f4Smrg 0xBB, /* GXorInverted */ 67301ea0f4Smrg 0x77, /* GXnand */ 68301ea0f4Smrg 0xFF /* GXset */ 69301ea0f4Smrg}; 70301ea0f4Smrg 71301ea0f4Smrgstatic unsigned int i740PatternRop[16] = { 72301ea0f4Smrg 0x00, /* GXclear */ 73301ea0f4Smrg 0xA0, /* GXand */ 74301ea0f4Smrg 0x50, /* GXandReverse */ 75301ea0f4Smrg 0xF0, /* GXcopy */ 76301ea0f4Smrg 0x0A, /* GXandInvert */ 77301ea0f4Smrg 0xAA, /* GXnoop */ 78301ea0f4Smrg 0x5A, /* GXxor */ 79301ea0f4Smrg 0xFA, /* GXor */ 80301ea0f4Smrg 0x05, /* GXnor */ 81301ea0f4Smrg 0xA5, /* GXequiv */ 82301ea0f4Smrg 0x55, /* GXinvert */ 83301ea0f4Smrg 0xF5, /* GXorReverse */ 84301ea0f4Smrg 0x0F, /* GXcopyInvert */ 85301ea0f4Smrg 0xAF, /* GXorInverted */ 86301ea0f4Smrg 0x5F, /* GXnand */ 87301ea0f4Smrg 0xFF /* GXset */ 88301ea0f4Smrg}; 89301ea0f4Smrg 90301ea0f4Smrgstatic void I740SyncPIO(ScrnInfoPtr pScrn); 91301ea0f4Smrgstatic void I740SyncMMIO(ScrnInfoPtr pScrn); 92301ea0f4Smrgstatic void I740SetupForSolidFill(ScrnInfoPtr pScrn, int color, int rop, 93301ea0f4Smrg unsigned int planemask); 94301ea0f4Smrgstatic void I740SubsequentSolidFillRect(ScrnInfoPtr pScrn, int x, int y, 95301ea0f4Smrg int w, int h); 96301ea0f4Smrgstatic void I740SetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, 97301ea0f4Smrg int ydir, int rop, 98301ea0f4Smrg unsigned int planemask, 99301ea0f4Smrg int transparency_color); 100301ea0f4Smrgstatic void I740SubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int x1, int y1, 101301ea0f4Smrg int x2, int y2, int w, int h); 102301ea0f4Smrgstatic void I740SetupForMono8x8PatternFill(ScrnInfoPtr pScrn, 103301ea0f4Smrg int pattx, int patty, 104301ea0f4Smrg int fg, int bg, int rop, 105301ea0f4Smrg unsigned int planemask); 106301ea0f4Smrgstatic void I740SubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn, 107301ea0f4Smrg int pattx, int patty, 108301ea0f4Smrg int x, int y, int w, int h); 109301ea0f4Smrg#if 0 110301ea0f4Smrgstatic void I740SetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, 111301ea0f4Smrg int bg, int fg, int rop, 112301ea0f4Smrg unsigned int planemask); 113301ea0f4Smrgstatic void I740SubsequentCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, 114301ea0f4Smrg int x, int y, int w, int h, 115301ea0f4Smrg int skipleft); 116301ea0f4Smrg#endif 117213fdd94Smrg#endif 118301ea0f4Smrg/* 119301ea0f4Smrg * The following function sets up the supported acceleration. Call it 120301ea0f4Smrg * from the FbInit() function in the SVGA driver, or before ScreenInit 121301ea0f4Smrg * in a monolithic server. 122301ea0f4Smrg */ 123301ea0f4SmrgBool 124301ea0f4SmrgI740AccelInit(ScreenPtr pScreen) { 125213fdd94Smrg#ifdef HAVE_XAA_H 126301ea0f4Smrg XAAInfoRecPtr infoPtr; 127213fdd94Smrg ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); 128301ea0f4Smrg I740Ptr pI740 = I740PTR(pScrn); 129301ea0f4Smrg 130301ea0f4Smrg pI740->AccelInfoRec = infoPtr = XAACreateInfoRec(); 131301ea0f4Smrg if (!infoPtr) return FALSE; 132301ea0f4Smrg 133301ea0f4Smrg if (pScrn->bitsPerPixel == 32) { 134301ea0f4Smrg infoPtr->Flags = 0; /* Disables all acceleration */ 135301ea0f4Smrg return TRUE;; 136301ea0f4Smrg } 137301ea0f4Smrg 138301ea0f4Smrg infoPtr->Flags = PIXMAP_CACHE | OFFSCREEN_PIXMAPS | LINEAR_FRAMEBUFFER; 139301ea0f4Smrg 140301ea0f4Smrg /* Sync */ 141301ea0f4Smrg if (pI740->usePIO) 142301ea0f4Smrg infoPtr->Sync = I740SyncPIO; 143301ea0f4Smrg else 144301ea0f4Smrg infoPtr->Sync = I740SyncMMIO; 145301ea0f4Smrg 146301ea0f4Smrg infoPtr->CachePixelGranularity=8/pI740->cpp; 147301ea0f4Smrg 148301ea0f4Smrg /* Solid filled rectangles */ 149301ea0f4Smrg infoPtr->SolidFillFlags = NO_PLANEMASK; 150301ea0f4Smrg infoPtr->SetupForSolidFill = I740SetupForSolidFill; 151301ea0f4Smrg infoPtr->SubsequentSolidFillRect = I740SubsequentSolidFillRect; 152301ea0f4Smrg 153301ea0f4Smrg /* Screen to screen copy */ 154301ea0f4Smrg infoPtr->ScreenToScreenCopyFlags = (NO_PLANEMASK | NO_TRANSPARENCY); 155301ea0f4Smrg infoPtr->SetupForScreenToScreenCopy = I740SetupForScreenToScreenCopy; 156301ea0f4Smrg infoPtr->SubsequentScreenToScreenCopy = I740SubsequentScreenToScreenCopy; 157301ea0f4Smrg 158301ea0f4Smrg /* 8x8 pattern fills */ 159301ea0f4Smrg infoPtr->SetupForMono8x8PatternFill = I740SetupForMono8x8PatternFill; 160301ea0f4Smrg infoPtr->SubsequentMono8x8PatternFillRect = I740SubsequentMono8x8PatternFillRect; 161301ea0f4Smrg infoPtr->Mono8x8PatternFillFlags = NO_PLANEMASK | HARDWARE_PATTERN_SCREEN_ORIGIN | 162301ea0f4Smrg BIT_ORDER_IN_BYTE_MSBFIRST; 163301ea0f4Smrg 164301ea0f4Smrg /* CPU to screen color expansion */ 165301ea0f4Smrg /* Currently XAA is limited to only DWORD padding. The 3.3 driver 166301ea0f4Smrg * uses NO_PAD scanlines b/c of problems with using the chip in 167301ea0f4Smrg * DWORD mode. Once other padding modes are available in XAA this 168301ea0f4Smrg * Code can be turned back on. 169301ea0f4Smrg */ 170301ea0f4Smrg#if 0 171301ea0f4Smrg#ifndef ALLOW_PCI_COLOR_EXP 172301ea0f4Smrg if (pI740->Chipset != PCI_CHIP_I740_PCI) { 173301ea0f4Smrg#endif 174301ea0f4Smrg /* 175301ea0f4Smrg * Currently, we are not properly able to read the bitblt engine 176301ea0f4Smrg * busy bit on the PCI i740 card. When we are able to do so, we 177301ea0f4Smrg * can re-enable color expansion. 178301ea0f4Smrg */ 179301ea0f4Smrg infoPtr->CPUToScreenColorExpandFillFlags = 180301ea0f4Smrg NO_PLANEMASK | 181301ea0f4Smrg#ifdef USE_DWORD_COLOR_EXP 182301ea0f4Smrg SCANLINE_PAD_DWORD | 183301ea0f4Smrg#endif 184301ea0f4Smrg CPU_TRANSFER_PAD_QWORD | 185301ea0f4Smrg SYNC_AFTER_COLOR_EXPAND | 186301ea0f4Smrg BIT_ORDER_IN_BYTE_MSBFIRST; 187301ea0f4Smrg infoPtr->ColorExpandBase = (unsigned char *)(pI740->MMIOBase + BLTDATA); 188301ea0f4Smrg infoPtr->ColorExpandRange = 0x10000; 189301ea0f4Smrg infoPtr->SetupForCPUToScreenColorExpandFill = I740SetupForCPUToScreenColorExpandFill; 190301ea0f4Smrg infoPtr->SubsequentCPUToScreenColorExpandFill = I740SubsequentCPUToScreenColorExpandFill; 191301ea0f4Smrg#ifndef ALLOW_PCI_COLOR_EXP 192301ea0f4Smrg } 193301ea0f4Smrg#endif 194301ea0f4Smrg#endif 195301ea0f4Smrg return XAAInit(pScreen, infoPtr); 196213fdd94Smrg#else 197213fdd94Smrg return FALSE; 198213fdd94Smrg#endif 199301ea0f4Smrg} 200301ea0f4Smrg 201213fdd94Smrg#ifdef HAVE_XAA_H 202213fdd94Smrg 203301ea0f4Smrgstatic void 204301ea0f4SmrgI740SyncPIO(ScrnInfoPtr pScrn) { 205301ea0f4Smrg WAIT_ENGINE_IDLE_PIO(); 206301ea0f4Smrg} 207301ea0f4Smrg 208301ea0f4Smrgstatic void 209301ea0f4SmrgI740SyncMMIO(ScrnInfoPtr pScrn) { 210301ea0f4Smrg I740Ptr pI740; 211301ea0f4Smrg 212301ea0f4Smrg pI740 = I740PTR(pScrn); 213301ea0f4Smrg WAIT_ENGINE_IDLE_MMIO(); 214301ea0f4Smrg} 215301ea0f4Smrg 216301ea0f4Smrgstatic void 217301ea0f4SmrgI740SetupForSolidFill(ScrnInfoPtr pScrn, int color, int rop, 218301ea0f4Smrg unsigned int planemask) { 219301ea0f4Smrg I740Ptr pI740; 220301ea0f4Smrg 221301ea0f4Smrg pI740 = I740PTR(pScrn); 222301ea0f4Smrg 223301ea0f4Smrg pI740->bltcmd.BR00 = ((pScrn->displayWidth * pI740->cpp) << 16) | 224301ea0f4Smrg (pScrn->displayWidth * pI740->cpp); 225301ea0f4Smrg pI740->bltcmd.BR01 = color; 226301ea0f4Smrg pI740->bltcmd.BR04 = SOLID_PAT_SELECT | PAT_IS_MONO | i740PatternRop[rop]; 227301ea0f4Smrg} 228301ea0f4Smrg 229301ea0f4Smrgstatic void 230301ea0f4SmrgI740SubsequentSolidFillRect(ScrnInfoPtr pScrn, int x, int y, int w, int h) { 231301ea0f4Smrg I740Ptr pI740; 232301ea0f4Smrg 233301ea0f4Smrg pI740 = I740PTR(pScrn); 234301ea0f4Smrg WAIT_LP_FIFO(12); 235301ea0f4Smrg OUTREG(LP_FIFO, 0x6000000A); 236301ea0f4Smrg OUTREG(LP_FIFO, pI740->bltcmd.BR00); 237301ea0f4Smrg OUTREG(LP_FIFO, pI740->bltcmd.BR01); 238301ea0f4Smrg OUTREG(LP_FIFO, 0x00000000); 239301ea0f4Smrg OUTREG(LP_FIFO, 0x00000000); 240301ea0f4Smrg OUTREG(LP_FIFO, pI740->bltcmd.BR04); 241301ea0f4Smrg OUTREG(LP_FIFO, 0x00000000); 242301ea0f4Smrg OUTREG(LP_FIFO, 0x00000000); 243301ea0f4Smrg OUTREG(LP_FIFO, (y * pScrn->displayWidth + x) * pI740->cpp); 244301ea0f4Smrg OUTREG(LP_FIFO, 0x00000000); 245301ea0f4Smrg OUTREG(LP_FIFO, 0x00000000); 246301ea0f4Smrg OUTREG(LP_FIFO, (h << 16) | (w * pI740->cpp)); 247301ea0f4Smrg} 248301ea0f4Smrg 249301ea0f4Smrgstatic void 250301ea0f4SmrgI740SetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir, int rop, 251301ea0f4Smrg unsigned int planemask, int transparency_color) 252301ea0f4Smrg{ 253301ea0f4Smrg I740Ptr pI740; 254301ea0f4Smrg 255301ea0f4Smrg pI740 = I740PTR(pScrn); 256301ea0f4Smrg pI740->bltcmd.BR00 = (((pScrn->displayWidth * pI740->cpp) << 16) | 257301ea0f4Smrg (pScrn->displayWidth * pI740->cpp)); 258301ea0f4Smrg 259301ea0f4Smrg pI740->bltcmd.BR04 = SRC_IS_IN_COLOR | SRC_USE_SRC_ADDR | i740Rop[rop]; 260301ea0f4Smrg if (xdir == -1) 261301ea0f4Smrg pI740->bltcmd.BR04 |= BLT_RIGHT_TO_LEFT; 262301ea0f4Smrg else 263301ea0f4Smrg pI740->bltcmd.BR04 |= BLT_LEFT_TO_RIGHT; 264301ea0f4Smrg 265301ea0f4Smrg if (ydir == -1) 266301ea0f4Smrg pI740->bltcmd.BR04 |= BLT_BOT_TO_TOP; 267301ea0f4Smrg else 268301ea0f4Smrg pI740->bltcmd.BR04 |= BLT_TOP_TO_BOT; 269301ea0f4Smrg 270301ea0f4Smrg pI740->bltcmd.BR01 = 0x00000000; 271301ea0f4Smrg 272301ea0f4Smrg} 273301ea0f4Smrg 274301ea0f4Smrgstatic void 275301ea0f4SmrgI740SubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int x1, int y1, 276301ea0f4Smrg int x2, int y2, int w, int h) { 277301ea0f4Smrg I740Ptr pI740; 278301ea0f4Smrg 279301ea0f4Smrg pI740 = I740PTR(pScrn); 280301ea0f4Smrg if (pI740->bltcmd.BR04 & BLT_BOT_TO_TOP) { 281301ea0f4Smrg pI740->bltcmd.BR06 = (y1 + h - 1) * 282301ea0f4Smrg pScrn->displayWidth * pI740->cpp; 283301ea0f4Smrg pI740->bltcmd.BR07 = (y2 + h - 1) * 284301ea0f4Smrg pScrn->displayWidth * pI740->cpp; 285301ea0f4Smrg } else { 286301ea0f4Smrg pI740->bltcmd.BR06 = y1 * pScrn->displayWidth * pI740->cpp; 287301ea0f4Smrg pI740->bltcmd.BR07 = y2 * pScrn->displayWidth * pI740->cpp; 288301ea0f4Smrg } 289301ea0f4Smrg 290301ea0f4Smrg if (pI740->bltcmd.BR04 & BLT_RIGHT_TO_LEFT) { 291301ea0f4Smrg pI740->bltcmd.BR06 += (x1 + w - 1) * pI740->cpp + pI740->cpp - 1; 292301ea0f4Smrg pI740->bltcmd.BR07 += (x2 + w - 1) * pI740->cpp + pI740->cpp - 1; 293301ea0f4Smrg } else { 294301ea0f4Smrg pI740->bltcmd.BR06 += x1 * pI740->cpp; 295301ea0f4Smrg pI740->bltcmd.BR07 += x2 * pI740->cpp; 296301ea0f4Smrg } 297301ea0f4Smrg 298301ea0f4Smrg WAIT_LP_FIFO(12); 299301ea0f4Smrg OUTREG(LP_FIFO, 0x6000000A); 300301ea0f4Smrg OUTREG(LP_FIFO, pI740->bltcmd.BR00); 301301ea0f4Smrg OUTREG(LP_FIFO, pI740->bltcmd.BR01); 302301ea0f4Smrg OUTREG(LP_FIFO, 0x00000000); 303301ea0f4Smrg OUTREG(LP_FIFO, 0x00000000); 304301ea0f4Smrg OUTREG(LP_FIFO, pI740->bltcmd.BR04); 305301ea0f4Smrg OUTREG(LP_FIFO, 0x00000000); 306301ea0f4Smrg OUTREG(LP_FIFO, pI740->bltcmd.BR06); 307301ea0f4Smrg OUTREG(LP_FIFO, pI740->bltcmd.BR07); 308301ea0f4Smrg OUTREG(LP_FIFO, 0x00000000); 309301ea0f4Smrg OUTREG(LP_FIFO, 0x00000000); 310301ea0f4Smrg OUTREG(LP_FIFO, (h << 16) | (w * pI740->cpp)); 311301ea0f4Smrg} 312301ea0f4Smrg 313301ea0f4Smrgstatic void 314301ea0f4SmrgI740SetupForMono8x8PatternFill(ScrnInfoPtr pScrn, int pattx, int patty, 315301ea0f4Smrg int fg, int bg, int rop, 316301ea0f4Smrg unsigned int planemask) { 317301ea0f4Smrg I740Ptr pI740; 318301ea0f4Smrg 319301ea0f4Smrg pI740 = I740PTR(pScrn); 320301ea0f4Smrg pI740->bltcmd.BR00 = ((pScrn->displayWidth * pI740->cpp) << 16) | 321301ea0f4Smrg (pScrn->displayWidth * pI740->cpp); 322301ea0f4Smrg 323301ea0f4Smrg pI740->bltcmd.BR01 = bg; 324301ea0f4Smrg pI740->bltcmd.BR02 = fg; 325301ea0f4Smrg 326301ea0f4Smrg pI740->bltcmd.BR04 = PAT_IS_MONO | i740PatternRop[rop]; 327301ea0f4Smrg if (bg == -1) pI740->bltcmd.BR04 |= MONO_PAT_TRANSP; 328301ea0f4Smrg 329301ea0f4Smrg pI740->bltcmd.BR05 = (pattx + patty * pScrn->displayWidth) * pI740->cpp; 330301ea0f4Smrg} 331301ea0f4Smrg 332301ea0f4Smrgstatic void 333301ea0f4SmrgI740SubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn, int pattx, int patty, 334301ea0f4Smrg int x, int y, int w, int h) { 335301ea0f4Smrg I740Ptr pI740; 336301ea0f4Smrg 337301ea0f4Smrg pI740 = I740PTR(pScrn); 338301ea0f4Smrg WAIT_LP_FIFO(12); 339301ea0f4Smrg OUTREG(LP_FIFO, 0x6000000A); 340301ea0f4Smrg OUTREG(LP_FIFO, pI740->bltcmd.BR00); 341301ea0f4Smrg OUTREG(LP_FIFO, pI740->bltcmd.BR01); 342301ea0f4Smrg OUTREG(LP_FIFO, pI740->bltcmd.BR02); 343301ea0f4Smrg OUTREG(LP_FIFO, 0x00000000); 344301ea0f4Smrg OUTREG(LP_FIFO, pI740->bltcmd.BR04 | ((y<<20) & PAT_VERT_ALIGN)); 345301ea0f4Smrg OUTREG(LP_FIFO, pI740->bltcmd.BR05); 346301ea0f4Smrg OUTREG(LP_FIFO, 0x00000000); 347301ea0f4Smrg OUTREG(LP_FIFO, (y * pScrn->displayWidth + x) * pI740->cpp); 348301ea0f4Smrg OUTREG(LP_FIFO, 0x00000000); 349301ea0f4Smrg OUTREG(LP_FIFO, 0x00000000); 350301ea0f4Smrg OUTREG(LP_FIFO, (h << 16) | (w * pI740->cpp)); 351301ea0f4Smrg} 352301ea0f4Smrg#if 0 353301ea0f4Smrgstatic void 354301ea0f4SmrgI740SetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, int bg, int fg, 355301ea0f4Smrg int rop, unsigned int planemask) { 356301ea0f4Smrg I740Ptr pI740; 357301ea0f4Smrg 358301ea0f4Smrg pI740 = I740PTR(pScrn); 359301ea0f4Smrg pI740->bltcmd.BR00 = (pScrn->displayWidth * pI740->cpp) << 16; 360301ea0f4Smrg pI740->bltcmd.BR01 = bg; 361301ea0f4Smrg pI740->bltcmd.BR02 = fg; 362301ea0f4Smrg#ifdef USE_DWORD_COLOR_EXP 363301ea0f4Smrg pI740->bltcmd.BR03 = MONO_DWORD_ALIGN | MONO_USE_COLEXP; 364301ea0f4Smrg#else 365301ea0f4Smrg pI740->bltcmd.BR03 = MONO_BIT_ALIGN | MONO_USE_COLEXP; 366301ea0f4Smrg#endif 367301ea0f4Smrg pI740->bltcmd.BR04 = SRC_IS_MONO | SRC_USE_BLTDATA | i740Rop[rop]; 368301ea0f4Smrg if (bg == -1) pI740->bltcmd.BR04 |= MONO_SRC_TRANSP; 369301ea0f4Smrg} 370301ea0f4Smrg 371301ea0f4Smrgstatic void 372301ea0f4SmrgI740SubsequentCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, int x, int y, 373301ea0f4Smrg int w, int h, int skipleft) { 374301ea0f4Smrg I740Ptr pI740; 375301ea0f4Smrg 376301ea0f4Smrg pI740 = I740PTR(pScrn); 377301ea0f4Smrg pI740->AccelInfoRec->Sync(pScrn); 378301ea0f4Smrg OUTREG(LP_FIFO, 0x6000000A); 379301ea0f4Smrg OUTREG(LP_FIFO, pI740->bltcmd.BR00); 380301ea0f4Smrg OUTREG(LP_FIFO, pI740->bltcmd.BR01); 381301ea0f4Smrg OUTREG(LP_FIFO, pI740->bltcmd.BR02); 382301ea0f4Smrg OUTREG(LP_FIFO, pI740->bltcmd.BR03 | (skipleft & MONO_SRC_LEFT_CLIP)); 383301ea0f4Smrg OUTREG(LP_FIFO, pI740->bltcmd.BR04); 384301ea0f4Smrg OUTREG(LP_FIFO, 0x00000000); 385301ea0f4Smrg OUTREG(LP_FIFO, 0x00000000); 386301ea0f4Smrg OUTREG(LP_FIFO, (y * pScrn->displayWidth + x) * pI740->cpp); 387301ea0f4Smrg OUTREG(LP_FIFO, 0x00000000); 388301ea0f4Smrg OUTREG(LP_FIFO, 0x00000000); 389301ea0f4Smrg#ifdef USE_DWORD_COLOR_EXP 390301ea0f4Smrg /* 391301ea0f4Smrg * This extra wait is necessary to keep the bitblt engine from 392301ea0f4Smrg * locking up, but I am not sure why it is needed. If we take it 393301ea0f4Smrg * out, "x11perf -copyplane10" will lock the bitblt engine. When 394301ea0f4Smrg * the bitblt engine is locked, it is waiting for mono data to be 395301ea0f4Smrg * written to the BLTDATA region, which seems to imply that some of 396301ea0f4Smrg * the data that was written was lost. This might be fixed by 397301ea0f4Smrg * BLT_SKEW changes. Update: The engine still locks up with this 398301ea0f4Smrg * extra wait. More investigation (and time) is needed. 399301ea0f4Smrg */ 400301ea0f4Smrg WAIT_BLT_IDLE(); 401301ea0f4Smrg#endif 402301ea0f4Smrg OUTREG(LP_FIFO, (h << 16) | (w * pI740->cpp)); 403301ea0f4Smrg} 404301ea0f4Smrg#endif 405213fdd94Smrg 406213fdd94Smrg#endif 407