2 #include "../port/lib.h"
7 #include "../port/error.h"
15 typedef struct Cursor3dfx Cursor3dfx;
32 tdfxenable(VGAscr* scr)
39 if(p = pcimatch(nil, 0x121A, 0)){
41 case 0x0003: /* Banshee */
42 case 0x0005: /* Avenger (a.k.a. Voodoo3) */
51 scr->mmio = vmap(p->mem[0].bar&~0x0F, p->mem[0].size);
56 addvgaseg("3dfxmmio", p->mem[0].bar&~0x0F, p->mem[0].size);
59 addvgaseg("3dfxscreen", scr->paddr, scr->apsize);
62 * Find a place for the cursor data in display memory.
63 * If SDRAM then there's 16MB memory else it's SGRAM
64 * and can count it based on the power-on straps -
65 * chip size can be 8Mb or 16Mb, and there can be 4 or
67 * Use the last 1KB of the framebuffer.
69 mmio = (void*)((uchar*)scr->mmio+dramInit0);
70 if(*(mmio+1) & 0x40000000)
73 if(*mmio & 0x08000000)
77 if(*mmio & 0x04000000)
82 scr->storage = i - 1024;
86 tdfxcurdisable(VGAscr* scr)
88 Cursor3dfx *cursor3dfx;
92 cursor3dfx = (void*)((uchar*)scr->mmio+hwCur);
93 cursor3dfx->vidProcCfg &= ~0x08000000;
97 tdfxcurload(VGAscr* scr, Cursor* curs)
101 Cursor3dfx *cursor3dfx;
105 cursor3dfx = (void*)((uchar*)scr->mmio+hwCur);
108 * Disable the cursor then load the new image in
109 * the top-left of the 64x64 array.
110 * The cursor data is stored in memory as 128-bit
111 * words consisting of plane 0 in the least significant 64-bits
112 * and plane 1 in the most significant.
113 * The X11 cursor truth table is:
119 * Unused portions of the image have been initialised to be
122 cursor3dfx->vidProcCfg &= ~0x08000000;
123 p = (uchar*)scr->vaddr + scr->storage;
124 for(y = 0; y < 16; y++){
125 *p++ = curs->clr[2*y]|curs->set[2*y];
126 *p++ = curs->clr[2*y+1]|curs->set[2*y+1];
128 *p++ = curs->set[2*y];
129 *p++ = curs->set[2*y+1];
134 * Save the cursor hotpoint and enable the cursor.
135 * The 0,0 cursor point is bottom-right.
137 scr->offset.x = 63+curs->offset.x;
138 scr->offset.y = 63+curs->offset.y;
139 cursor3dfx->vidProcCfg |= 0x08000000;
143 tdfxcurmove(VGAscr* scr, Point p)
145 Cursor3dfx *cursor3dfx;
149 cursor3dfx = (void*)((uchar*)scr->mmio+hwCur);
151 cursor3dfx->hwCurLoc = ((p.y+scr->offset.y)<<16)|(p.x+scr->offset.x);
157 tdfxcurenable(VGAscr* scr)
159 Cursor3dfx *cursor3dfx;
164 cursor3dfx = (void*)((uchar*)scr->mmio+hwCur);
169 cursor3dfx->hwCurC0 = 0xFFFFFFFF;
170 cursor3dfx->hwCurC1 = 0x00000000;
173 * Initialise the 64x64 cursor to be transparent (X11 mode).
175 cursor3dfx->hwCurPatAddr = scr->storage;
176 memset((uchar*)scr->vaddr + scr->storage, 0, 64*16);
179 * Load, locate and enable the 64x64 cursor in X11 mode.
181 tdfxcurload(scr, &arrow);
182 tdfxcurmove(scr, ZP);
183 cursor3dfx->vidProcCfg |= 0x08000002;
186 VGAdev vga3dfxdev = {
195 VGAcur vga3dfxcur = {