1/* 2 * Copyright 1992-2003 by Alan Hourihane, North Wales, UK. 3 * 4 * Permission to use, copy, modify, distribute, and sell this software 5 * and its documentation for any purpose is hereby granted without 6 * fee, provided that the above copyright notice appear in all copies 7 * and that both that copyright notice and this permission notice 8 * appear in supporting documentation, and that the name of Alan 9 * Hourihane not be used in advertising or publicity pertaining to 10 * distribution of the software without specific, written prior 11 * permission. Alan Hourihane makes no representations about the 12 * suitability of this software for any purpose. It is provided 13 * "as is" without express or implied warranty. 14 * 15 * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS 16 * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND 17 * FITNESS, IN NO EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY 18 * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 19 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN 20 * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING 21 * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS 22 * SOFTWARE. 23 * 24 * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk> 25 * 26 * Trident accelerated options. 27 */ 28 29#ifdef HAVE_CONFIG_H 30#include "config.h" 31#endif 32 33#include "xf86.h" 34#include "xf86_OSproc.h" 35 36#include "xf86Pci.h" 37 38#include "miline.h" 39 40#include "trident.h" 41#include "trident_regs.h" 42 43#ifdef HAVE_XAA_H 44#include "xaalocal.h" 45#include "xaarop.h" 46 47static void TridentSync(ScrnInfoPtr pScrn); 48static void TridentSetupForDashedLine(ScrnInfoPtr pScrn, 49 int fg, int bg, 50 int rop, 51 unsigned int planemask, 52 int length, 53 unsigned char *pattern); 54static void TridentSubsequentDashedBresenhamLine(ScrnInfoPtr pScrn, 55 int x, int y, 56 int dmaj, int dmin, 57 int e, int len, 58 int octant, 59 int phase); 60static void TridentSetupForSolidLine(ScrnInfoPtr pScrn, 61 int color, 62 int rop, 63 unsigned int planemask); 64static void TridentSubsequentSolidBresenhamLine(ScrnInfoPtr pScrn, 65 int x, int y, 66 int dmaj, int dmin, 67 int e, int len, 68 int octant); 69static void TridentSubsequentSolidHorVertLine(ScrnInfoPtr pScrn, 70 int x, int y, 71 int len, int dir); 72static void TridentSetupForFillRectSolid(ScrnInfoPtr pScrn, 73 int color, 74 int rop, 75 unsigned int planemask); 76static void TridentSubsequentFillRectSolid(ScrnInfoPtr pScrn, 77 int x, int y, 78 int w, int h); 79static void TridentSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, 80 int x1, int y1, 81 int x2, int y2, 82 int w, int h); 83static void TridentSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, 84 int xdir, int ydir, 85 int rop, 86 unsigned int planemask, 87 int transparency_color); 88static void TridentSetupForMono8x8PatternFill(ScrnInfoPtr pScrn, 89 int patternx, 90 int patterny, 91 int fg, int bg, 92 int rop, 93 unsigned int planemask); 94static void TridentSubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn, 95 int patternx, 96 int patterny, 97 int x, int y, 98 int w, int h); 99#if 0 100static void TridentSetupForColor8x8PatternFill(ScrnInfoPtr pScrn, 101 int patternx, 102 int patterny, 103 int rop, 104 unsigned int planemask, 105 int trans_col); 106static void TridentSubsequentColor8x8PatternFillRect(ScrnInfoPtr pScrn, 107 int patternx, 108 int patterny, 109 int x, int y, 110 int w, int h); 111#endif 112#if 0 113static void TridentSetupForScanlineCPUToScreenColorExpandFill( 114 ScrnInfoPtr pScrn, 115 int fg, int bg, 116 int rop, 117 unsigned int planemask); 118static void TridentSubsequentScanlineCPUToScreenColorExpandFill( 119 ScrnInfoPtr pScrn, 120 int x, int y, 121 int w, int h, 122 int skipleft); 123static void TridentSubsequentColorExpandScanline(ScrnInfoPtr pScrn, 124 int bufno); 125#endif 126 127 128static void 129TridentInitializeAccelerator(ScrnInfoPtr pScrn) 130{ 131 TRIDENTPtr pTrident = TRIDENTPTR(pScrn); 132 133 /* This forces updating the clipper */ 134 pTrident->Clipping = TRUE; 135 136 CHECKCLIPPING; 137 138 if ((pTrident->Chipset == PROVIDIA9682) || 139 (pTrident->Chipset == CYBER9385) || 140 (pTrident->Chipset == CYBER9382)) 141 pTrident->EngineOperation |= 0x100; /* Disable Clipping */ 142 143 TGUI_OPERMODE(pTrident->EngineOperation); 144 145 pTrident->PatternLocation = pScrn->displayWidth * 146 pScrn->bitsPerPixel / 8; 147} 148#endif 149 150Bool 151TridentAccelInit(ScreenPtr pScreen) 152{ 153#ifdef HAVE_XAA_H 154 XAAInfoRecPtr infoPtr; 155 ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); 156 TRIDENTPtr pTrident = TRIDENTPTR(pScrn); 157 158 if (pTrident->NoAccel) 159 return FALSE; 160 161 pTrident->AccelInfoRec = infoPtr = XAACreateInfoRec(); 162 if (!infoPtr) return FALSE; 163 164 if (!((pTrident->Chipset == TGUI9440AGi) && 165 (pScrn->bitsPerPixel > 8))) 166 infoPtr->Flags = PIXMAP_CACHE | 167 OFFSCREEN_PIXMAPS | 168 LINEAR_FRAMEBUFFER; 169 170 pTrident->InitializeAccelerator = TridentInitializeAccelerator; 171 TridentInitializeAccelerator(pScrn); 172 173 infoPtr->PixmapCacheFlags = DO_NOT_BLIT_STIPPLES; 174 175 infoPtr->Sync = TridentSync; 176 177 infoPtr->SolidLineFlags = NO_PLANEMASK; 178 infoPtr->SetupForSolidLine = TridentSetupForSolidLine; 179 infoPtr->SolidBresenhamLineErrorTermBits = 12; 180 infoPtr->SubsequentSolidBresenhamLine = 181 TridentSubsequentSolidBresenhamLine; 182 infoPtr->SubsequentSolidHorVertLine = 183 TridentSubsequentSolidHorVertLine; 184 185 infoPtr->DashedLineFlags = LINE_PATTERN_MSBFIRST_LSBJUSTIFIED | 186 NO_PLANEMASK | 187 LINE_PATTERN_POWER_OF_2_ONLY; 188 infoPtr->SetupForDashedLine = TridentSetupForDashedLine; 189 infoPtr->DashedBresenhamLineErrorTermBits = 12; 190 infoPtr->SubsequentDashedBresenhamLine = 191 TridentSubsequentDashedBresenhamLine; 192 infoPtr->DashPatternMaxLength = 16; 193 194 infoPtr->SolidFillFlags = NO_PLANEMASK; 195 infoPtr->SetupForSolidFill = TridentSetupForFillRectSolid; 196 infoPtr->SubsequentSolidFillRect = TridentSubsequentFillRectSolid; 197 198 infoPtr->ScreenToScreenCopyFlags = NO_PLANEMASK; 199 200 if (!HAS_DST_TRANS) 201 infoPtr->ScreenToScreenCopyFlags |= NO_TRANSPARENCY; 202 203 infoPtr->SetupForScreenToScreenCopy = 204 TridentSetupForScreenToScreenCopy; 205 infoPtr->SubsequentScreenToScreenCopy = 206 TridentSubsequentScreenToScreenCopy; 207 208 if (!(((pTrident->Chipset == PROVIDIA9685) || 209 (pTrident->Chipset == CYBER9388)) && 210 (pScrn->bitsPerPixel > 8))) { 211 infoPtr->Mono8x8PatternFillFlags = NO_PLANEMASK | 212 HARDWARE_PATTERN_SCREEN_ORIGIN | 213 BIT_ORDER_IN_BYTE_MSBFIRST; 214 215 infoPtr->SetupForMono8x8PatternFill = 216 TridentSetupForMono8x8PatternFill; 217 infoPtr->SubsequentMono8x8PatternFillRect = 218 TridentSubsequentMono8x8PatternFillRect; 219 } 220 221#if 0 222 /* 223 * Not convinced this works 100% yet. 224 */ 225 infoPtr->Color8x8PatternFillFlags = NO_PLANEMASK | 226 HARDWARE_PATTERN_SCREEN_ORIGIN | 227 BIT_ORDER_IN_BYTE_MSBFIRST; 228 229 if (!HAS_DST_TRANS) 230 infoPtr->Color8x8PatternFillFlags |= NO_TRANSPARENCY; 231 232 infoPtr->SetupForColor8x8PatternFill = 233 TridentSetupForColor8x8PatternFill; 234 infoPtr->SubsequentColor8x8PatternFillRect = 235 TridentSubsequentColor8x8PatternFillRect; 236#endif 237 238#if 0 239 /* 240 * This is buggy, it only seems to work 95% of the time.... 241 */ 242 { 243 infoPtr->ScanlineCPUToScreenColorExpandFillFlags = 244 NO_PLANEMASK | 245 NO_TRANSPARENCY | 246 BIT_ORDER_IN_BYTE_MSBFIRST; 247 248 pTrident->XAAScanlineColorExpandBuffers[0] = 249 xnfalloc(((pScrn->virtualX + 63)) * 4 * 250 (pScrn->bitsPerPixel / 8)); 251 252 infoPtr->NumScanlineColorExpandBuffers = 1; 253 infoPtr->ScanlineColorExpandBuffers = 254 pTrident->XAAScanlineColorExpandBuffers; 255 256 infoPtr->SetupForScanlineCPUToScreenColorExpandFill = 257 TridentSetupForScanlineCPUToScreenColorExpandFill; 258 infoPtr->SubsequentScanlineCPUToScreenColorExpandFill = 259 TridentSubsequentScanlineCPUToScreenColorExpandFill; 260 infoPtr->SubsequentColorExpandScanline = 261 TridentSubsequentColorExpandScanline; 262 } 263#endif 264 265 return(XAAInit(pScreen, infoPtr)); 266#else 267 return FALSE; 268#endif 269} 270 271#ifdef HAVE_XAA_H 272static void 273TridentSync(ScrnInfoPtr pScrn) 274{ 275 TRIDENTPtr pTrident = TRIDENTPTR(pScrn); 276 int count = 0, timeout = 0; 277 int busy; 278 279 TGUI_OPERMODE(pTrident->EngineOperation); 280 281 for (;;) { 282 BLTBUSY(busy); 283 if (busy != GE_BUSY) { 284 return; 285 } 286 287 count++; 288 if (count == 10000000) { 289 ErrorF("Trident: BitBLT engine time-out.\n"); 290 count = 9990000; 291 timeout++; 292 if (timeout == 8) { 293 /* Reset BitBLT Engine */ 294 TGUI_STATUS(0x00); 295 return; 296 } 297 } 298 } 299} 300 301static void 302TridentClearSync(ScrnInfoPtr pScrn) 303{ 304 TRIDENTPtr pTrident = TRIDENTPTR(pScrn); 305 int count = 0, timeout = 0; 306 int busy; 307 308 for (;;) { 309 BLTBUSY(busy); 310 if (busy != GE_BUSY) { 311 return; 312 } 313 count++; 314 if (count == 10000000) { 315 ErrorF("Trident: BitBLT engine time-out.\n"); 316 count = 9990000; 317 timeout++; 318 if (timeout == 8) { 319 /* Reset BitBLT Engine */ 320 TGUI_STATUS(0x00); 321 return; 322 } 323 } 324 } 325} 326 327static void 328TridentSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, 329 int xdir, int ydir, 330 int rop, 331 unsigned int planemask, 332 int transparency_color) 333{ 334 TRIDENTPtr pTrident = TRIDENTPTR(pScrn); 335 int dst = 0; 336 337 pTrident->BltScanDirection = 0; 338 if (xdir < 0) pTrident->BltScanDirection |= XNEG; 339 if (ydir < 0) pTrident->BltScanDirection |= YNEG; 340 341 REPLICATE(transparency_color); 342 if (transparency_color != -1) { 343 if ((pTrident->Chipset == PROVIDIA9685) || 344 (pTrident->Chipset == CYBER9388)) { 345 dst |= (1 << 16); 346 } else { 347 TGUI_OPERMODE(pTrident->EngineOperation | DST_ENABLE); 348 } 349 TGUI_CKEY(transparency_color); 350 } 351 352 TGUI_DRAWFLAG(pTrident->DrawFlag | pTrident->BltScanDirection | 353 SCR2SCR | dst); 354 TGUI_FMIX(XAAGetCopyROP(rop)); 355} 356 357static void 358TridentSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, 359 int x1, int y1, 360 int x2, int y2, 361 int w, int h) 362{ 363 TRIDENTPtr pTrident = TRIDENTPTR(pScrn); 364 365 if (pTrident->BltScanDirection & YNEG) { 366 y1 = y1 + h - 1; 367 y2 = y2 + h - 1; 368 } 369 if (pTrident->BltScanDirection & XNEG) { 370 x1 = x1 + w - 1; 371 x2 = x2 + w - 1; 372 } 373 TGUI_SRC_XY(x1,y1); 374 TGUI_DEST_XY(x2, y2); 375 TGUI_DIM_XY(w, h); 376 TGUI_COMMAND(GE_BLT); 377 TridentClearSync(pScrn); 378} 379 380static void 381TridentSetupForSolidLine(ScrnInfoPtr pScrn, 382 int color, 383 int rop, 384 unsigned int planemask) 385{ 386 TRIDENTPtr pTrident = TRIDENTPTR(pScrn); 387 388 pTrident->BltScanDirection = 0; 389 REPLICATE(color); 390 TGUI_FMIX(XAAGetPatternROP(rop)); 391 if ((pTrident->Chipset == PROVIDIA9685) || 392 (pTrident->Chipset == CYBER9388)) { 393 TGUI_FPATCOL(color); 394 } else { 395 TGUI_FCOLOUR(color); 396 } 397} 398 399static void 400TridentSubsequentSolidBresenhamLine(ScrnInfoPtr pScrn, 401 int x, int y, 402 int dmaj, int dmin, 403 int e, int len, int octant) 404{ 405 TRIDENTPtr pTrident = TRIDENTPTR(pScrn); 406 int tmp = pTrident->BltScanDirection; 407 408 if (octant & YMAJOR) tmp |= YMAJ; 409 if (octant & XDECREASING) tmp |= XNEG; 410 if (octant & YDECREASING) tmp |= YNEG; 411 TGUI_DRAWFLAG(pTrident->DrawFlag | SOLIDFILL | STENCIL | tmp); 412 TGUI_SRC_XY(dmin-dmaj,dmin); 413 TGUI_DEST_XY(x, y); 414 TGUI_DIM_XY(dmin + e, len); 415 TGUI_COMMAND(GE_BRESLINE); 416 TridentSync(pScrn); 417} 418 419static void 420TridentSubsequentSolidHorVertLine(ScrnInfoPtr pScrn, 421 int x, int y, 422 int len, int dir) 423{ 424 TRIDENTPtr pTrident = TRIDENTPTR(pScrn); 425 426 TGUI_DRAWFLAG(pTrident->DrawFlag | SOLIDFILL); 427 if (dir == DEGREES_0) { 428 TGUI_DIM_XY(len, 1); 429 TGUI_DEST_XY(x, y); 430 } else { 431 TGUI_DIM_XY(1, len); 432 TGUI_DEST_XY(x, y); 433 } 434 TGUI_COMMAND(GE_BLT); 435 TridentSync(pScrn); 436} 437 438void 439TridentSetupForDashedLine(ScrnInfoPtr pScrn, 440 int fg, int bg, 441 int rop, 442 unsigned int planemask, 443 int length, 444 unsigned char *pattern) 445{ 446 TRIDENTPtr pTrident = TRIDENTPTR(pScrn); 447 CARD32 *DashPattern = (CARD32*)pattern; 448 CARD32 NiceDashPattern = DashPattern[0]; 449 450 NiceDashPattern = *((CARD16 *)pattern) & ((1 << length) - 1); 451 switch(length) { 452 case 2: NiceDashPattern |= NiceDashPattern << 2; 453 case 4: NiceDashPattern |= NiceDashPattern << 4; 454 case 8: NiceDashPattern |= NiceDashPattern << 8; 455 } 456 pTrident->BltScanDirection = 0; 457 REPLICATE(fg); 458 if ((pTrident->Chipset == PROVIDIA9685) || 459 (pTrident->Chipset == CYBER9388)) { 460 TGUI_FPATCOL(fg); 461 if (bg == -1) { 462 pTrident->BltScanDirection |= (1 << 12); 463 TGUI_BPATCOL(~fg); 464 } else { 465 REPLICATE(bg); 466 TGUI_BPATCOL(bg); 467 } 468 } else { 469 TGUI_FCOLOUR(fg); 470 if (bg == -1) { 471 pTrident->BltScanDirection |= (1 << 12); 472 TGUI_BCOLOUR(~fg); 473 } else { 474 REPLICATE(bg); 475 TGUI_BCOLOUR(bg); 476 } 477 } 478 TGUI_FMIX(XAAGetPatternROP(rop)); 479 pTrident->LinePattern = NiceDashPattern; 480} 481 482 483void 484TridentSubsequentDashedBresenhamLine(ScrnInfoPtr pScrn, 485 int x, int y, 486 int dmaj, int dmin, 487 int e, int len, 488 int octant, int phase) 489{ 490 TRIDENTPtr pTrident = TRIDENTPTR(pScrn); 491 int tmp = pTrident->BltScanDirection; 492 493 if (octant & YMAJOR) tmp |= YMAJ; 494 if (octant & XDECREASING) tmp |= XNEG; 495 if (octant & YDECREASING) tmp |= YNEG; 496 497 TGUI_STYLE(((pTrident->LinePattern >> phase) | 498 (pTrident->LinePattern << (16-phase))) & 0x0000FFFF); 499 TGUI_DRAWFLAG(pTrident->DrawFlag | STENCIL | tmp); 500 TGUI_SRC_XY(dmin - dmaj, dmin); 501 TGUI_DEST_XY(x, y); 502 TGUI_DIM_XY(e + dmin, len); 503 TGUI_COMMAND(GE_BRESLINE); 504 TridentSync(pScrn); 505} 506 507static void 508TridentSetupForFillRectSolid(ScrnInfoPtr pScrn, 509 int color, 510 int rop, 511 unsigned int planemask) 512{ 513 TRIDENTPtr pTrident = TRIDENTPTR(pScrn); 514 int drawflag = 0; 515 516 REPLICATE(color); 517 TGUI_FMIX(XAAGetPatternROP(rop)); 518 if ((pTrident->Chipset == PROVIDIA9685) || 519 (pTrident->Chipset == CYBER9388)) { 520 TGUI_FPATCOL(color); 521 } else { 522 drawflag |= PATMONO; 523 TGUI_FCOLOUR(color); 524 } 525 526 TGUI_DRAWFLAG(pTrident->DrawFlag | SOLIDFILL | drawflag); 527} 528 529static void 530TridentSubsequentFillRectSolid(ScrnInfoPtr pScrn, 531 int x, int y, 532 int w, int h) 533{ 534 TRIDENTPtr pTrident = TRIDENTPTR(pScrn); 535 536 TGUI_DIM_XY(w, h); 537 TGUI_DEST_XY(x, y); 538 TGUI_COMMAND(GE_BLT); 539 TridentSync(pScrn); 540} 541 542#if 0 543static void 544MoveDWORDS(register CARD32* dest, 545 register CARD32* src, 546 register int dwords) 547{ 548 while(dwords & ~0x03) { 549 *dest = *src; 550 *(dest + 1) = *(src + 1); 551 *(dest + 2) = *(src + 2); 552 *(dest + 3) = *(src + 3); 553 src += 4; 554 dest += 4; 555 dwords -= 4; 556 } 557 558 if (!dwords) return; 559 *dest = *src; 560 dest += 1; 561 src += 1; 562 if (dwords == 1) return; 563 *dest = *src; 564 dest += 1; 565 src += 1; 566 if (dwords == 2) return; 567 *dest = *src; 568 dest += 1; 569 src += 1; 570} 571#endif 572 573static void 574TridentSetupForMono8x8PatternFill(ScrnInfoPtr pScrn, 575 int patternx, int patterny, 576 int fg, int bg, 577 int rop, 578 unsigned int planemask) 579{ 580 TRIDENTPtr pTrident = TRIDENTPTR(pScrn); 581 int drawflag = 0; 582 583 REPLICATE(fg); 584 if ((pTrident->Chipset == PROVIDIA9685) || 585 (pTrident->Chipset == CYBER9388)) 586 TGUI_FPATCOL(fg); 587 else 588 TGUI_FCOLOUR(fg); 589 590 if (bg == -1) { 591 drawflag |= (1 << 12); 592 if ((pTrident->Chipset == PROVIDIA9685) || 593 (pTrident->Chipset == CYBER9388)) 594 TGUI_BPATCOL(~fg); 595 else 596 TGUI_BCOLOUR(~fg); 597 } else { 598 REPLICATE(bg); 599 if ((pTrident->Chipset == PROVIDIA9685) || 600 (pTrident->Chipset == CYBER9388)) 601 TGUI_BPATCOL(bg); 602 else 603 TGUI_BCOLOUR(bg); 604 } 605 606 if ((pTrident->Chipset == PROVIDIA9685) || 607 (pTrident->Chipset == CYBER9388)) { 608 drawflag |= (7 << 18); 609 } 610 611 TGUI_DRAWFLAG(pTrident->DrawFlag | PAT2SCR | PATMONO | drawflag); 612 TGUI_PATLOC(((patterny * pTrident->PatternLocation) + 613 (patternx * pScrn->bitsPerPixel / 8)) >> 6); 614 TGUI_FMIX(XAAGetPatternROP(rop)); 615} 616 617static void 618TridentSubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn, 619 int patternx, int patterny, 620 int x, int y, 621 int w, int h) 622{ 623 TRIDENTPtr pTrident = TRIDENTPTR(pScrn); 624 625 TGUI_DEST_XY(x, y); 626 TGUI_DIM_XY(w, h); 627 TGUI_COMMAND(GE_BLT); 628 TridentSync(pScrn); 629} 630 631#if 0 632static void 633TridentSetupForColor8x8PatternFill(ScrnInfoPtr pScrn, 634 int patternx, int patterny, 635 int rop, 636 unsigned int planemask, 637 int transparency_color) 638{ 639 TRIDENTPtr pTrident = TRIDENTPTR(pScrn); 640 int drawflag = 0; 641 642 REPLICATE(transparency_color); 643 if (transparency_color != -1) { 644 if ((pTrident->Chipset == PROVIDIA9685) || 645 (pTrident->Chipset == CYBER9388)) { 646 drawflag |= (1 << 16); 647 } else { 648 TGUI_OPERMODE(pTrident->EngineOperation | DST_ENABLE); 649 } 650 651 TGUI_CKEY(transparency_color); 652 } 653 654 TGUI_DRAWFLAG(pTrident->DrawFlag | PAT2SCR | drawflag); 655 TGUI_PATLOC(((patterny * pTrident->PatternLocation) + 656 (patternx * pScrn->bitsPerPixel / 8)) >> 6); 657 TGUI_FMIX(XAAGetPatternROP(rop)); 658} 659 660static void 661TridentSubsequentColor8x8PatternFillRect(ScrnInfoPtr pScrn, 662 int patternx, int patterny, 663 int x, int y, 664 int w, int h) 665{ 666 TRIDENTPtr pTrident = TRIDENTPTR(pScrn); 667 668 TGUI_DEST_XY(x, y); 669 TGUI_DIM_XY(w, h); 670 TGUI_COMMAND(GE_BLT); 671 TridentClearSync(pScrn); 672} 673#endif 674 675#if 0 676static void 677TridentSetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, 678 int fg, int bg, 679 int rop, 680 unsigned int planemask) 681{ 682 TRIDENTPtr pTrident = TRIDENTPTR(pScrn); 683 int drawflag = SRCMONO; 684 685 REPLICATE(fg); 686 TGUI_FCOLOUR(fg); 687 if (bg == -1) { 688 drawflag |= (1 << 12); 689 TGUI_BCOLOUR(~fg); 690 } else { 691 REPLICATE(bg); 692 TGUI_BCOLOUR(bg); 693 } 694 695 TGUI_SRC_XY(0, 0); 696 TGUI_DRAWFLAG(drawflag); 697 TGUI_FMIX(XAAGetCopyROP(rop)); 698} 699 700static void 701TridentSubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, 702 int x, int y, 703 int w, int h, 704 int skipleft) 705{ 706 TRIDENTPtr pTrident = TRIDENTPTR(pScrn); 707 pTrident->dwords = ((w + 31) >> 5); 708 pTrident->h = h; 709 pTrident->y = y; 710 pTrident->x = x; 711 pTrident->w = w; 712 713 TGUI_DEST_XY(x, pTrident->y++); 714 TGUI_DIM_XY(w, 1); 715 TGUI_COMMAND(GE_BLT); 716} 717 718static void 719TridentSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno) 720{ 721 TRIDENTPtr pTrident = TRIDENTPTR(pScrn); 722 XAAInfoRecPtr infoRec; 723 infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); 724 725 MoveDWORDS((CARD32 *)pTrident->FbBase, 726 (CARD32 *)pTrident->XAAScanlineColorExpandBuffers[0], 727 pTrident->dwords); 728 729 pTrident->h--; 730 TridentSync(pScrn); 731 if (pTrident->h) { 732 TGUI_DEST_XY(pTrident->x, pTrident->y++); 733 TGUI_DIM_XY(pTrident->w, 1); 734 TGUI_COMMAND(GE_BLT); 735 } 736} 737#endif 738#endif 739