apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 1 | /* |
| 2 | * XGI 300/630/730/540/315/550/650/740 frame buffer driver |
| 3 | * for Linux kernels 2.4.x and 2.5.x |
| 4 | * |
| 5 | * 2D acceleration part |
| 6 | * |
| 7 | * Based on the X driver's XGI300_accel.h which is |
| 8 | * Copyright Xavier Ducoin <x.ducoin@lectra.com> |
| 9 | * Copyright 2002 by Thomas Winischhofer, Vienna, Austria |
| 10 | * and XGI310_accel.h which is |
| 11 | * Copyright 2002 by Thomas Winischhofer, Vienna, Austria |
| 12 | * |
| 13 | * Author: Thomas Winischhofer <thomas@winischhofer.net>: |
| 14 | * (see http://www.winischhofer.net/ |
| 15 | * for more information and updates) |
| 16 | */ |
| 17 | |
| 18 | #ifndef _XGIFB_ACCEL_H |
| 19 | #define _XGIFB_ACCEL_H |
| 20 | |
| 21 | /* Guard accelerator accesses with spin_lock_irqsave? Works well without. */ |
| 22 | #undef XGIFB_USE_SPINLOCKS |
| 23 | |
| 24 | #ifdef XGIFB_USE_SPINLOCKS |
| 25 | #include <linux/spinlock.h> |
| 26 | #define CRITBEGIN spin_lock_irqsave(&xgi_video_info.lockaccel), critflags); |
| 27 | #define CRITEND spin_unlock_irqrestore(&xgi_video_info.lockaccel), critflags); |
| 28 | #define CRITFLAGS unsigned long critflags; |
| 29 | #else |
| 30 | #define CRITBEGIN |
| 31 | #define CRITEND |
| 32 | #define CRITFLAGS |
| 33 | #endif |
| 34 | |
| 35 | /* Definitions for the XGI engine communication. */ |
| 36 | |
| 37 | #define PATREGSIZE 384 /* Pattern register size. 384 bytes @ 0x8300 */ |
| 38 | #define BR(x) (0x8200 | (x) << 2) |
| 39 | #define PBR(x) (0x8300 | (x) << 2) |
| 40 | |
| 41 | /* XGI300 engine commands */ |
| 42 | #define BITBLT 0x00000000 /* Blit */ |
| 43 | #define COLOREXP 0x00000001 /* Color expand */ |
| 44 | #define ENCOLOREXP 0x00000002 /* Enhanced color expand */ |
| 45 | #define MULTIPLE_SCANLINE 0x00000003 /* ? */ |
| 46 | #define LINE 0x00000004 /* Draw line */ |
| 47 | #define TRAPAZOID_FILL 0x00000005 /* Fill trapezoid */ |
| 48 | #define TRANSPARENT_BITBLT 0x00000006 /* Transparent Blit */ |
| 49 | |
| 50 | /* Additional engine commands for 310/325 */ |
| 51 | #define ALPHA_BLEND 0x00000007 /* Alpha blend ? */ |
| 52 | #define A3D_FUNCTION 0x00000008 /* 3D command ? */ |
| 53 | #define CLEAR_Z_BUFFER 0x00000009 /* ? */ |
| 54 | #define GRADIENT_FILL 0x0000000A /* Gradient fill */ |
| 55 | #define STRETCH_BITBLT 0x0000000B /* Stretched Blit */ |
| 56 | |
| 57 | /* source select */ |
| 58 | #define SRCVIDEO 0x00000000 /* source is video RAM */ |
| 59 | #define SRCSYSTEM 0x00000010 /* source is system memory */ |
| 60 | #define SRCCPUBLITBUF SRCSYSTEM /* source is CPU-driven BitBuffer (for color expand) */ |
| 61 | #define SRCAGP 0x00000020 /* source is AGP memory (?) */ |
| 62 | |
| 63 | /* Pattern flags */ |
| 64 | #define PATFG 0x00000000 /* foreground color */ |
| 65 | #define PATPATREG 0x00000040 /* pattern in pattern buffer (0x8300) */ |
| 66 | #define PATMONO 0x00000080 /* mono pattern */ |
| 67 | |
| 68 | /* blitting direction (300 series only) */ |
| 69 | #define X_INC 0x00010000 |
| 70 | #define X_DEC 0x00000000 |
| 71 | #define Y_INC 0x00020000 |
| 72 | #define Y_DEC 0x00000000 |
| 73 | |
| 74 | /* Clipping flags */ |
| 75 | #define NOCLIP 0x00000000 |
| 76 | #define NOMERGECLIP 0x04000000 |
| 77 | #define CLIPENABLE 0x00040000 |
| 78 | #define CLIPWITHOUTMERGE 0x04040000 |
| 79 | |
| 80 | /* Transparency */ |
| 81 | #define OPAQUE 0x00000000 |
| 82 | #define TRANSPARENT 0x00100000 |
| 83 | |
| 84 | /* ? */ |
| 85 | #define DSTAGP 0x02000000 |
| 86 | #define DSTVIDEO 0x02000000 |
| 87 | |
| 88 | /* Line */ |
| 89 | #define LINE_STYLE 0x00800000 |
| 90 | #define NO_RESET_COUNTER 0x00400000 |
| 91 | #define NO_LAST_PIXEL 0x00200000 |
| 92 | |
| 93 | /* Subfunctions for Color/Enhanced Color Expansion (310/325 only) */ |
| 94 | #define COLOR_TO_MONO 0x00100000 |
| 95 | #define AA_TEXT 0x00200000 |
| 96 | |
| 97 | /* Some general registers for 310/325 series */ |
| 98 | #define SRC_ADDR 0x8200 |
| 99 | #define SRC_PITCH 0x8204 |
| 100 | #define AGP_BASE 0x8206 /* color-depth dependent value */ |
| 101 | #define SRC_Y 0x8208 |
| 102 | #define SRC_X 0x820A |
| 103 | #define DST_Y 0x820C |
| 104 | #define DST_X 0x820E |
| 105 | #define DST_ADDR 0x8210 |
| 106 | #define DST_PITCH 0x8214 |
| 107 | #define DST_HEIGHT 0x8216 |
| 108 | #define RECT_WIDTH 0x8218 |
| 109 | #define RECT_HEIGHT 0x821A |
| 110 | #define PAT_FGCOLOR 0x821C |
| 111 | #define PAT_BGCOLOR 0x8220 |
| 112 | #define SRC_FGCOLOR 0x8224 |
| 113 | #define SRC_BGCOLOR 0x8228 |
| 114 | #define MONO_MASK 0x822C |
| 115 | #define LEFT_CLIP 0x8234 |
| 116 | #define TOP_CLIP 0x8236 |
| 117 | #define RIGHT_CLIP 0x8238 |
| 118 | #define BOTTOM_CLIP 0x823A |
| 119 | #define COMMAND_READY 0x823C |
| 120 | #define FIRE_TRIGGER 0x8240 |
| 121 | |
| 122 | #define PATTERN_REG 0x8300 /* 384 bytes pattern buffer */ |
| 123 | |
| 124 | /* Line registers */ |
| 125 | #define LINE_X0 SRC_Y |
| 126 | #define LINE_X1 DST_Y |
| 127 | #define LINE_Y0 SRC_X |
| 128 | #define LINE_Y1 DST_X |
| 129 | #define LINE_COUNT RECT_WIDTH |
| 130 | #define LINE_STYLE_PERIOD RECT_HEIGHT |
| 131 | #define LINE_STYLE_0 MONO_MASK |
| 132 | #define LINE_STYLE_1 0x8230 |
| 133 | #define LINE_XN PATTERN_REG |
| 134 | #define LINE_YN PATTERN_REG+2 |
| 135 | |
| 136 | /* Transparent bitblit registers */ |
| 137 | #define TRANS_DST_KEY_HIGH PAT_FGCOLOR |
| 138 | #define TRANS_DST_KEY_LOW PAT_BGCOLOR |
| 139 | #define TRANS_SRC_KEY_HIGH SRC_FGCOLOR |
| 140 | #define TRANS_SRC_KEY_LOW SRC_BGCOLOR |
| 141 | |
| 142 | /* Queue */ |
| 143 | #define Q_BASE_ADDR 0x85C0 /* Base address of software queue (?) */ |
| 144 | #define Q_WRITE_PTR 0x85C4 /* Current write pointer (?) */ |
| 145 | #define Q_READ_PTR 0x85C8 /* Current read pointer (?) */ |
| 146 | #define Q_STATUS 0x85CC /* queue status */ |
| 147 | |
| 148 | |
| 149 | #define MMIO_IN8(base, offset) \ |
| 150 | *(volatile u8 *)(((u8*)(base)) + (offset)) |
| 151 | #define MMIO_IN16(base, offset) \ |
| 152 | *(volatile u16 *)(void *)(((u8*)(base)) + (offset)) |
| 153 | #define MMIO_IN32(base, offset) \ |
| 154 | *(volatile u32 *)(void *)(((u8*)(base)) + (offset)) |
| 155 | #define MMIO_OUT8(base, offset, val) \ |
| 156 | *(volatile u8 *)(((u8*)(base)) + (offset)) = (val) |
| 157 | #define MMIO_OUT16(base, offset, val) \ |
| 158 | *(volatile u16 *)(void *)(((u8*)(base)) + (offset)) = (val) |
| 159 | #define MMIO_OUT32(base, offset, val) \ |
| 160 | *(volatile u32 *)(void *)(((u8*)(base)) + (offset)) = (val) |
| 161 | |
| 162 | |
| 163 | |
| 164 | /* ------------- XGI 300 series -------------- */ |
| 165 | |
| 166 | /* Macros to do useful things with the XGI BitBLT engine */ |
| 167 | |
| 168 | /* BR(16) (0x8420): |
| 169 | |
| 170 | bit 31 2D engine: 1 is idle, |
| 171 | bit 30 3D engine: 1 is idle, |
| 172 | bit 29 Command queue: 1 is empty |
| 173 | |
| 174 | bits 28:24: Current CPU driven BitBlt buffer stage bit[4:0] |
| 175 | |
| 176 | bits 15:0: Current command queue length |
| 177 | |
| 178 | */ |
| 179 | |
| 180 | /* TW: BR(16)+2 = 0x8242 */ |
| 181 | |
| 182 | int xgiCmdQueLen; |
| 183 | |
| 184 | #define XGI300Idle \ |
| 185 | { \ |
| 186 | while( (MMIO_IN16(xgi_video_info.mmio_vbase, BR(16)+2) & 0xE000) != 0xE000){}; \ |
| 187 | while( (MMIO_IN16(xgi_video_info.mmio_vbase, BR(16)+2) & 0xE000) != 0xE000){}; \ |
| 188 | while( (MMIO_IN16(xgi_video_info.mmio_vbase, BR(16)+2) & 0xE000) != 0xE000){}; \ |
| 189 | xgiCmdQueLen=MMIO_IN16(xgi_video_info.mmio_vbase, 0x8240); \ |
| 190 | } |
| 191 | /* TW: (do three times, because 2D engine seems quite unsure about whether or not it's idle) */ |
| 192 | |
| 193 | #define XGI300SetupSRCBase(base) \ |
| 194 | if (xgiCmdQueLen <= 0) XGI300Idle;\ |
| 195 | MMIO_OUT32(xgi_video_info.mmio_vbase, BR(0), base);\ |
| 196 | xgiCmdQueLen --; |
| 197 | |
| 198 | #define XGI300SetupSRCPitch(pitch) \ |
| 199 | if (xgiCmdQueLen <= 0) XGI300Idle;\ |
| 200 | MMIO_OUT16(xgi_video_info.mmio_vbase, BR(1), pitch);\ |
| 201 | xgiCmdQueLen --; |
| 202 | |
| 203 | #define XGI300SetupSRCXY(x,y) \ |
| 204 | if (xgiCmdQueLen <= 0) XGI300Idle;\ |
| 205 | MMIO_OUT32(xgi_video_info.mmio_vbase, BR(2), (x)<<16 | (y) );\ |
| 206 | xgiCmdQueLen --; |
| 207 | |
| 208 | #define XGI300SetupDSTBase(base) \ |
| 209 | if (xgiCmdQueLen <= 0) XGI300Idle;\ |
| 210 | MMIO_OUT32(xgi_video_info.mmio_vbase, BR(4), base);\ |
| 211 | xgiCmdQueLen --; |
| 212 | |
| 213 | #define XGI300SetupDSTXY(x,y) \ |
| 214 | if (xgiCmdQueLen <= 0) XGI300Idle;\ |
| 215 | MMIO_OUT32(xgi_video_info.mmio_vbase, BR(3), (x)<<16 | (y) );\ |
| 216 | xgiCmdQueLen --; |
| 217 | |
| 218 | #define XGI300SetupDSTRect(x,y) \ |
| 219 | if (xgiCmdQueLen <= 0) XGI300Idle;\ |
| 220 | MMIO_OUT32(xgi_video_info.mmio_vbase, BR(5), (y)<<16 | (x) );\ |
| 221 | xgiCmdQueLen --; |
| 222 | |
| 223 | #define XGI300SetupDSTColorDepth(bpp) \ |
| 224 | if (xgiCmdQueLen <= 0) XGI300Idle;\ |
| 225 | MMIO_OUT16(xgi_video_info.mmio_vbase, BR(1)+2, bpp);\ |
| 226 | xgiCmdQueLen --; |
| 227 | |
| 228 | #define XGI300SetupRect(w,h) \ |
| 229 | if (xgiCmdQueLen <= 0) XGI300Idle;\ |
| 230 | MMIO_OUT32(xgi_video_info.mmio_vbase, BR(6), (h)<<16 | (w) );\ |
| 231 | xgiCmdQueLen --; |
| 232 | |
| 233 | #define XGI300SetupPATFG(color) \ |
| 234 | if (xgiCmdQueLen <= 0) XGI300Idle;\ |
| 235 | MMIO_OUT32(xgi_video_info.mmio_vbase, BR(7), color);\ |
| 236 | xgiCmdQueLen --; |
| 237 | |
| 238 | #define XGI300SetupPATBG(color) \ |
| 239 | if (xgiCmdQueLen <= 0) XGI300Idle;\ |
| 240 | MMIO_OUT32(xgi_video_info.mmio_vbase, BR(8), color);\ |
| 241 | xgiCmdQueLen --; |
| 242 | |
| 243 | #define XGI300SetupSRCFG(color) \ |
| 244 | if (xgiCmdQueLen <= 0) XGI300Idle;\ |
| 245 | MMIO_OUT32(xgi_video_info.mmio_vbase, BR(9), color);\ |
| 246 | xgiCmdQueLen --; |
| 247 | |
| 248 | #define XGI300SetupSRCBG(color) \ |
| 249 | if (xgiCmdQueLen <= 0) XGI300Idle;\ |
| 250 | MMIO_OUT32(xgi_video_info.mmio_vbase, BR(10), color);\ |
| 251 | xgiCmdQueLen --; |
| 252 | |
| 253 | /* 0x8224 src colorkey high */ |
| 254 | /* 0x8228 src colorkey low */ |
| 255 | /* 0x821c dest colorkey high */ |
| 256 | /* 0x8220 dest colorkey low */ |
| 257 | #define XGI300SetupSRCTrans(color) \ |
| 258 | if (xgiCmdQueLen <= 1) XGI300Idle;\ |
| 259 | MMIO_OUT32(xgi_video_info.mmio_vbase, 0x8224, color);\ |
| 260 | MMIO_OUT32(xgi_video_info.mmio_vbase, 0x8228, color);\ |
| 261 | xgiCmdQueLen -= 2; |
| 262 | |
| 263 | #define XGI300SetupDSTTrans(color) \ |
| 264 | if (xgiCmdQueLen <= 1) XGI300Idle;\ |
| 265 | MMIO_OUT32(xgi_video_info.mmio_vbase, 0x821C, color); \ |
| 266 | MMIO_OUT32(xgi_video_info.mmio_vbase, 0x8220, color); \ |
| 267 | xgiCmdQueLen -= 2; |
| 268 | |
| 269 | #define XGI300SetupMONOPAT(p0,p1) \ |
| 270 | if (xgiCmdQueLen <= 1) XGI300Idle;\ |
| 271 | MMIO_OUT32(xgi_video_info.mmio_vbase, BR(11), p0);\ |
| 272 | MMIO_OUT32(xgi_video_info.mmio_vbase, BR(12), p1);\ |
| 273 | xgiCmdQueLen -= 2; |
| 274 | |
| 275 | #define XGI300SetupClipLT(left,top) \ |
| 276 | if (xgiCmdQueLen <= 0) XGI300Idle;\ |
| 277 | MMIO_OUT32(xgi_video_info.mmio_vbase, BR(13), ((left) & 0xFFFF) | (top)<<16 );\ |
| 278 | xgiCmdQueLen--; |
| 279 | |
| 280 | #define XGI300SetupClipRB(right,bottom) \ |
| 281 | if (xgiCmdQueLen <= 0) XGI300Idle;\ |
| 282 | MMIO_OUT32(xgi_video_info.mmio_vbase, BR(14), ((right) & 0xFFFF) | (bottom)<<16 );\ |
| 283 | xgiCmdQueLen--; |
| 284 | |
| 285 | /* General */ |
| 286 | #define XGI300SetupROP(rop) \ |
| 287 | xgi_video_info.CommandReg = (rop) << 8; |
| 288 | |
| 289 | #define XGI300SetupCMDFlag(flags) \ |
| 290 | xgi_video_info.CommandReg |= (flags); |
| 291 | |
| 292 | #define XGI300DoCMD \ |
| 293 | if (xgiCmdQueLen <= 1) XGI300Idle;\ |
| 294 | MMIO_OUT32(xgi_video_info.mmio_vbase, BR(15), xgi_video_info.CommandReg); \ |
| 295 | MMIO_OUT32(xgi_video_info.mmio_vbase, BR(16), 0);\ |
| 296 | xgiCmdQueLen -= 2; |
| 297 | |
| 298 | /* Line */ |
| 299 | #define XGI300SetupX0Y0(x,y) \ |
| 300 | if (xgiCmdQueLen <= 0) XGI300Idle;\ |
| 301 | MMIO_OUT32(xgi_video_info.mmio_vbase, BR(2), (y)<<16 | (x) );\ |
| 302 | xgiCmdQueLen--; |
| 303 | |
| 304 | #define XGI300SetupX1Y1(x,y) \ |
| 305 | if (xgiCmdQueLen <= 0) XGI300Idle;\ |
| 306 | MMIO_OUT32(xgi_video_info.mmio_vbase, BR(3), (y)<<16 | (x) );\ |
| 307 | xgiCmdQueLen--; |
| 308 | |
| 309 | #define XGI300SetupLineCount(c) \ |
| 310 | if (xgiCmdQueLen <= 0) XGI300Idle;\ |
| 311 | MMIO_OUT16(xgi_video_info.mmio_vbase, BR(6), c);\ |
| 312 | xgiCmdQueLen--; |
| 313 | |
| 314 | #define XGI300SetupStylePeriod(p) \ |
| 315 | if (xgiCmdQueLen <= 0) XGI300Idle;\ |
| 316 | MMIO_OUT16(xgi_video_info.mmio_vbase, BR(6)+2, p);\ |
| 317 | xgiCmdQueLen--; |
| 318 | |
| 319 | #define XGI300SetupStyleLow(ls) \ |
| 320 | if (xgiCmdQueLen <= 0) XGI300Idle;\ |
| 321 | MMIO_OUT32(xgi_video_info.mmio_vbase, BR(11), ls);\ |
| 322 | xgiCmdQueLen--; |
| 323 | |
| 324 | #define XGI300SetupStyleHigh(ls) \ |
| 325 | if (xgiCmdQueLen <= 0) XGI300Idle;\ |
| 326 | MMIO_OUT32(xgi_video_info.mmio_vbase, BR(12), ls);\ |
| 327 | xgiCmdQueLen--; |
| 328 | |
| 329 | |
| 330 | |
| 331 | /* ----------- XGI 310/325 series --------------- */ |
| 332 | |
| 333 | /* Q_STATUS: |
| 334 | bit 31 = 1: All engines idle and all queues empty |
| 335 | bit 30 = 1: Hardware Queue (=HW CQ, 2D queue, 3D queue) empty |
| 336 | bit 29 = 1: 2D engine is idle |
| 337 | bit 28 = 1: 3D engine is idle |
| 338 | bit 27 = 1: HW command queue empty |
| 339 | bit 26 = 1: 2D queue empty |
| 340 | bit 25 = 1: 3D queue empty |
| 341 | bit 24 = 1: SW command queue empty |
| 342 | bits 23:16: 2D counter 3 |
| 343 | bits 15:8: 2D counter 2 |
| 344 | bits 7:0: 2D counter 1 |
| 345 | |
| 346 | Where is the command queue length (current amount of commands the queue |
| 347 | can accept) on the 310/325 series? (The current implementation is taken |
| 348 | from 300 series and certainly wrong...) |
| 349 | */ |
| 350 | |
| 351 | /* TW: FIXME: xgiCmdQueLen is... where....? */ |
| 352 | #define XGI310Idle \ |
| 353 | { \ |
| 354 | while( (MMIO_IN16(xgi_video_info.mmio_vbase, Q_STATUS+2) & 0x8000) != 0x8000){}; \ |
| 355 | while( (MMIO_IN16(xgi_video_info.mmio_vbase, Q_STATUS+2) & 0x8000) != 0x8000){}; \ |
| 356 | xgiCmdQueLen=MMIO_IN16(xgi_video_info.mmio_vbase, Q_STATUS); \ |
| 357 | } |
| 358 | |
| 359 | #define XGI310SetupSRCBase(base) \ |
| 360 | if (xgiCmdQueLen <= 0) XGI310Idle;\ |
| 361 | MMIO_OUT32(xgi_video_info.mmio_vbase, SRC_ADDR, base);\ |
| 362 | xgiCmdQueLen--; |
| 363 | |
| 364 | #define XGI310SetupSRCPitch(pitch) \ |
| 365 | if (xgiCmdQueLen <= 0) XGI310Idle;\ |
| 366 | MMIO_OUT16(xgi_video_info.mmio_vbase, SRC_PITCH, pitch);\ |
| 367 | xgiCmdQueLen--; |
| 368 | |
| 369 | #define XGI310SetupSRCXY(x,y) \ |
| 370 | if (xgiCmdQueLen <= 0) XGI310Idle;\ |
| 371 | MMIO_OUT32(xgi_video_info.mmio_vbase, SRC_Y, (x)<<16 | (y) );\ |
| 372 | xgiCmdQueLen--; |
| 373 | |
| 374 | #define XGI310SetupDSTBase(base) \ |
| 375 | if (xgiCmdQueLen <= 0) XGI310Idle;\ |
| 376 | MMIO_OUT32(xgi_video_info.mmio_vbase, DST_ADDR, base);\ |
| 377 | xgiCmdQueLen--; |
| 378 | |
| 379 | #define XGI310SetupDSTXY(x,y) \ |
| 380 | if (xgiCmdQueLen <= 0) XGI310Idle;\ |
| 381 | MMIO_OUT32(xgi_video_info.mmio_vbase, DST_Y, (x)<<16 | (y) );\ |
| 382 | xgiCmdQueLen--; |
| 383 | |
| 384 | #define XGI310SetupDSTRect(x,y) \ |
| 385 | if (xgiCmdQueLen <= 0) XGI310Idle;\ |
| 386 | MMIO_OUT32(xgi_video_info.mmio_vbase, DST_PITCH, (y)<<16 | (x) );\ |
| 387 | xgiCmdQueLen--; |
| 388 | |
| 389 | #define XGI310SetupDSTColorDepth(bpp) \ |
| 390 | if (xgiCmdQueLen <= 0) XGI310Idle;\ |
| 391 | MMIO_OUT16(xgi_video_info.mmio_vbase, AGP_BASE, bpp);\ |
| 392 | xgiCmdQueLen--; |
| 393 | |
| 394 | #define XGI310SetupRect(w,h) \ |
| 395 | if (xgiCmdQueLen <= 0) XGI310Idle;\ |
| 396 | MMIO_OUT32(xgi_video_info.mmio_vbase, RECT_WIDTH, (h)<<16 | (w) );\ |
| 397 | xgiCmdQueLen--; |
| 398 | |
| 399 | #define XGI310SetupPATFG(color) \ |
| 400 | if (xgiCmdQueLen <= 0) XGI310Idle;\ |
| 401 | MMIO_OUT32(xgi_video_info.mmio_vbase, PAT_FGCOLOR, color);\ |
| 402 | xgiCmdQueLen--; |
| 403 | |
| 404 | #define XGI310SetupPATBG(color) \ |
| 405 | if (xgiCmdQueLen <= 0) XGI310Idle;\ |
| 406 | MMIO_OUT32(xgi_video_info.mmio_vbase, PAT_BGCOLOR, color);\ |
| 407 | xgiCmdQueLen--; |
| 408 | |
| 409 | #define XGI310SetupSRCFG(color) \ |
| 410 | if (xgiCmdQueLen <= 0) XGI310Idle;\ |
| 411 | MMIO_OUT32(xgi_video_info.mmio_vbase, SRC_FGCOLOR, color);\ |
| 412 | xgiCmdQueLen--; |
| 413 | |
| 414 | #define XGI310SetupSRCBG(color) \ |
| 415 | if (xgiCmdQueLen <= 0) XGI310Idle;\ |
| 416 | MMIO_OUT32(xgi_video_info.mmio_vbase, SRC_BGCOLOR, color);\ |
| 417 | xgiCmdQueLen--; |
| 418 | |
| 419 | #define XGI310SetupSRCTrans(color) \ |
| 420 | if (xgiCmdQueLen <= 1) XGI310Idle;\ |
| 421 | MMIO_OUT32(xgi_video_info.mmio_vbase, TRANS_SRC_KEY_HIGH, color);\ |
| 422 | MMIO_OUT32(xgi_video_info.mmio_vbase, TRANS_SRC_KEY_LOW, color);\ |
| 423 | xgiCmdQueLen -= 2; |
| 424 | |
| 425 | #define XGI310SetupDSTTrans(color) \ |
| 426 | if (xgiCmdQueLen <= 1) XGI310Idle;\ |
| 427 | MMIO_OUT32(xgi_video_info.mmio_vbase, TRANS_DST_KEY_HIGH, color); \ |
| 428 | MMIO_OUT32(xgi_video_info.mmio_vbase, TRANS_DST_KEY_LOW, color); \ |
| 429 | xgiCmdQueLen -= 2; |
| 430 | |
| 431 | #define XGI310SetupMONOPAT(p0,p1) \ |
| 432 | if (xgiCmdQueLen <= 1) XGI310Idle;\ |
| 433 | MMIO_OUT32(xgi_video_info.mmio_vbase, MONO_MASK, p0);\ |
| 434 | MMIO_OUT32(xgi_video_info.mmio_vbase, MONO_MASK+4, p1);\ |
| 435 | xgiCmdQueLen -= 2; |
| 436 | |
| 437 | #define XGI310SetupClipLT(left,top) \ |
| 438 | if (xgiCmdQueLen <= 0) XGI310Idle;\ |
| 439 | MMIO_OUT32(xgi_video_info.mmio_vbase, LEFT_CLIP, ((left) & 0xFFFF) | (top)<<16 );\ |
| 440 | xgiCmdQueLen--; |
| 441 | |
| 442 | #define XGI310SetupClipRB(right,bottom) \ |
| 443 | if (xgiCmdQueLen <= 0) XGI310Idle;\ |
| 444 | MMIO_OUT32(xgi_video_info.mmio_vbase, RIGHT_CLIP, ((right) & 0xFFFF) | (bottom)<<16 );\ |
| 445 | xgiCmdQueLen--; |
| 446 | |
| 447 | #define XGI310SetupROP(rop) \ |
| 448 | xgi_video_info.CommandReg = (rop) << 8; |
| 449 | |
| 450 | #define XGI310SetupCMDFlag(flags) \ |
| 451 | xgi_video_info.CommandReg |= (flags); |
| 452 | |
| 453 | #define XGI310DoCMD \ |
| 454 | if (xgiCmdQueLen <= 1) XGI310Idle;\ |
| 455 | MMIO_OUT32(xgi_video_info.mmio_vbase, COMMAND_READY, xgi_video_info.CommandReg); \ |
| 456 | MMIO_OUT32(xgi_video_info.mmio_vbase, FIRE_TRIGGER, 0); \ |
| 457 | xgiCmdQueLen -= 2; |
| 458 | |
| 459 | #define XGI310SetupX0Y0(x,y) \ |
| 460 | if (xgiCmdQueLen <= 0) XGI310Idle;\ |
| 461 | MMIO_OUT32(xgi_video_info.mmio_vbase, LINE_X0, (y)<<16 | (x) );\ |
| 462 | xgiCmdQueLen--; |
| 463 | |
| 464 | #define XGI310SetupX1Y1(x,y) \ |
| 465 | if (xgiCmdQueLen <= 0) XGI310Idle;\ |
| 466 | MMIO_OUT32(xgi_video_info.mmio_vbase, LINE_X1, (y)<<16 | (x) );\ |
| 467 | xgiCmdQueLen--; |
| 468 | |
| 469 | #define XGI310SetupLineCount(c) \ |
| 470 | if (xgiCmdQueLen <= 0) XGI310Idle;\ |
| 471 | MMIO_OUT16(xgi_video_info.mmio_vbase, LINE_COUNT, c);\ |
| 472 | xgiCmdQueLen--; |
| 473 | |
| 474 | #define XGI310SetupStylePeriod(p) \ |
| 475 | if (xgiCmdQueLen <= 0) XGI310Idle;\ |
| 476 | MMIO_OUT16(xgi_video_info.mmio_vbase, LINE_STYLE_PERIOD, p);\ |
| 477 | xgiCmdQueLen--; |
| 478 | |
| 479 | #define XGI310SetupStyleLow(ls) \ |
| 480 | if (xgiCmdQueLen <= 0) XGI310Idle;\ |
| 481 | MMIO_OUT32(xgi_video_info.mmio_vbase, LINE_STYLE_0, ls);\ |
| 482 | xgiCmdQueLen--; |
| 483 | |
| 484 | #define XGI310SetupStyleHigh(ls) \ |
| 485 | if (xgiCmdQueLen <= 0) XGI310Idle;\ |
| 486 | MMIO_OUT32(xgi_video_info.mmio_vbase, LINE_STYLE_1, ls);\ |
| 487 | xgiCmdQueLen--; |
| 488 | |
| 489 | int XGIfb_initaccel(void); |
| 490 | void XGIfb_syncaccel(void); |
| 491 | |
| 492 | extern struct video_info xgi_video_info; |
| 493 | |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 494 | extern int XGIfb_accel; |
| 495 | void fbcon_XGI_fillrect(struct fb_info *info, const struct fb_fillrect *rect); |
| 496 | void fbcon_XGI_copyarea(struct fb_info *info, const struct fb_copyarea *area); |
Bill Pemberton | 23aada9 | 2010-06-17 13:10:34 -0400 | [diff] [blame] | 497 | |
apatard@mandriva.com | d7636e0 | 2010-05-19 10:44:14 +0200 | [diff] [blame] | 498 | |
| 499 | #endif |