1 /* COPYRIGHT AND PERMISSION NOTICE
3 Copyright (c) 2000, 2001 Nokia Home Communications
7 Permission is hereby granted, free of charge, to any person obtaining
8 a copy of this software and associated documentation files (the
9 "Software"), to deal in the Software without restriction, including
10 without limitation the rights to use, copy, modify, merge, publish,
11 distribute, and/or sell copies of the Software, and to permit persons
12 to whom the Software is furnished to do so, provided that the above
13 copyright notice(s) and this permission notice appear in all copies of
14 the Software and that both the above copyright notice(s) and this
15 permission notice appear in supporting documentation.
17 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
20 OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
21 HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY
22 SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER
23 RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
24 CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
25 CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
27 Except as contained in this notice, the name of a copyright holder
28 shall not be used in advertising or otherwise to promote the sale, use
29 or other dealings in this Software without prior written authorization
30 of the copyright holder.
32 X Window System is a trademark of The Open Group */
34 /**************************************************************************
36 Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
39 Permission is hereby granted, free of charge, to any person obtaining a
40 copy of this software and associated documentation files (the
41 "Software"), to deal in the Software without restriction, including
42 without limitation the rights to use, copy, modify, merge, publish,
43 distribute, sub license, and/or sell copies of the Software, and to
44 permit persons to whom the Software is furnished to do so, subject to
45 the following conditions:
47 The above copyright notice and this permission notice (including the
48 next paragraph) shall be included in all copies or substantial portions
51 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
52 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
53 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
54 IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
55 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
56 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
57 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
59 **************************************************************************/
63 * Keith Whitwell <keith@tungstengraphics.com>
64 * Pontus Lidman <pontus.lidman@nokia.com>
66 * based on the i740 driver by
67 * Kevin E. Martin <kevin@precisioninsight.com>
72 /* I/O register offsets
74 #define SRX 0x3C4 /* p208 */
75 #define GRX 0x3CE /* p213 */
76 #define ARX 0x3C0 /* p224 */
78 /* VGA Color Palette Registers */
79 #define DACMASK 0x3C6 /* p232 */
80 #define DACSTATE 0x3C7 /* p232 */
81 #define DACRX 0x3C7 /* p233 */
82 #define DACWX 0x3C8 /* p233 */
83 #define DACDATA 0x3C9 /* p233 */
85 /* CRT Controller Registers (CRX) */
86 #define START_ADDR_HI 0x0C /* p246 */
87 #define START_ADDR_LO 0x0D /* p247 */
88 #define VERT_SYNC_END 0x11 /* p249 */
89 #define EXT_VERT_TOTAL 0x30 /* p257 */
90 #define EXT_VERT_DISPLAY 0x31 /* p258 */
91 #define EXT_VERT_SYNC_START 0x32 /* p259 */
92 #define EXT_VERT_BLANK_START 0x33 /* p260 */
93 #define EXT_HORIZ_TOTAL 0x35 /* p261 */
94 #define EXT_HORIZ_BLANK 0x39 /* p261 */
95 #define EXT_START_ADDR 0x40 /* p262 */
96 #define EXT_START_ADDR_ENABLE 0x80
97 #define EXT_OFFSET 0x41 /* p263 */
98 #define EXT_START_ADDR_HI 0x42 /* p263 */
99 #define INTERLACE_CNTL 0x70 /* p264 */
100 #define INTERLACE_ENABLE 0x80
101 #define INTERLACE_DISABLE 0x00
103 /* Miscellaneous Output Register
105 #define MSR_R 0x3CC /* p207 */
106 #define MSR_W 0x3C2 /* p207 */
107 #define IO_ADDR_SELECT 0x01
109 #define MDA_BASE 0x3B0 /* p207 */
110 #define CGA_BASE 0x3D0 /* p207 */
112 /* CR80 - IO Control, p264
115 #define EXTENDED_ATTR_CNTL 0x02
116 #define EXTENDED_CRTC_CNTL 0x01
118 /* GR10 - Address mapping, p221
120 #define ADDRESS_MAPPING 0x10
121 #define PAGE_TO_LOCAL_MEM_ENABLE 0x10
122 #define GTT_MEM_MAP_ENABLE 0x08
123 #define PACKED_MODE_ENABLE 0x04
124 #define LINEAR_MODE_ENABLE 0x02
125 #define PAGE_MAPPING_ENABLE 0x01
127 /* Blitter control, p378
129 #define BITBLT_CNTL 0x7000c
130 #define COLEXP_MODE 0x30
131 #define COLEXP_8BPP 0x00
132 #define COLEXP_16BPP 0x10
133 #define COLEXP_24BPP 0x20
134 #define COLEXP_RESERVED 0x30
135 #define BITBLT_STATUS 0x01
139 #define DISPLAY_CNTL 0x70008
140 #define VGA_WRAP_MODE 0x02
141 #define VGA_WRAP_AT_256KB 0x00
142 #define VGA_NO_WRAP 0x02
143 #define GUI_MODE 0x01
144 #define STANDARD_VGA_MODE 0x00
145 #define HIRES_MODE 0x01
149 #define PIXPIPE_CONFIG_0 0x70009
150 #define DAC_8_BIT 0x80
151 #define DAC_6_BIT 0x00
152 #define HW_CURSOR_ENABLE 0x10
153 #define EXTENDED_PALETTE 0x01
157 #define PIXPIPE_CONFIG_1 0x7000a
158 #define DISPLAY_COLOR_MODE 0x0F
159 #define DISPLAY_VGA_MODE 0x00
160 #define DISPLAY_8BPP_MODE 0x02
161 #define DISPLAY_15BPP_MODE 0x04
162 #define DISPLAY_16BPP_MODE 0x05
163 #define DISPLAY_24BPP_MODE 0x06
164 #define DISPLAY_32BPP_MODE 0x07
168 #define PIXPIPE_CONFIG_2 0x7000b
169 #define DISPLAY_GAMMA_ENABLE 0x08
170 #define DISPLAY_GAMMA_DISABLE 0x00
171 #define OVERLAY_GAMMA_ENABLE 0x04
172 #define OVERLAY_GAMMA_DISABLE 0x00
177 #define DISPLAY_BASE 0x70020
178 #define DISPLAY_BASE_MASK 0x03fffffc
181 /* Cursor control registers, pp383-384
183 #define CURSOR_CONTROL 0x70080
184 #define CURSOR_ORIGIN_SCREEN 0x00
185 #define CURSOR_ORIGIN_DISPLAY 0x10
186 #define CURSOR_MODE 0x07
187 #define CURSOR_MODE_DISABLE 0x00
188 #define CURSOR_MODE_32_4C_AX 0x01
189 #define CURSOR_MODE_64_3C 0x04
190 #define CURSOR_MODE_64_4C_AX 0x05
191 #define CURSOR_MODE_64_4C 0x06
192 #define CURSOR_MODE_RESERVED 0x07
193 #define CURSOR_BASEADDR 0x70084
194 #define CURSOR_BASEADDR_MASK 0x1FFFFF00
195 #define CURSOR_X_LO 0x70088
196 #define CURSOR_X_HI 0x70089
197 #define CURSOR_X_POS 0x00
198 #define CURSOR_X_NEG 0x80
199 #define CURSOR_Y_LO 0x7008A
200 #define CURSOR_Y_HI 0x7008B
201 #define CURSOR_Y_POS 0x00
202 #define CURSOR_Y_NEG 0x80
206 /* Similar registers exist in Device 0 on the i810 (pp55-65), but I'm
207 * not sure they refer to local (graphics) memory.
209 * These details are for the local memory control registers,
210 * (pp301-310). The test machines are not equiped with local memory,
211 * so nothing is tested. Only a single row seems to be supported.
213 #define DRAM_ROW_TYPE 0x3000
214 #define DRAM_ROW_0 0x01
215 #define DRAM_ROW_0_SDRAM 0x01
216 #define DRAM_ROW_0_EMPTY 0x00
217 #define DRAM_ROW_CNTL_LO 0x3001
218 #define DRAM_PAGE_MODE_CTRL 0x10
219 #define DRAM_RAS_TO_CAS_OVRIDE 0x08
220 #define DRAM_CAS_LATENCY 0x04
221 #define DRAM_RAS_TIMING 0x02
222 #define DRAM_RAS_PRECHARGE 0x01
223 #define DRAM_ROW_CNTL_HI 0x3002
224 #define DRAM_REFRESH_RATE 0x18
225 #define DRAM_REFRESH_DISABLE 0x00
226 #define DRAM_REFRESH_60HZ 0x08
227 #define DRAM_REFRESH_FAST_TEST 0x10
228 #define DRAM_REFRESH_RESERVED 0x18
229 #define DRAM_SMS 0x07
230 #define DRAM_SMS_NORMAL 0x00
231 #define DRAM_SMS_NOP_ENABLE 0x01
232 #define DRAM_SMS_ABPCE 0x02
233 #define DRAM_SMS_MRCE 0x03
234 #define DRAM_SMS_CBRCE 0x04
238 #define DPMS_SYNC_SELECT 0x5002
239 #define VSYNC_CNTL 0x08
240 #define VSYNC_ON 0x00
241 #define VSYNC_OFF 0x08
242 #define HSYNC_CNTL 0x02
243 #define HSYNC_ON 0x00
244 #define HSYNC_OFF 0x02
250 #define VCLK2_VCO_M 0x6008 /* treat as 16 bit? (includes msbs) */
251 #define VCLK2_VCO_N 0x600a
252 #define VCLK2_VCO_DIV_SEL 0x6012
253 #define POST_DIV_SELECT 0x70
254 #define POST_DIV_1 0x00
255 #define POST_DIV_2 0x10
256 #define POST_DIV_4 0x20
257 #define POST_DIV_8 0x30
258 #define POST_DIV_16 0x40
259 #define POST_DIV_32 0x50
260 #define VCO_LOOP_DIV_BY_4M 0x00
261 #define VCO_LOOP_DIV_BY_16M 0x04
264 /* Instruction Parser Mode Register
268 #define INST_PM 0x20c0
269 #define AGP_SYNC_PACKET_FLUSH_ENABLE 0x20 /* reserved */
270 #define SYNC_PACKET_FLUSH_ENABLE 0x10
271 #define TWO_D_INST_DISABLE 0x08
272 #define THREE_D_INST_DISABLE 0x04
273 #define STATE_VAR_UPDATE_DISABLE 0x02
274 #define PAL_STIP_DISABLE 0x01
276 #define INST_DONE 0x2090
277 #define INST_PS 0x20c4
279 #define MEMMODE 0x20dc
282 /* Instruction parser error register. p279
288 /* General error reporting regs, p296
293 #define IP_ERR 0x0001
294 #define ERROR_RESERVED 0xffc6
297 /* Interrupt Control Registers
298 * - new bits for i810
299 * - new register hwstam (mask)
301 #define HWSTAM 0x2098 /* p290 */
302 #define IER 0x20a0 /* p291 */
303 #define IIR 0x20a4 /* p292 */
304 #define IMR 0x20a8 /* p293 */
305 #define ISR 0x20ac /* p294 */
306 #define HW_ERROR 0x8000
307 #define SYNC_STATUS_TOGGLE 0x1000
308 #define DPY_0_FLIP_PENDING 0x0800
309 #define DPY_1_FLIP_PENDING 0x0400 /* not implemented on i810 */
310 #define OVL_0_FLIP_PENDING 0x0200
311 #define OVL_1_FLIP_PENDING 0x0100 /* not implemented on i810 */
312 #define DPY_0_VBLANK 0x0080
313 #define DPY_0_EVENT 0x0040
314 #define DPY_1_VBLANK 0x0020 /* not implemented on i810 */
315 #define DPY_1_EVENT 0x0010 /* not implemented on i810 */
316 #define HOST_PORT_EVENT 0x0008 /* */
317 #define CAPTURE_EVENT 0x0004 /* */
318 #define USER_DEFINED 0x0002
319 #define BREAKPOINT 0x0001
322 #define INTR_RESERVED (0x6000 | \
323 DPY_1_FLIP_PENDING | \
324 OVL_1_FLIP_PENDING | \
330 /* FIFO Watermark and Burst Length Control Register
332 * - different offset and contents on i810 (p299) (fewer bits per field)
333 * - some overlay fields added
334 * - what does it all mean?
336 #define FWATER_BLC 0x20d8
337 #define MM_BURST_LENGTH 0x00700000
338 #define MM_FIFO_WATERMARK 0x0001F000
339 #define LM_BURST_LENGTH 0x00000700
340 #define LM_FIFO_WATERMARK 0x0000001F
343 /* Fence/Tiling ranges [0..7]
348 #define FENCE_START_MASK 0x03F80000
349 #define FENCE_X_MAJOR 0x00000000
350 #define FENCE_Y_MAJOR 0x00001000
351 #define FENCE_SIZE_MASK 0x00000700
352 #define FENCE_SIZE_512K 0x00000000
353 #define FENCE_SIZE_1M 0x00000100
354 #define FENCE_SIZE_2M 0x00000200
355 #define FENCE_SIZE_4M 0x00000300
356 #define FENCE_SIZE_8M 0x00000400
357 #define FENCE_SIZE_16M 0x00000500
358 #define FENCE_SIZE_32M 0x00000600
359 #define FENCE_PITCH_MASK 0x00000070
360 #define FENCE_PITCH_1 0x00000000
361 #define FENCE_PITCH_2 0x00000010
362 #define FENCE_PITCH_4 0x00000020
363 #define FENCE_PITCH_8 0x00000030
364 #define FENCE_PITCH_16 0x00000040
365 #define FENCE_PITCH_32 0x00000050
366 #define FENCE_VALID 0x00000001
369 /* Registers to control page table, p274
371 #define PGETBL_CTL 0x2020
372 #define PGETBL_ADDR_MASK 0xFFFFF000
373 #define PGETBL_ENABLE_MASK 0x00000001
374 #define PGETBL_ENABLED 0x00000001
376 /* Register containing pge table error results, p276
378 #define PGE_ERR 0x2024
379 #define PGE_ERR_ADDR_MASK 0xFFFFF000
380 #define PGE_ERR_ID_MASK 0x00000038
381 #define PGE_ERR_CAPTURE 0x00000000
382 #define PGE_ERR_OVERLAY 0x00000008
383 #define PGE_ERR_DISPLAY 0x00000010
384 #define PGE_ERR_HOST 0x00000018
385 #define PGE_ERR_RENDER 0x00000020
386 #define PGE_ERR_BLITTER 0x00000028
387 #define PGE_ERR_MAPPING 0x00000030
388 #define PGE_ERR_CMD_PARSER 0x00000038
389 #define PGE_ERR_TYPE_MASK 0x00000007
390 #define PGE_ERR_INV_TABLE 0x00000000
391 #define PGE_ERR_INV_PTE 0x00000001
392 #define PGE_ERR_MIXED_TYPES 0x00000002
393 #define PGE_ERR_PAGE_MISS 0x00000003
394 #define PGE_ERR_ILLEGAL_TRX 0x00000004
395 #define PGE_ERR_LOCAL_MEM 0x00000005
396 #define PGE_ERR_TILED 0x00000006
400 /* Page table entries loaded via mmio region, p323
402 #define PTE_BASE 0x10000
403 #define PTE_ADDR_MASK 0x3FFFF000
404 #define PTE_TYPE_MASK 0x00000006
405 #define PTE_LOCAL 0x00000002
406 #define PTE_MAIN_UNCACHED 0x00000000
407 #define PTE_MAIN_CACHED 0x00000006
408 #define PTE_VALID_MASK 0x00000001
409 #define PTE_VALID 0x00000001
412 /* Ring buffer registers, p277, overview p19
414 #define LP_RING 0x2030
415 #define HP_RING 0x2040
417 #define RING_TAIL 0x00
418 #define TAIL_ADDR 0x000FFFF8
420 #define RING_HEAD 0x04
421 #define HEAD_WRAP_COUNT 0xFFE00000
422 #define HEAD_WRAP_ONE 0x00200000
423 #define HEAD_ADDR 0x001FFFFC
425 #define RING_START 0x08
426 #define START_ADDR 0x00FFFFF8
428 #define RING_LEN 0x0C
429 #define RING_NR_PAGES 0x000FF000
430 #define RING_REPORT_MASK 0x00000006
431 #define RING_REPORT_64K 0x00000002
432 #define RING_REPORT_128K 0x00000004
433 #define RING_NO_REPORT 0x00000000
434 #define RING_VALID_MASK 0x00000001
435 #define RING_VALID 0x00000001
436 #define RING_INVALID 0x00000000
440 /* BitBlt Instructions
442 * There are many more masks & ranges yet to add.
444 #define BR00_BITBLT_CLIENT 0x40000000
445 #define BR00_OP_COLOR_BLT 0x10000000
446 #define BR00_OP_SRC_COPY_BLT 0x10C00000
447 #define BR00_OP_FULL_BLT 0x11400000
448 #define BR00_OP_MONO_SRC_BLT 0x11800000
449 #define BR00_OP_MONO_SRC_COPY_BLT 0x11000000
450 #define BR00_OP_MONO_PAT_BLT 0x11C00000
451 #define BR00_OP_MONO_SRC_COPY_IMMEDIATE_BLT (0x61 << 22)
452 #define BR00_OP_TEXT_IMMEDIATE_BLT 0xc000000
455 #define BR00_TPCY_DISABLE 0x00000000
456 #define BR00_TPCY_ENABLE 0x00000010
458 #define BR00_TPCY_ROP 0x00000000
459 #define BR00_TPCY_NO_ROP 0x00000020
460 #define BR00_TPCY_EQ 0x00000000
461 #define BR00_TPCY_NOT_EQ 0x00000040
463 #define BR00_PAT_MSB_FIRST 0x00000000 /* ? */
465 #define BR00_PAT_VERT_ALIGN 0x000000e0
467 #define BR00_LENGTH 0x0000000F
469 #define BR09_DEST_ADDR 0x03FFFFFF
471 #define BR11_SOURCE_PITCH 0x00003FFF
473 #define BR12_SOURCE_ADDR 0x03FFFFFF
475 #define BR13_SOLID_PATTERN 0x80000000
476 #define BR13_RIGHT_TO_LEFT 0x40000000
477 #define BR13_LEFT_TO_RIGHT 0x00000000
478 #define BR13_MONO_TRANSPCY 0x20000000
479 #define BR13_USE_DYN_DEPTH 0x04000000
480 #define BR13_DYN_8BPP 0x00000000
481 #define BR13_DYN_16BPP 0x01000000
482 #define BR13_DYN_24BPP 0x02000000
483 #define BR13_ROP_MASK 0x00FF0000
484 #define BR13_DEST_PITCH 0x0000FFFF
485 #define BR13_PITCH_SIGN_BIT 0x00008000
487 #define BR14_DEST_HEIGHT 0xFFFF0000
488 #define BR14_DEST_WIDTH 0x0000FFFF
490 #define BR15_PATTERN_ADDR 0x03FFFFFF
492 #define BR16_SOLID_PAT_COLOR 0x00FFFFFF
493 #define BR16_BACKGND_PAT_CLR 0x00FFFFFF
495 #define BR17_FGND_PAT_CLR 0x00FFFFFF
497 #define BR18_SRC_BGND_CLR 0x00FFFFFF
498 #define BR19_SRC_FGND_CLR 0x00FFFFFF
501 /* Instruction parser instructions
504 #define INST_PARSER_CLIENT 0x00000000
505 #define INST_OP_FLUSH 0x02000000
506 #define INST_FLUSH_MAP_CACHE 0x00000001
508 #define INST_DEST_BUFFER_INFO 0x06800000
510 #define INST_FRONT_BUFFER_INFO 0x06000000
511 #define FRONT_INFO_ASYNC_FLIP 1<<6
512 #define FRONT_INFO_PITCH_B 8
514 #define GFX_OP_USER_INTERRUPT ((0<<29)|(2<<23))
517 /* Registers in the i810 host-pci bridge pci config space which affect
518 * the i810 graphics operations.
520 #define SMRAM_MISCC 0x70
521 #define GMS 0x000000c0
522 #define GMS_DISABLE 0x00000000
523 #define GMS_ENABLE_BARE 0x00000040
524 #define GMS_ENABLE_512K 0x00000080
525 #define GMS_ENABLE_1M 0x000000c0
526 #define USMM 0x00000030
527 #define USMM_DISABLE 0x00000000
528 #define USMM_TSEG_ZERO 0x00000010
529 #define USMM_TSEG_512K 0x00000020
530 #define USMM_TSEG_1M 0x00000030
531 #define GFX_MEM_WIN_SIZE 0x00010000
532 #define GFX_MEM_WIN_32M 0x00010000
533 #define GFX_MEM_WIN_64M 0x00000000
535 /* Overkill? I don't know. Need to figure out top of mem to make the
536 * SMRAM calculations come out. Linux seems to have problems
537 * detecting it all on its own, so this seems a reasonable double
538 * check to any user supplied 'mem=...' boot param.
540 * ... unfortunately this reg doesn't work according to spec on the
543 #define WHTCFG_PAMR_DRP 0x50
544 #define SYS_DRAM_ROW_0_SHIFT 16
545 #define SYS_DRAM_ROW_1_SHIFT 20
546 #define DRAM_MASK 0x0f
547 #define DRAM_VALUE_0 0
548 #define DRAM_VALUE_1 8
549 /* No 2 value defined */
550 #define DRAM_VALUE_3 16
551 #define DRAM_VALUE_4 16
552 #define DRAM_VALUE_5 24
553 #define DRAM_VALUE_6 32
554 #define DRAM_VALUE_7 32
555 #define DRAM_VALUE_8 48
556 #define DRAM_VALUE_9 64
557 #define DRAM_VALUE_A 64
558 #define DRAM_VALUE_B 96
559 #define DRAM_VALUE_C 128
560 #define DRAM_VALUE_D 128
561 #define DRAM_VALUE_E 192
562 #define DRAM_VALUE_F 256 /* nice one, geezer */
563 #define LM_FREQ_MASK 0x10
564 #define LM_FREQ_133 0x10
565 #define LM_FREQ_100 0x00
570 /* These are 3d state registers, but the state is invarient, so we let
571 * the X server handle it:
576 /* GFXRENDERSTATE_COLOR_CHROMA_KEY, p135
578 #define GFX_OP_COLOR_CHROMA_KEY ((0x3<<29)|(0x1d<<24)|(0x2<<16)|0x1)
579 #define CC1_UPDATE_KILL_WRITE (1<<28)
580 #define CC1_ENABLE_KILL_WRITE (1<<27)
581 #define CC1_DISABLE_KILL_WRITE 0
582 #define CC1_UPDATE_COLOR_IDX (1<<26)
583 #define CC1_UPDATE_CHROMA_LOW (1<<25)
584 #define CC1_UPDATE_CHROMA_HI (1<<24)
585 #define CC1_CHROMA_LOW_MASK ((1<<24)-1)
586 #define CC2_COLOR_IDX_SHIFT 24
587 #define CC2_COLOR_IDX_MASK (0xff<<24)
588 #define CC2_CHROMA_HI_MASK ((1<<24)-1)
591 #define GFX_CMD_CONTEXT_SEL ((0<<29)|(0x5<<23))
592 #define CS_UPDATE_LOAD (1<<17)
593 #define CS_UPDATE_USE (1<<16)
594 #define CS_UPDATE_LOAD (1<<17)
595 #define CS_LOAD_CTX0 0
596 #define CS_LOAD_CTX1 (1<<8)
597 #define CS_USE_CTX0 0
598 #define CS_USE_CTX1 (1<<0)
600 /* 3D Rendering Engine */
602 #define RENDER_CLIENT 0x60000000
604 /* Primitive rendering instruction */
606 #define GFX_PRIMITIVE 0x1f000000
607 #define PRIMITIVE_TRIANGLE 0 << 18
608 #define PRIMITIVE_TRI_STRIP 1 << 18
609 #define PRIMITIVE_TRI_REV_STRIP 2 << 18
610 #define PRIMITIVE_TRI_FAN 3 << 18
611 #define PRIMITIVE_POLYGON 4 << 18
612 #define PRIMITIVE_LINE 5 << 18
613 #define PRIMITIVE_LINE_STRIP 6 << 18
614 #define PRIMITIVE_RECTANGLE 7 << 18
616 /* Vertex format instruction */
617 #define GFX_VERTEX_FORMAT 0x05000000
618 #define VERTEX_0_TEXCOORDS 0 << 8
619 #define VERTEX_1_TEXCOORDS 1 << 8
620 #define VERTEX_2_TEXCOORDS 2 << 8
621 #define VERTEX_SPECULAR_FOG 1 << 7
622 #define VERTEX_DIFFUSE_ALPHA 1 << 6
623 #define VERTEX_Z_OFFSET 1 << 5
624 #define VERTEX_POS_XYZ 1 << 1
625 #define VERTEX_POS_XYZ_RHW 2 << 1
626 #define VERTEX_POS_XY 3 << 1
627 #define VERTEX_POS_XY_RHW 4 << 1
629 /* Drawing Rectangle Info instruction */
631 #define GFX_DRAWING_RECTANGLE_INFO 0x1d800003
632 #define GFX_DRAWING_CLIP_DISABLE 1<<31
634 /* Boolean enable 1 */
635 #define GFX_BOOLEAN_ENA_1 0x03000000
636 #define BOOL1_ALPHA_SETUP_MASK 1<<17
637 #define BOOL1_ALPHA_SETUP_BIT 1<<16
638 #define BOOL1_FOG_ENABLE_MASK 1<<7
639 #define BOOL1_FOG_ENABLE_BIT 1<<6
640 #define BOOL1_ALPHA_TEST_MASK 1<<5
641 #define BOOL1_ALPHA_TEST_BIT 1<<4
642 #define BOOL1_BLEND_ENABLE_MASK 1<<3
643 #define BOOL1_BLEND_ENABLE_BIT 1<<2
644 #define BOOL1_Z_ENABLE_MASK 1<<1
645 #define BOOL1_Z_ENABLE_BIT 1<<0
647 /* Boolean enable 2 */
648 #define GFX_BOOLEAN_ENA_2 0x04000000
649 #define BOOL2_MAPPING_CACHE_MASK 1<<17
650 #define BOOL2_MAPPING_CACHE_BIT 1<<16
651 #define BOOL2_ALPHA_DITHER_MASK 1<<15
652 #define BOOL2_ALPHA_DITHER_BIT 1<<14
653 #define BOOL2_FOG_DITHER_MASK 1<<13
654 #define BOOL2_FOG_DITHER_BIT 1<<12
655 #define BOOL2_SPECULAR_DITHER_MASK 1<<11
656 #define BOOL2_SPECULAR_DITHER_BIT 1<<10
657 #define BOOL2_COLOR_DITHER_MASK 1<<9
658 #define BOOL2_COLOR_DITHER_BIT 1<<8
659 #define BOOL2_FB_WRITE_MASK 1<<3
660 #define BOOL2_FB_WRITE_BIT 1<<2
661 #define BOOL2_Z_WRITE_MASK 1<<1
662 #define BOOL2_Z_WRITE_BIT 1<<0
664 /* Dest buffer variables */
666 #define GFX_DEST_BUFFER_VARIABLES 0x1d850000
668 #define DEST_BUF_VAR_8BIT 0 << 8
669 #define DEST_BUF_VAR_555 1 << 8
670 #define DEST_BUF_VAR_565 2 << 8
672 /* map color blend stages */
674 #define GFX_MAP_COLOR_BLEND_STAGES 0
676 #define MAP_BLEND_STAGE_B 20
677 #define MAP_BLEND_ACC_SEL_MASK 1<<19
678 #define MAP_BLEND_ACC_SEL_BIT 1<<18
679 #define MAP_BLEND_ARG1_MASK 1<<17
680 #define MAP_BLEND_ARG1_B 14
681 #define MAP_BLEND_REPLICATE_ARG1 1<<13
682 #define MAP_BLEND_INVERT_ARG1 1<<12
684 #define MAP_BLEND_ARG2_MASK 1<<11
685 #define MAP_BLEND_ARG2_B 8
686 #define MAP_BLEND_REPLICATE_ARG2 1<<7
687 #define MAP_BLEND_INVERT_ARG2 1<<6
689 #define MAP_BLEND_COLOR_OP_MASK 1<<5
690 #define MAP_BLEND_COLOR_OP_B 0
692 #define GFX_SCISSOR_ENABLE 0x1c800000
694 #define SCISSOR_ENABLE_MASK 1<<1
695 #define SCISSOR_ENABLE_BIT 1<<0