lg_xaa.h revision 63847c39
1#ifndef __LG_XAA_H 2#define __LG_XAA_H 3 4/* 5 * XAA acceleration for CL-GD546x -- The Laugna family 6 * 7 * lg_xaa.h 8 * 9 * (c) 1996,1998 Corin Anderson. 10 * corina@the4cs.com 11 * Tukwila, WA 12 * 13 * This header file draws much from the file cir_blitLG.h in version 3.3.3 14 * of XFree86. 15 */ 16 17/* This header file defines the necessary structures, contstants, and 18 variables for using the bitBLT engine on a Laguna family graphics 19 accelerator. */ 20 21 22enum { /* Offsets into MMIO space for bitBLT regs */ 23 STATUS = 0x0400, 24 OP0_opRDRAM = 0x0520, 25 OP1_opRDRAM = 0x0540, 26 OP2_opRDRAM = 0x0560, 27 OP0_opMRDRAM = 0x0524, 28 OP1_opMRDRAM = 0x0544, 29 OP2_opMRDRAM = 0x0564, 30 OP0_opSRAM = 0x0528, 31 OP1_opSRAM = 0x0548, 32 OP2_opSRAM = 0x0568, 33 OP1_opMSRAM = 0x054A, 34 OP2_opMSRAM = 0x056A, 35 DRAWDEF = 0x0584, 36 BLTDEF = 0x0586, 37 BLTEXT_EX = 0x0700, 38 MBLTEXT_EX = 0x0720, 39 MONOQW = 0x0588, 40 QFREE = 0x0404, 41 PATOFF = 0x052A, 42 HOSTDATA = 0x0800, 43 OP_opBGCOLOR = 0x05E4, 44 OP_opFGCOLOR = 0x05E0, 45 bltCONTROL = 0x0402, 46 BITMASK = 0x05E8 47}; 48 49enum { HOSTDATASIZE = 2048 }; /* The HOSTDATA port is 2048 BYTES */ 50 51enum { /* OR these together to form a bitBLT mode */ 52 HOST2SCR = 0x1120, /* CPU/Screen transfer modes */ 53 SCR2HOST = 0x2010, 54 HOST2PAT = 0x1102, 55 HOST2SRAM2 = 0x6020, /* CPU to SRAM2 transfer */ 56 57 SCR2SCR = 0x1110, /* Screen/Screen transfers */ 58 COLORSRC = 0x0000, /* Source is color data */ 59 MONOSRC = 0x0040, /* Source is mono data (color expansion) */ 60 COLORTRANS = 0x0001, /* Transparent screen/screen transfer */ 61 MONOTRANS = 0x0005, /* Transparent screen/screen color expansion */ 62 COLORFILL = 0x0070, /* Solid color fill mode */ 63 SRAM1SCR2SCR = 0x1180, /* Pattern fill, source from SRAM1 */ 64 65 PAT2SCR = 0x1109, /* Pattern/Screen transfers */ 66 COLORPAT = 0x0000, /* Pattern is color data */ 67 MONOPAT = 0x0004, /* Pattern is mono data (color expansion) */ 68 SRAM2PAT2SCR = 0x1108, /* SRAM2 is pattern source */ 69 70 PATeqSRC = 0x0800, /* The Pattern and Source operands are the same */ 71 /* Advice from Corey: don't ever try to use 72 this option! 8) There's a documented bug 73 with it on the '62, and, well, I have 74 empirical evidence that either the bug's 75 still around, even in the '64 and the '65. 76 It's a performance option, anyway, so not 77 using it should be okay. */ 78 79 80 BLITUP = 0x8000 /* The blit is proceeding from bottom to top */ 81}; 82 83enum { /* Select transparency compare */ 84 TRANSBG = 0x0100, 85 TRANSFG = 0x0300, 86 TRANSEQ = 0x0100, 87 TRANSNE = 0x0300, 88 TRANSNONE = 0x0000 89}; 90 91#define LgREADY() ((memrb(STATUS) & 0x07) == 0x00) 92 93#define LgSETROP(rop) memww(DRAWDEF,rop); 94 95#define LgSETTRANSPARENCY(trans) \ 96 memww(DRAWDEF,(trans) | (memrw(DRAWDEF) & 0x00FF)); 97 98#define LgSETMODE(mode) memww(BLTDEF,mode); 99 100#define LgSETDSTXY(X, Y) memwl(OP0_opRDRAM, (((Y) << 16) | (X))); 101 102#define LgSETSRCXY(X, Y) memwl(OP1_opRDRAM, (((Y) << 16) | (X))); 103 104#define LgSETPATXY(X, Y) memwl(OP2_opRDRAM, (((Y) << 16) | (X))); 105 106#define LgSETTRANSMASK(X, Y) LgSETPATXY(X, Y) 107 108#define LgSETSRAMDST(offset) memww(OP0_opSRAM, offset); 109 110/* was this a bug? it read OP2_opSRAM */ 111#define LgSETSRAM1OFFSET(offset) memww(OP1_opSRAM, offset); 112 113#define LgSETSRAM2OFFSET(offset) memww(OP2_opSRAM, offset); 114 115#define LgSETMSRAM1OFFSET(offset) memww(OP1_opMSRAM, offset); 116 117#define LgSETMSRAM2OFFSET(offset) memww(OP2_opMSRAM, offset); 118 119#define LgSETMDSTXY(X, Y) memwl(OP0_opMRDRAM, (((Y) << 16) | (X))); 120 121#define LgSETMSRCXY(X, Y) memwl(OP1_opMRDRAM, (((Y) << 16) | (X))); 122 123#define LgSETMPATXY(X, Y) memwl(OP2_opMRDRAM, (((Y) << 16) | (X))); 124 125#define LgSETMTRANSMASK(X, Y) LgSETMPATXY(X, Y) 126 127#define LgSETPHASE0(phase) memwl( OP0_opRDRAM, phase); 128 129#define LgSETPHASE1(phase) memwl(OP1_opRDRAM, phase); 130 131#define LgSETPHASE2(phase) memwl( OP2_opRDRAM, phase); 132 133#define LgSETMPHASE0(phase) memwl(OP0_opMRDRAM, phase); 134 135#define LgSETMPHASE1(phase) memwl(OP1_opMRDRAM, phase); 136 137#define LgSETEXTENTS(width, height) \ 138 memwl(BLTEXT_EX, (((height) << 16)|(width))); 139 140#if 0 141#define LgSETMEXTENTS(width, height) \ 142 memwl(MBLTEXT_EX, (((height) << 16)|(width))); 143#else 144/* For monochrome (byte) blits, we need to set how many QWORDs of data 145 encompass the X extent. Write this piece of data into MONOQW. */ 146#define LgSETMEXTENTS(width, height) \ 147 { \ 148 memww(MONOQW, ((width + 7) >> 3)); \ 149 memwl(MBLTEXT_EX, (((height) << 16)|(width))); \ 150 } 151 152#define LgSETMEXTENTSNOMONOQW(width, height) \ 153 memwl(MBLTEXT_EX, (((height) << 16)|(width))); 154 155/* 156 memww(MBLTEXT_EX, height); 157 memww(MBLTEXT_EX + 2, width); 158 */ 159#endif 160 161#define LgHOSTDATAWRITE(data) memwl(HOSTDATA, data); 162 163#define LgHOSTDATAREAD() (memrl(HOSTDATA)) 164 165#define LgSETBACKGROUND(color) memwl(OP_opBGCOLOR, color); 166 167#define LgSETFOREGROUND(color) memwl(OP_opFGCOLOR, color); 168 169#define LgSETPATOFF(xoff, yoff) memww(PATOFF, (((yoff) << 8) | (xoff))); 170 171#define LgSETSWIZZLE() memww(bltCONTROL, memrw(bltCONTROL | 0x0400)); 172 173#define LgCLEARSWIZZLE() memww(bltCONTROL, memrw(bltCONTROL & ~0x0400)); 174 175#define LgSETBITMASK(m) memwl(BITMASK, m); 176 177 178 179#endif /* __LG_XAA_H */ 180