static void XPSetupForMono8x8PatternFill(ScrnInfoPtr pScrn, int patternx, int patterny, int fg, int bg, int rop, unsigned int planemask) { TRIDENTPtr pTrident = TRIDENTPTR(pScrn); int drawflag = 0; REPLICATE(fg); MMIO_OUT32(pTrident->IOBase, 0x2158, fg); if (bg == -1) { drawflag |= 1<<12; MMIO_OUT32(pTrident->IOBase, 0x215C, ~fg); } else { REPLICATE(bg); MMIO_OUT32(pTrident->IOBase, 0x215C, bg); } drawflag |= 7<<18; TGUI_DRAWFLAG(PATMONO | drawflag); MMIO_OUT32(pTrident->IOBase, 0x2180, patternx); MMIO_OUT32(pTrident->IOBase, 0x2184, patterny); TGUI_FMIX(XAAPatternROP[rop]); }
static void Permedia2SetupForMono8x8PatternFill24bpp(ScrnInfoPtr pScrn, int patternx, int patterny, int fg, int bg, int rop, unsigned int planemask) { GLINTPtr pGlint = GLINTPTR(pScrn); TRACE_ENTER("Permedia2SetupForMono8x8PatternFill24bpp"); if (bg == -1) pGlint->FrameBufferReadMode = -1; else pGlint->FrameBufferReadMode = 0; pGlint->ForeGroundColor = fg; pGlint->BackGroundColor = bg; REPLICATE(pGlint->ForeGroundColor); REPLICATE(pGlint->BackGroundColor); GLINT_WAIT(12); GLINT_WRITE_REG((patternx & 0xFF), AreaStipplePattern0); GLINT_WRITE_REG((patternx & 0xFF00) >> 8, AreaStipplePattern1); GLINT_WRITE_REG((patternx & 0xFF0000) >> 16, AreaStipplePattern2); GLINT_WRITE_REG((patternx & 0xFF000000) >> 24, AreaStipplePattern3); GLINT_WRITE_REG((patterny & 0xFF), AreaStipplePattern4); GLINT_WRITE_REG((patterny & 0xFF00) >> 8, AreaStipplePattern5); GLINT_WRITE_REG((patterny & 0xFF0000) >> 16, AreaStipplePattern6); GLINT_WRITE_REG((patterny & 0xFF000000) >> 24, AreaStipplePattern7); GLINT_WRITE_REG(UNIT_ENABLE, ColorDDAMode); if (rop == GXcopy) { GLINT_WRITE_REG(pGlint->pprod, FBReadMode); } else { GLINT_WRITE_REG(pGlint->pprod | FBRM_DstEnable, FBReadMode); } LOADROP(rop); }
static void XP4SetupForCPUToScreenColorExpandFill( ScrnInfoPtr pScrn, int fg, int bg, int rop, unsigned int planemask ){ TRIDENTPtr pTrident = TRIDENTPTR(pScrn); ropcode = XAAGetCopyROP(rop); #if 0 TGUI_FMIX(XAACopyROP[rop]); #endif if (bg == -1) { TGUI_DRAWFLAG(SRCMONO | 1<<12); REPLICATE(fg); TGUI_FCOLOUR(fg); } else { TGUI_DRAWFLAG(SRCMONO); REPLICATE(fg); REPLICATE(bg); TGUI_FCOLOUR(fg); TGUI_BCOLOUR(bg); } }
static void Permedia3SetupForScanlineCPUToScreenColorExpandFill( ScrnInfoPtr pScrn, int fg, int bg, int rop, unsigned int planemask ){ GLINTPtr pGlint = GLINTPTR(pScrn); REPLICATE(fg); pGlint->PM3_Render2D = PM3Render2D_SpanOperation | PM3Render2D_XPositive | PM3Render2D_YPositive | PM3Render2D_Operation_SyncOnBitMask; pGlint->PM3_Config2D = PM3Config2D_UserScissorEnable | PM3Config2D_UseConstantSource | PM3Config2D_ForegroundROPEnable | PM3Config2D_ForegroundROP(rop) | PM3Config2D_FBWriteEnable; if ((rop!=GXclear)&&(rop!=GXset)&&(rop!=GXcopy)&&(rop!=GXcopyInverted)) pGlint->PM3_Config2D |= PM3Config2D_FBDestReadEnable; if (bg != -1) { REPLICATE(bg); pGlint->PM3_Config2D |= PM3Config2D_OpaqueSpan; GLINT_WAIT(4); GLINT_WRITE_REG(bg, BackgroundColor); } else GLINT_WAIT(3); GLINT_WRITE_REG(fg, PM3ForegroundColor); PM3_PLANEMASK(planemask); GLINT_WRITE_REG(pGlint->PM3_Config2D, PM3Config2D); }
static void RAGE128SetupForFillRectSolid(int color, int rop, unsigned int planemask) { outl(IOBase, 0x146C); outl(IOBase + 4, 3<<28 | 13<<4 | BPP<<8 | PATROP[rop]<<16 | 3<<12); REPLICATE(color); outl(IOBase, 0x147C); outl(IOBase + 4, color); REPLICATE(planemask); outl(IOBase, 0x16CC); outl(IOBase + 4, planemask); }
/* 8x8 Mono Pattern Fills */ static void Permedia3SetupForMono8x8PatternFill(ScrnInfoPtr pScrn, int patternx, int patterny, int fg, int bg, int rop, unsigned int planemask) { GLINTPtr pGlint = GLINTPTR(pScrn); TRACE_ENTER("Permedia3SetupForMono8x8PatternFill"); REPLICATE(fg); pGlint->PM3_Render2D = PM3Render2D_AreaStippleEnable | PM3Render2D_SpanOperation | PM3Render2D_XPositive | PM3Render2D_YPositive | PM3Render2D_Operation_Normal; pGlint->PM3_Config2D = PM3Config2D_UseConstantSource | PM3Config2D_ForegroundROPEnable | PM3Config2D_ForegroundROP(rop) | PM3Config2D_FBWriteEnable; if ((rop!=GXclear)&&(rop!=GXset)&&(rop!=GXcopy)&&(rop!=GXcopyInverted)) pGlint->PM3_Config2D |= PM3Config2D_FBDestReadEnable; pGlint->PM3_AreaStippleMode = 1; /* Mirror stipple pattern horizontally */ #if X_BYTE_ORDER == X_BIG_ENDIAN pGlint->PM3_AreaStippleMode |= (1<<18); #endif pGlint->PM3_AreaStippleMode |= (2<<1); pGlint->PM3_AreaStippleMode |= (2<<4); if (bg != -1) { REPLICATE(bg); pGlint->PM3_Config2D |= PM3Config2D_OpaqueSpan; pGlint->PM3_AreaStippleMode |= 1<<20; GLINT_WAIT(12); GLINT_WRITE_REG(bg, BackgroundColor); } else GLINT_WAIT(11); GLINT_WRITE_REG((patternx & 0xFF), AreaStipplePattern0); GLINT_WRITE_REG((patternx & 0xFF00) >> 8, AreaStipplePattern1); GLINT_WRITE_REG((patternx & 0xFF0000) >> 16, AreaStipplePattern2); GLINT_WRITE_REG((patternx & 0xFF000000) >> 24, AreaStipplePattern3); GLINT_WRITE_REG((patterny & 0xFF), AreaStipplePattern4); GLINT_WRITE_REG((patterny & 0xFF00) >> 8, AreaStipplePattern5); GLINT_WRITE_REG((patterny & 0xFF0000) >> 16, AreaStipplePattern6); GLINT_WRITE_REG((patterny & 0xFF000000) >> 24, AreaStipplePattern7); GLINT_WRITE_REG(fg, PM3ForegroundColor); PM3_PLANEMASK(planemask); GLINT_WRITE_REG(pGlint->PM3_Config2D, PM3Config2D); TRACE_EXIT("Permedia3SetupForMono8x8PatternFill"); }
static void TridentSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir, int rop, unsigned int planemask, int transparency_color) { TRIDENTPtr pTrident = TRIDENTPTR(pScrn); int dst = 0; pTrident->BltScanDirection = 0; if (xdir < 0) pTrident->BltScanDirection |= XNEG; if (ydir < 0) pTrident->BltScanDirection |= YNEG; REPLICATE(transparency_color); if (transparency_color != -1) { if (pTrident->Chipset == PROVIDIA9685 || pTrident->Chipset == CYBER9388) { dst |= 1<<16; } else { TGUI_OPERMODE(pTrident->EngineOperation | DST_ENABLE); } TGUI_CKEY(transparency_color); } TGUI_DRAWFLAG(pTrident->DrawFlag | pTrident->BltScanDirection | SCR2SCR | dst); TGUI_FMIX(XAAGetCopyROP(rop)); }
static void TridentSetupForColor8x8PatternFill(ScrnInfoPtr pScrn, int patternx, int patterny, int rop, unsigned int planemask, int transparency_color) { TRIDENTPtr pTrident = TRIDENTPTR(pScrn); int drawflag = 0; REPLICATE(transparency_color); if (transparency_color != -1) { if (pTrident->Chipset == PROVIDIA9685 || pTrident->Chipset == CYBER9388) { drawflag |= 1<<16; } else { TGUI_OPERMODE(pTrident->EngineOperation | DST_ENABLE); } TGUI_CKEY(transparency_color); } TGUI_DRAWFLAG(pTrident->DrawFlag | PAT2SCR | drawflag); TGUI_PATLOC(((patterny * pTrident->PatternLocation) + (patternx * pScrn->bitsPerPixel / 8)) >> 6); TGUI_FMIX(XAAGetPatternROP(rop)); }
/* Solid Fills */ static void Permedia3SetupForFillRectSolid(ScrnInfoPtr pScrn, int color, int rop, unsigned int planemask) { GLINTPtr pGlint = GLINTPTR(pScrn); TRACE_ENTER("Permedia3SetupForFillRectSolid"); /* Prepare Common Render2D & Config2D data */ pGlint->PM3_Render2D = PM3Render2D_XPositive | PM3Render2D_YPositive | PM3Render2D_Operation_Normal; pGlint->PM3_Config2D = PM3Config2D_UseConstantSource | PM3Config2D_ForegroundROPEnable | PM3Config2D_ForegroundROP(rop) | PM3Config2D_FBWriteEnable; GLINT_WAIT(3); REPLICATE(color); /* We can't do block fills properly at 32bpp, so we can stick the chip * into 16bpp and double the width and xcoord, but it seems that at * extremely high resolutions (above 1600) it doesn't fill. * so, we fall back to the slower span filling method. */ if ((rop == GXcopy) && (pScrn->bitsPerPixel == 32) && (pScrn->displayWidth <= 1600)) { pGlint->AccelInfoRec->SubsequentSolidFillRect = Permedia3SubsequentFillRectSolid32bpp; if (pGlint->PM3_UsingSGRAM) { GLINT_WRITE_REG(color, PM3FBBlockColor); } else { pGlint->PM3_Render2D |= PM3Render2D_SpanOperation; GLINT_WRITE_REG(color, PM3ForegroundColor); } } else { pGlint->AccelInfoRec->SubsequentSolidFillRect = Permedia3SubsequentFillRectSolid; /* Can't do block fills at 8bpp either */ if ((rop == GXcopy) && (pScrn->bitsPerPixel == 16)) { if (pGlint->PM3_UsingSGRAM) { GLINT_WRITE_REG(color, PM3FBBlockColor); } else { pGlint->PM3_Render2D |= PM3Render2D_SpanOperation; GLINT_WRITE_REG(color, PM3ForegroundColor); } } else { pGlint->PM3_Render2D |= PM3Render2D_SpanOperation; GLINT_WRITE_REG(color, PM3ForegroundColor); } } PM3_PLANEMASK(planemask); if (((rop!=GXclear)&&(rop!=GXset)&&(rop!=GXcopy)&&(rop!=GXcopyInverted)) || ((planemask != 0xffffffff) && !(pGlint->PM3_UsingSGRAM))) pGlint->PM3_Config2D |= PM3Config2D_FBDestReadEnable; GLINT_WRITE_REG(pGlint->PM3_Config2D, PM3Config2D); TRACE_EXIT("Permedia3SetupForFillRectSolid"); }
void TridentSetupForDashedLine( ScrnInfoPtr pScrn, int fg, int bg, int rop, unsigned int planemask, int length, unsigned char *pattern ){ TRIDENTPtr pTrident = TRIDENTPTR(pScrn); CARD32 *DashPattern = (CARD32*)pattern; CARD32 NiceDashPattern = DashPattern[0]; NiceDashPattern = *((CARD16 *)pattern) & ((1<<length) - 1); switch(length) { case 2: NiceDashPattern |= NiceDashPattern << 2; case 4: NiceDashPattern |= NiceDashPattern << 4; case 8: NiceDashPattern |= NiceDashPattern << 8; } pTrident->BltScanDirection = 0; REPLICATE(fg); if (pTrident->Chipset == PROVIDIA9685 || pTrident->Chipset == CYBER9388) { TGUI_FPATCOL(fg); if (bg == -1) { pTrident->BltScanDirection |= 1<<12; TGUI_BPATCOL(~fg); } else { REPLICATE(bg); TGUI_BPATCOL(bg); } } else { TGUI_FCOLOUR(fg); if (bg == -1) { pTrident->BltScanDirection |= 1<<12; TGUI_BCOLOUR(~fg); } else { REPLICATE(bg); TGUI_BCOLOUR(bg); } } TGUI_FMIX(XAAGetPatternROP(rop)); pTrident->LinePattern = NiceDashPattern; }
static void Permedia2SetupForScanlineCPUToScreenColorExpandFill( ScrnInfoPtr pScrn, int fg, int bg, int rop, unsigned int planemask ){ GLINTPtr pGlint = GLINTPTR(pScrn); int dobackground = 0; TRACE_ENTER("Permedia2SetupForScanlineCPUToScreenColorExpandFill"); if (bg != -1) dobackground |= ForceBackgroundColor; pGlint->BackGroundColor = bg; pGlint->ForeGroundColor = fg; REPLICATE(fg); REPLICATE(bg); GLINT_WAIT(7); DO_PLANEMASK(planemask); if (rop == GXcopy) { GLINT_WRITE_REG(pGlint->pprod, FBReadMode); } else { GLINT_WRITE_REG(pGlint->pprod|FBRM_DstEnable, FBReadMode); } if ((rop == GXcopy) && (pGlint->BackGroundColor == -1)) { pGlint->FrameBufferReadMode = FastFillEnable; GLINT_WRITE_REG(UNIT_DISABLE, ColorDDAMode); GLINT_WRITE_REG(fg, FBBlockColor); GLINT_WRITE_REG(pGlint->RasterizerSwap,RasterizerMode); } else { GLINT_WRITE_REG(UNIT_ENABLE, ColorDDAMode); GLINT_WRITE_REG(fg, ConstantColor); GLINT_WRITE_REG(BitMaskPackingEachScanline|dobackground| pGlint->RasterizerSwap,RasterizerMode); if (dobackground) { GLINT_WRITE_REG(bg, Texel0); pGlint->FrameBufferReadMode = TextureEnable; } else { pGlint->FrameBufferReadMode = 0; } } LOADROP(rop); TRACE_EXIT("Permedia2SetupForScanlineCPUToScreenColorExpandFill"); }
static void XPSetupForFillRectSolid(ScrnInfoPtr pScrn, int color, int rop, unsigned int planemask) { TRIDENTPtr pTrident = TRIDENTPTR(pScrn); REPLICATE(color); TGUI_FMIX(XAAPatternROP[rop]); MMIO_OUT32(pTrident->IOBase, 0x2158, color); TGUI_DRAWFLAG(SOLIDFILL); }
static void TridentSetupForMono8x8PatternFill(ScrnInfoPtr pScrn, int patternx, int patterny, int fg, int bg, int rop, unsigned int planemask) { TRIDENTPtr pTrident = TRIDENTPTR(pScrn); int drawflag = 0; REPLICATE(fg); if (pTrident->Chipset == PROVIDIA9685 || pTrident->Chipset == CYBER9388) TGUI_FPATCOL(fg); else TGUI_FCOLOUR(fg); if (bg == -1) { drawflag |= 1<<12; if (pTrident->Chipset == PROVIDIA9685 || pTrident->Chipset == CYBER9388) TGUI_BPATCOL(~fg); else TGUI_BCOLOUR(~fg); } else { REPLICATE(bg); if (pTrident->Chipset == PROVIDIA9685 || pTrident->Chipset == CYBER9388) TGUI_BPATCOL(bg); else TGUI_BCOLOUR(bg); } if (pTrident->Chipset == PROVIDIA9685 || pTrident->Chipset == CYBER9388) { drawflag |= 7<<18; } TGUI_DRAWFLAG(pTrident->DrawFlag | PAT2SCR | PATMONO | drawflag); TGUI_PATLOC(((patterny * pTrident->PatternLocation) + (patternx * pScrn->bitsPerPixel / 8)) >> 6); TGUI_FMIX(XAAGetPatternROP(rop)); }
static void XP4SetupForFillRectSolid(ScrnInfoPtr pScrn, int color, int rop, unsigned int planemask) { TRIDENTPtr pTrident = TRIDENTPTR(pScrn); ropcode = rop; REPLICATE(color); MMIO_OUT32(pTrident->IOBase, 0x2158, color); MMIO_OUT32(pTrident->IOBase, 0x2128, 1<<14); }
static void TridentSetupForScanlineCPUToScreenColorExpandFill( ScrnInfoPtr pScrn, int fg, int bg, int rop, unsigned int planemask ){ TRIDENTPtr pTrident = TRIDENTPTR(pScrn); int drawflag = SRCMONO; REPLICATE(fg); TGUI_FCOLOUR(fg); if (bg == -1) { drawflag |= 1<<12; TGUI_BCOLOUR(~fg); } else { REPLICATE(bg); TGUI_BCOLOUR(bg); } TGUI_SRC_XY(0,0); TGUI_DRAWFLAG(drawflag); TGUI_FMIX(XAAGetCopyROP(rop)); }
static void XPSetupForSolidLine(ScrnInfoPtr pScrn, int color, int rop, unsigned int planemask) { TRIDENTPtr pTrident = TRIDENTPTR(pScrn); pTrident->BltScanDirection = 0; REPLICATE(color); TGUI_FMIX(XAAPatternROP[rop]); if (pTrident->Chipset >= PROVIDIA9685) { TGUI_FPATCOL(color); } else { TGUI_FCOLOUR(color); } }
static void TridentSetupForFillRectSolid(ScrnInfoPtr pScrn, int color, int rop, unsigned int planemask) { TRIDENTPtr pTrident = TRIDENTPTR(pScrn); int drawflag = 0; REPLICATE(color); TGUI_FMIX(XAAGetPatternROP(rop)); if (pTrident->Chipset == PROVIDIA9685 || pTrident->Chipset == CYBER9388) { TGUI_FPATCOL(color); } else { drawflag |= PATMONO; TGUI_FCOLOUR(color); } TGUI_DRAWFLAG(pTrident->DrawFlag | SOLIDFILL | drawflag); }
static void XPSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir, int rop, unsigned int planemask, int transparency_color) { TRIDENTPtr pTrident = TRIDENTPTR(pScrn); int dst = 0; pTrident->BltScanDirection = 0; if (xdir < 0) pTrident->BltScanDirection |= XNEG; if (ydir < 0) pTrident->BltScanDirection |= YNEG; REPLICATE(transparency_color); if (transparency_color != -1) { dst |= 3<<16; MMIO_OUT32(pTrident->IOBase, 0x2134, transparency_color); } TGUI_DRAWFLAG(pTrident->BltScanDirection | SCR2SCR | dst); TGUI_FMIX(XAACopyROP[rop]); }
void PermediaSetupForFillRectSolid(int color, int rop, unsigned planemask) { REPLICATE(color); gcolor = color; grop = rop; GLINT_WAIT(7); DO_PLANEMASK(planemask); GLINT_WRITE_REG(0, RasterizerMode); if (rop == GXcopy) { mode = pprod; GLINT_WRITE_REG(pprod, FBReadMode); GLINT_WRITE_REG(UNIT_DISABLE, ColorDDAMode); GLINT_WRITE_REG(color, FBBlockColor); } else { mode = pprod|FBRM_DstEnable; GLINT_WRITE_REG(UNIT_ENABLE, ColorDDAMode); GLINT_WRITE_REG(color, ConstantColor); } GLINT_WRITE_REG(rop<<1|UNIT_ENABLE, LogicalOpMode); GLINT_WRITE_REG(1<<16, dY); }
static void XP4SetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir, int rop, unsigned int planemask, int transparency_color) { TRIDENTPtr pTrident = TRIDENTPTR(pScrn); int dst = 0; pTrident->BltScanDirection = 0; if (xdir < 0) pTrident->BltScanDirection |= XNEG; if (ydir < 0) pTrident->BltScanDirection |= YNEG; REPLICATE(transparency_color); if (transparency_color != -1) { dst |= 3<<16; MMIO_OUT32(pTrident->IOBase, 0x2134, transparency_color); } ropcode = rop; MMIO_OUT32(pTrident->IOBase, 0x2128, pTrident->BltScanDirection | SCR2SCR); }
static void RAGE128SetupForScreenToScreenCopy(int xdir, int ydir, int rop, unsigned int planemask, int transparency_color) { int direction = 0; blitxdir = xdir; blitydir = ydir; if (xdir >= 0) direction |= 1; if (ydir >= 0) direction |= 2; outl(IOBase, 0x146C); outl(IOBase + 4, 3<<28 | 15<<4 | BPP<<8 | ROP[rop]<<16 | 3<<12 | 2<<24); REPLICATE(planemask); outl(IOBase, 0x16CC); outl(IOBase + 4, planemask); outl(IOBase, 0x16C0); outl(IOBase + 4, direction); outl(IOBase, 0x15C0); outl(IOBase + 4, 0); }
static void Permedia2SetupForFillRectSolid(ScrnInfoPtr pScrn, int color, int rop, unsigned int planemask) { GLINTPtr pGlint = GLINTPTR(pScrn); TRACE_ENTER("Permedia2SetupForFillRectSolid"); REPLICATE(color); GLINT_WAIT(6); DO_PLANEMASK(planemask); if (rop == GXcopy) { GLINT_WRITE_REG(UNIT_DISABLE, ColorDDAMode); GLINT_WRITE_REG(pGlint->pprod, FBReadMode); GLINT_WRITE_REG(color, FBBlockColor); } else { GLINT_WRITE_REG(UNIT_ENABLE, ColorDDAMode); GLINT_WRITE_REG(color, ConstantColor); /* We can use Packed mode for filling solid non-GXcopy rasters */ GLINT_WRITE_REG(pGlint->pprod|FBRM_DstEnable|FBRM_Packed, FBReadMode); } LOADROP(rop); TRACE_EXIT("Permedia2SetupForFillRectSolid"); }
static void Permedia3WriteBitmap(ScrnInfoPtr pScrn, int x, int y, int w, int h, unsigned char *src, int srcwidth, int skipleft, int fg, int bg, int rop, unsigned int planemask ) { int dwords; GLINTPtr pGlint = GLINTPTR(pScrn); int count; CARD32 *srcp; TRACE_ENTER("Permedia3WriteBitmap"); w += skipleft; x -= skipleft; dwords = (w + 31) >>5; REPLICATE(fg); pGlint->PM3_Render2D = PM3Render2D_SpanOperation | PM3Render2D_XPositive | PM3Render2D_YPositive | PM3Render2D_Operation_SyncOnBitMask; pGlint->PM3_Config2D = PM3Config2D_UserScissorEnable | PM3Config2D_UseConstantSource | PM3Config2D_ForegroundROPEnable | PM3Config2D_ForegroundROP(rop) | PM3Config2D_FBWriteEnable; if ((rop!=GXclear)&&(rop!=GXset)&&(rop!=GXcopy)&&(rop!=GXcopyInverted)) pGlint->PM3_Config2D |= PM3Config2D_FBDestReadEnable; if (bg != -1) { REPLICATE(bg); pGlint->PM3_Config2D |= PM3Config2D_OpaqueSpan; GLINT_WAIT(8); GLINT_WRITE_REG(bg, BackgroundColor); } else GLINT_WAIT(7); GLINT_WRITE_REG(fg, PM3ForegroundColor); PM3_PLANEMASK(planemask); GLINT_WRITE_REG(pGlint->PM3_Config2D, PM3Config2D); GLINT_WRITE_REG(((y&0x0fff)<<16)|((x+skipleft)&0x0fff), ScissorMinXY); GLINT_WRITE_REG((((y+h)&0x0fff)<<16)|((x+w)&0x0fff), ScissorMaxXY); GLINT_WRITE_REG( PM3RectanglePosition_XOffset(x) | PM3RectanglePosition_YOffset(y), PM3RectanglePosition); GLINT_WRITE_REG(pGlint->PM3_Render2D | PM3Render2D_Width(w) | PM3Render2D_Height(h), PM3Render2D); while(h--) { count = dwords; srcp = (CARD32*)src; while(count >= pGlint->FIFOSize) { GLINT_WAIT(pGlint->FIFOSize); GLINT_WRITE_REG(((pGlint->FIFOSize - 2) << 16) | 0x0D, OutputFIFO); GLINT_MoveDWORDS( (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), (CARD32*)srcp, pGlint->FIFOSize - 1); count -= pGlint->FIFOSize - 1; srcp += pGlint->FIFOSize - 1; } if(count) { GLINT_WAIT(count + 1); GLINT_WRITE_REG(((count - 1) << 16) | 0x0D, OutputFIFO); GLINT_MoveDWORDS( (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), (CARD32*)srcp, count); } src += srcwidth; } Permedia3DisableClipping(pScrn); Permedia3Sync(pScrn); }
static void Permedia2WriteBitmap(ScrnInfoPtr pScrn, int x, int y, int w, int h, unsigned char *src, int srcwidth, int skipleft, int fg, int bg, int rop, unsigned int planemask ) { XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); GLINTPtr pGlint = GLINTPTR(pScrn); unsigned char *srcpntr; int dwords, height, mode; Bool SecondPass = FALSE; TRACE_ENTER("Permedia2WriteBitmap"); w += skipleft; x -= skipleft; dwords = (w + 31) >> 5; Permedia2SetClippingRectangle(pScrn,x+skipleft,y,x+w,y+h); if (pScrn->bitsPerPixel == 24) { GLINT_WAIT(10); } else { GLINT_WAIT(11); DO_PLANEMASK(planemask); } LOADROP(rop); Permedia2LoadCoord(pScrn, x&0xFFFF, y, w, h); if (rop == GXcopy) { GLINT_WRITE_REG(pGlint->pprod, FBReadMode); } else { GLINT_WRITE_REG(pGlint->pprod | FBRM_DstEnable, FBReadMode); } if ((pScrn->bitsPerPixel != 24) && (rop == GXcopy)) { mode = FastFillEnable; GLINT_WRITE_REG(UNIT_DISABLE, ColorDDAMode); GLINT_WRITE_REG(pGlint->RasterizerSwap,RasterizerMode); } else { mode = 0; GLINT_WRITE_REG(UNIT_ENABLE, ColorDDAMode); GLINT_WRITE_REG(BitMaskPackingEachScanline| pGlint->RasterizerSwap,RasterizerMode); } if(bg == -1) { REPLICATE(fg); if ((pScrn->bitsPerPixel != 24) && (rop == GXcopy)) { GLINT_WRITE_REG(fg, FBBlockColor); } else { GLINT_WRITE_REG(fg, ConstantColor); } } else if((rop == GXcopy) && (pScrn->bitsPerPixel != 24)) { REPLICATE(bg); GLINT_WRITE_REG(bg, FBBlockColor); GLINT_WRITE_REG(PrimitiveRectangle | XPositive |YPositive |mode,Render); REPLICATE(fg); GLINT_WRITE_REG(fg, FBBlockColor); } else { SecondPass = TRUE; REPLICATE(fg); if ((pScrn->bitsPerPixel != 24) && (rop == GXcopy)) { GLINT_WRITE_REG(fg, FBBlockColor); } else { GLINT_WRITE_REG(fg, ConstantColor); } } SECOND_PASS: GLINT_WRITE_REG(PrimitiveRectangle | XPositive | YPositive | mode | SyncOnBitMask, Render); height = h; srcpntr = src; while(height--) { GLINT_WAIT(dwords + 1); /* 0x0D is the TAG value for BitMaskPattern */ GLINT_WRITE_REG(((dwords - 1) << 16) | 0x0D, OutputFIFO); GLINT_MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), (CARD32 *)srcpntr, dwords); srcpntr += srcwidth; } if(SecondPass) { SecondPass = FALSE; REPLICATE(bg); GLINT_WAIT(3); if ((pScrn->bitsPerPixel != 24) && (rop == GXcopy)) { GLINT_WRITE_REG(InvertBitMask|pGlint->RasterizerSwap,RasterizerMode); GLINT_WRITE_REG(bg, FBBlockColor); } else { GLINT_WRITE_REG(InvertBitMask|BitMaskPackingEachScanline| pGlint->RasterizerSwap, RasterizerMode); GLINT_WRITE_REG(bg, ConstantColor); } goto SECOND_PASS; } GLINT_WAIT(1); GLINT_WRITE_REG(pGlint->RasterizerSwap, RasterizerMode); Permedia2DisableClipping(pScrn); SET_SYNC_FLAG(infoRec); TRACE_EXIT("Permedia2WriteBitmap"); }
/*! \param Func */ xbShort xbExpn::ProcessFunction( char * Func ) { /* 1 - pop function from stack 2 - verify function name and get no of parms needed 3 - verify no of parms >= remainder of stack 4 - pop parms off stack 5 - execute function 6 - push result back on stack */ char *buf = 0; xbExpNode *p1, *p2, *p3, *WorkNode, *FuncNode; xbShort ParmsNeeded,len; char ptype = 0; /* process type s=string, l=logical, d=double */ xbDouble DoubResult = 0; xbLong IntResult = 0; FuncNode = (xbExpNode *) Pop(); ParmsNeeded = GetFuncInfo( Func, 1 ); if( ParmsNeeded == -1 ) { return XB_INVALID_FUNCTION; } else { ParmsNeeded = 0; if( FuncNode->Sibling1 ) ParmsNeeded++; if( FuncNode->Sibling2 ) ParmsNeeded++; if( FuncNode->Sibling3 ) ParmsNeeded++; } if( ParmsNeeded > GetStackDepth()) return XB_INSUFFICIENT_PARMS; p1 = p2 = p3 = NULL; if( ParmsNeeded > 2 ) p3 = (xbExpNode *) Pop(); if( ParmsNeeded > 1 ) p2 = (xbExpNode *) Pop(); if( ParmsNeeded > 0 ) p1 = (xbExpNode *) Pop(); memset( WorkBuf, 0x00, WorkBufMaxLen+1); if( strncmp( Func, "ABS", 3 ) == 0 ) { ptype = 'd'; DoubResult = ABS( GetDoub( p1 )); } else if( strncmp( Func, "ASC", 3 ) == 0 ) { ptype = 'd'; DoubResult = ASC( p1->StringResult ); } else if( strncmp( Func, "AT", 2 ) == 0 ) { ptype = 'd'; DoubResult = AT( p1->StringResult, p2->StringResult ); } else if( strncmp( Func, "CDOW", 4 ) == 0 ) { ptype = 's'; buf = CDOW( p1->StringResult ); } else if( strncmp( Func, "CHR", 3 ) == 0 ) { ptype = 's'; buf = CHR( GetInt( p1 )); } else if( strncmp( Func, "CMONTH", 6 ) == 0 ) { ptype = 's'; buf = CMONTH( p1->StringResult ); } else if( strncmp( Func, "CTOD", 4 ) == 0 ) { ptype = 's'; buf = CTOD( p1->StringResult ); } else if( strncmp( Func, "DATE", 4 ) == 0 ) { ptype = 's'; buf = DATE(); } else if( strncmp( Func, "DAY", 3 ) == 0 ) { ptype = 'd'; DoubResult = DAY( p1->StringResult ); } else if( strncmp( Func, "DESCEND", 7 ) == 0 && p1->ExpressionType == 'C' ) { ptype = 's'; buf = DESCEND( p1->StringResult.c_str() ); } else if( strncmp( Func, "DESCEND", 7 ) == 0 && p1->ExpressionType == 'N' ) { ptype = 'd'; DoubResult = DESCEND( GetDoub( p1 )); } else if( strncmp( Func, "DESCEND", 7 ) == 0 && p1->ExpressionType == 'D' ) { xbDate d( p1->StringResult ); ptype = 'd'; DoubResult = DESCEND( d ); } else if( strncmp( Func, "DOW", 3 ) == 0 ) { ptype = 'd'; DoubResult = DOW( p1->StringResult ); } else if( strncmp( Func, "DTOC", 4 ) == 0 ) { ptype = 's'; buf = DTOC( p1->StringResult ); } else if( strncmp( Func, "DTOS", 4 ) == 0 ) { ptype = 's'; buf = DTOS( p1->StringResult ); } else if( strncmp( Func, "EXP", 3 ) == 0 ) { ptype = 'd'; DoubResult = EXP( GetDoub( p1 )); } else if( strncmp( Func, "IIF", 3 ) == 0 ){ ptype = 's'; buf = IIF( p1->IntResult, p2->StringResult, p3->StringResult ); } else if( strncmp( Func, "INT", 3 ) == 0 ) { ptype = 'd'; DoubResult = INT( GetDoub( p1 )); } else if( strncmp( Func, "ISALPHA", 7 ) == 0 ) { ptype = 'l'; IntResult = ISALPHA( p1->StringResult ); } else if( strncmp( Func, "ISLOWER", 7 ) == 0 ) { ptype = 'l'; IntResult = ISLOWER( p1->StringResult ); } else if( strncmp( Func, "ISUPPER", 7 ) == 0 ) { ptype = 'l'; IntResult = ISUPPER( p1->StringResult ); } else if( strncmp( Func, "LEN", 3 ) == 0 ) { ptype = 'd'; DoubResult = LEN( p1->StringResult ); } else if( strncmp( Func, "LEFT", 4 ) == 0 ) { ptype = 's'; buf = LEFT( p1->StringResult, INT( p2->DoubResult )); } else if( strncmp( Func, "LTRIM", 5 ) == 0 ) { ptype = 's'; buf = LTRIM( p1->StringResult ); } else if( strncmp( Func, "LOG", 3 ) == 0 ) { ptype = 'd'; DoubResult = LOG( GetDoub( p1 )); } else if( strncmp( Func, "LOWER", 5 ) == 0 ) { ptype = 's'; buf = LOWER( p1->StringResult ); } else if( strncmp( Func, "MAX", 3 ) == 0 ) { ptype = 'd'; DoubResult = MAX( GetDoub( p1 ), GetDoub( p2 )); } else if( strncmp( Func, "MIN", 3 ) == 0 ) { ptype = 'd'; DoubResult = MIN( GetDoub( p1 ), GetDoub( p2 )); } else if( strncmp( Func, "MONTH", 5 ) == 0 ) { ptype = 'd'; DoubResult = MONTH( p1->StringResult ); } else if( strncmp( Func, "RECNO", 5 ) == 0 ) { ptype = 'd'; DoubResult = RECNO( FuncNode->dbf ); } else if( strncmp( Func, "REPLICATE", 9 ) == 0 ) { ptype = 's'; buf = REPLICATE( p1->StringResult, GetInt( p2 )); } else if( strncmp( Func, "RIGHT", 5 ) == 0 ) { ptype = 's'; buf = RIGHT( p1->StringResult, GetInt( p2 )); } else if( strncmp( Func, "RTRIM", 5 ) == 0 ) { ptype = 's'; buf = RTRIM( p1->StringResult ); } else if( strncmp( Func, "SPACE", 5 ) == 0 ) { ptype = 's'; buf = SPACE( INT( GetDoub( p1 ))); } else if( strncmp( Func, "SQRT", 4 ) == 0 ) { ptype = 'd'; DoubResult = SQRT( GetDoub( p1 )); } else if( strncmp( Func, "STRZERO", 7 ) == 0 && ParmsNeeded == 1 ) { ptype = 's'; buf = STRZERO( p1->StringResult ); } else if( strncmp( Func, "STRZERO", 7 ) == 0 && ParmsNeeded == 2 ) { ptype = 's'; buf = STRZERO( p1->StringResult, GetInt( p2 )); } else if( strncmp( Func, "STRZERO", 7 ) == 0 && ParmsNeeded == 3 ) { ptype = 's'; buf = STRZERO( p1->StringResult, GetInt( p2 ), GetInt( p3 )); } else if( strncmp( Func, "STR", 3 ) == 0 && p3 ) { ptype = 's'; if(p1->ExpressionType == 'N') buf = STR( p1->DoubResult, GetInt( p2 ), GetInt( p3 )); else buf = STR( p1->StringResult, GetInt( p2 ), GetInt( p3 )); } else if( strncmp( Func, "STR", 3 ) == 0 && p2 ) { ptype = 's'; buf = STR( p1->StringResult, GetInt( p2 )); } else if( strncmp( Func, "STR", 3 ) == 0 && p1 ) { ptype = 's'; buf = STR( p1->StringResult ); } else if( strncmp( Func, "SUBSTR", 6 ) == 0 ) { ptype = 's'; buf = SUBSTR( p1->StringResult, GetInt( p2 ), GetInt( p3 )); } else if( strncmp( Func, "TRIM", 4 ) == 0 ) { ptype = 's'; buf = TRIM( p1->StringResult ); } else if( strncmp( Func, "UPPER", 5 ) == 0 ) { ptype = 's'; buf = UPPER( p1->StringResult ); } else if( strncmp( Func, "VAL", 3 ) == 0 ) { ptype = 'd'; DoubResult = VAL( p1->StringResult ); } else if( strncmp( Func, "YEAR", 4 ) == 0 ) { ptype = 'd'; DoubResult = YEAR( p1->StringResult ); } if( p1 && !p1->InTree ) delete p1; if( p2 && !p2->InTree ) delete p2; if( p3 && !p3->InTree ) delete p3; if( !FuncNode->InTree ) delete FuncNode; if( buf ){ len = strlen( buf ); WorkNode = new xbExpNode; if( !WorkNode ) return XB_NO_MEMORY; WorkNode->ResultLen = len + 1; } else { len = 0; WorkNode = new xbExpNode; if( !WorkNode ) return XB_NO_MEMORY; WorkNode->ResultLen = 0; } switch( ptype ){ case 's': /* string or char result */ WorkNode->DataLen = len; WorkNode->ExpressionType = 'C'; WorkNode->Type = 's'; WorkNode->StringResult = buf; break; case 'd': /* numeric result */ WorkNode->DataLen = 0; WorkNode->ExpressionType = 'N'; WorkNode->Type = 'd'; WorkNode->DoubResult = DoubResult; break; case 'l': /* logical result */ WorkNode->DataLen = 0; WorkNode->ExpressionType = 'L'; WorkNode->Type = 'l'; WorkNode->IntResult = IntResult; break; default: std::cout << "\nInternal error. " << ptype; break; } Push(WorkNode); return XB_NO_ERROR; }