33#define GS_INIT_RESET 0
35#define GS_INIT_DRAW_RESET 1
37#define GS_NONINTERLACED 0x00
38#define GS_INTERLACED 0x01
41#define GS_FFMD_FIELD 0x00
43#define GS_FFMD_FRAME 0x01
59 GS_MODE_DTV_480P = 0x50,
77#define GS_PIXMODE_32 0
78#define GS_PIXMODE_24 1
79#define GS_PIXMODE_16 2
80#define GS_PIXMODE_16S 10
100#define GS_ZBUFF_24 49
101#define GS_ZBUFF_16 50
102#define GS_ZBUFF_16S 58
137#define GS_TEX_FIXED 1
161 GS_TEX_NEAREST_MIPMAP_NEAREST,
162 GS_TEX_NEAREST_MIPMAP_LINEAR,
163 GS_TEX_LINEAR_MIPMAP_NEAREST,
164 GS_TEX_LINEAR_MIPMAP_LINEAR
168#define GS_TEX_MIPMAP_DEFINE 0
170#define GS_TEX_MIPMAP_AUTO 1
190#define gs_p_pmode 0x12000000
192#define gs_p_smode1 0x12000010
194#define gs_p_smode2 0x12000020
196#define gs_p_dispfb1 0x12000070
198#define gs_p_display1 0x12000080
200#define gs_p_dispfb2 0x12000090
202#define gs_p_display2 0x120000a0
203#define gs_p_extbuf 0x120000b0
204#define gs_p_extdata 0x120000c0
205#define gs_p_extwrite 0x120000d0
207#define gs_p_bgcolor 0x120000e0
209#define gs_p_csr 0x12001000
211#define gs_p_imr 0x12001010
213#define gs_p_busdir 0x12001040
215#define gs_p_siglblid 0x12001080
220#define gs_g_prim 0x00
222#define gs_g_rgbaq 0x01
228#define gs_g_xyzf2 0x04
230#define gs_g_xyz2 0x05
232#define gs_g_tex0_1 0x06
234#define gs_g_tex0_2 0x07
236#define gs_g_clamp_1 0x08
238#define gs_g_clamp_2 0x09
242#define gs_g_xyzf3 0x0c
244#define gs_g_xyz3 0x0d
245#define gs_g_tex1_1 0x14
246#define gs_g_tex1_2 0x15
248#define gs_g_tex2_1 0x16
250#define gs_g_tex2_2 0x17
252#define gs_g_xyoffset_1 0x18
254#define gs_g_xyoffset_2 0x19
256#define gs_g_prmodecont 0x1a
258#define gs_g_prmode 0x1b
259#define gs_g_texclut 0x1c
261#define gs_g_scanmsk 0x22
263#define gs_g_miptbp1_1 0x34
265#define gs_g_miptbp1_2 0x35
267#define gs_g_miptbp2_1 0x36
269#define gs_g_miptbp2_2 0x37
271#define gs_g_texa 0x3b
273#define gs_g_fogcol 0x3d
275#define gs_g_texflush 0x3f
277#define gs_g_scissor_1 0x40
279#define gs_g_scissor_2 0x41
281#define gs_g_alpha_1 0x42
283#define gs_g_alpha_2 0x43
285#define gs_g_dimx 0x44
287#define gs_g_dthe 0x45
289#define gs_g_colclamp 0x46
291#define gs_g_test_1 0x47
293#define gs_g_test_2 0x48
295#define gs_g_pabe 0x49
297#define gs_g_fba_1 0x4a
299#define gs_g_fba_2 0x4b
301#define gs_g_frame_1 0x4c
303#define gs_g_frame_2 0x4d
305#define gs_g_zbuf_1 0x4e
307#define gs_g_zbuf_2 0x4f
309#define gs_g_bitbltbuf 0x50
311#define gs_g_trxpos 0x51
313#define gs_g_trxreg 0x52
315#define gs_g_trxdir 0x53
316#define gs_g_hwreg 0x54
317#define gs_g_signal 0x60
318#define gs_g_finish 0x61
319#define gs_g_label 0x62
326#define gif_rd_ad 0x0e
328#define gif_rd_nop 0x0f
639 u64 clut_loadmode :3;
680 u64 clut_loadmode :3;
711 u64 clut_voffset :10;
743 u64 alpha_method : 1;
833 u64 atest_reference :8;
834 u64 atest_fail_method :2;
835 u64 datest_enable :1;
1142#define GS_SET_PMODE(enable_rc1, enable_rc2, mmod, amod, blend_style, blend_value) \
1143 *(vu64 *)gs_p_pmode = \
1144 (u64)((enable_rc1 ) & 0x00000001) << 0 | \
1145 (u64)((enable_rc2 ) & 0x00000001) << 1 | \
1146 (u64)((1 ) & 0x00000007) << 2 | \
1147 (u64)((mmod ) & 0x00000001) << 5 | \
1148 (u64)((amod ) & 0x00000001) << 6 | \
1149 (u64)((blend_style) & 0x00000001) << 7 | \
1150 (u64)((blend_value) & 0x000000FF) << 8
1153#define GS_SET_SMODE1(rc, lc, t1248, slck, cmod, ex, prst, sint, xpck, \
1154 pck2, spml, gcont, phs, pvs, pehs, pevs, clksel, \
1155 nvck, slck2, vcksel, vhp) \
1156 *(vu64 *)gs_p_smode1 = \
1157 (u64)((rc ) & 0x00000007) << 0 | \
1158 (u64)((lc ) & 0x0000007F) << 3 | \
1159 (u64)((t1248 ) & 0x00000003) << 10 | \
1160 (u64)((slck ) & 0x00000001) << 12 | \
1161 (u64)((cmod ) & 0x00000003) << 13 | \
1162 (u64)((ex ) & 0x00000001) << 15 | \
1163 (u64)((prst ) & 0x00000001) << 16 | \
1164 (u64)((sint ) & 0x00000001) << 17 | \
1165 (u64)((xpck ) & 0x00000001) << 18 | \
1166 (u64)((pck2 ) & 0x00000003) << 19 | \
1167 (u64)((spml ) & 0x0000000F) << 21 | \
1168 (u64)((gcont ) & 0x00000001) << 25 | \
1169 (u64)((phs ) & 0x00000001) << 26 | \
1170 (u64)((pvs ) & 0x00000001) << 27 | \
1171 (u64)((pehs ) & 0x00000001) << 28 | \
1172 (u64)((pevs ) & 0x00000001) << 29 | \
1173 (u64)((clksel ) & 0x00000003) << 30 | \
1174 (u64)((nvck ) & 0x00000001) << 32 | \
1175 (u64)((slck2 ) & 0x00000001) << 33 | \
1176 (u64)((vcksel ) & 0x00000003) << 34 | \
1177 (u64)((vhp ) & 0x00000003) << 36
1179#define GS_SET_SMODE2(interlace, field_frame, vesta_dpms) \
1180 *(vu64 *)gs_p_smode2 = \
1181 (u64)((interlace ) & 0x00000001) << 0 | \
1182 (u64)((field_frame ) & 0x00000001) << 1 | \
1183 (u64)((vesta_dpms ) & 0x00000003) << 2
1185#define GS_SET_DISPFB1(address, width, psm, x, y) \
1186 *(vu64 *)gs_p_dispfb1=\
1187 (u64)((address ) & 0x000001FF) << 0 | \
1188 (u64)((width ) & 0x0000003F) << 9 | \
1189 (u64)((psm ) & 0x0000001F) << 15 | \
1190 (u64)((x ) & 0x000007FF) << 32 | \
1191 (u64)((y ) & 0x000007FF) << 43
1193#define GS_SET_DISPFB2(address, width, psm, x, y) \
1194 *(vu64 *)gs_p_dispfb2=\
1195 (u64)((address ) & 0x000001FF) << 0 | \
1196 (u64)((width ) & 0x0000003F) << 9 | \
1197 (u64)((psm ) & 0x0000001F) << 15 | \
1198 (u64)((x ) & 0x000007FF) << 32 | \
1199 (u64)((y ) & 0x000007FF) << 43
1201#define GS_SET_DISPLAY1(display_x, display_y,magnify_h,magnify_v,display_w,display_h) \
1202 *(vu64 *)gs_p_display1 = \
1203 (u64)((display_x) & 0x00000FFF) << 0 | \
1204 (u64)((display_y) & 0x000007FF) << 12 | \
1205 (u64)((magnify_h) & 0x0000000F) << 23 | \
1206 (u64)((magnify_v) & 0x00000003) << 27 | \
1207 (u64)((display_w) & 0x00000FFF) << 32 | \
1208 (u64)((display_h) & 0x000007FF) << 44
1210#define GS_SET_DISPLAY2(display_x, display_y,magnify_h,magnify_v,display_w,display_h) \
1211 *(vu64 *)gs_p_display2 = \
1212 (u64)((display_x) & 0x00000FFF) << 0 | \
1213 (u64)((display_y) & 0x000007FF) << 12 | \
1214 (u64)((magnify_h) & 0x0000000F) << 23 | \
1215 (u64)((magnify_v) & 0x00000003) << 27 | \
1216 (u64)((display_w) & 0x00000FFF) << 32 | \
1217 (u64)((display_h) & 0x000007FF) << 44
1219#define GS_SET_EXTBUF(A,B,C,D,E,F,G,H) \
1220 *(vu64 *)gs_p_extbuf = \
1221 (u64)((A) & 0x00003FFF) << 0 | \
1222 (u64)((B) & 0x0000003F) << 14 | \
1223 (u64)((C) & 0x00000003) << 20 | \
1224 (u64)((D) & 0x00000001) << 22 | \
1225 (u64)((E) & 0x00000003) << 23 | \
1226 (u64)((F) & 0x00000003) << 25 | \
1227 (u64)((G) & 0x000007FF) << 32 | \
1228 (u64)((H) & 0x000007FF) << 43
1230#define GS_SET_EXTDATA(x, y, sample_r_h, sample_r_v, write_w, write_h) \
1231 *(vu64 *)gs_p_extdata = \
1232 (u64)((x ) & 0x00000FFF) << 0 | \
1233 (u64)((y ) & 0x000007FF) << 12 | \
1234 (u64)((sample_r_h ) & 0x0000000F) << 23 | \
1235 (u64)((sample_r_v ) & 0x00000003) << 27 | \
1236 (u64)((write_w ) & 0x00000FFF) << 32 | \
1237 (u64)((write_h ) & 0x000007FF) << 44
1239#define GS_SET_EXTWRITE(write)\
1240 *(vu64 *)gs_p_extwrite = \
1241 (u64)((write) & 0x00000001)
1243#define GS_SET_BGCOLOR(r,g,b) \
1244 *(vu64 *)gs_p_bgcolor = \
1245 (u64)((r) & 0x000000FF) << 0 | \
1246 (u64)((g) & 0x000000FF) << 8 | \
1247 (u64)((b) & 0x000000FF) << 16
1249#define GS_SET_CSR(signal_evnt,finish_evnt,hsync_intrupt,vsync_intrupt,write_terminate,flush,reset,nfield,current_field,fifo_status,gs_rev_number,gs_id) \
1250 *(vu64 *)gs_p_csr = \
1251 (u64)((signal_evnt ) & 0x00000001) << 0 | \
1252 (u64)((finish_evnt ) & 0x00000001) << 1 | \
1253 (u64)((hsync_intrupt ) & 0x00000001) << 2 | \
1254 (u64)((vsync_intrupt ) & 0x00000001) << 3 | \
1255 (u64)((write_terminate) & 0x00000001) << 4 | \
1256 (u64)((flush ) & 0x00000001) << 8 | \
1257 (u64)((reset ) & 0x00000001) << 9 | \
1258 (u64)((nfield ) & 0x00000001) << 12 | \
1259 (u64)((current_field ) & 0x00000001) << 13 | \
1260 (u64)((fifo_status ) & 0x00000003) << 14 | \
1261 (u64)((gs_rev_number ) & 0x000000FF) << 16 | \
1262 (u64)((gs_id ) & 0x000000FF) << 24
1264#define GS_SET_IMR(signal_mask, finish_mask, hsync_mask, vsync_mask, write_mask, exhs_mask, exvs_mask) \
1265 *(vu64 *)gs_p_imr = \
1266 (u64)((signal_mask) & 0x00000001) << 8 | \
1267 (u64)((finish_mask) & 0x00000001) << 9 | \
1268 (u64)((hsync_mask ) & 0x00000001) << 10 | \
1269 (u64)((vsync_mask ) & 0x00000001) << 11 | \
1270 (u64)((write_mask ) & 0x00000001) << 12 | \
1271 (u64)((exhs_mask ) & 0x00000001) << 13 | \
1272 (u64)((exvs_mask ) & 0x00000001) << 14
1274#define GS_SET_BUSDIR(direction) \
1275 *(vu64 *)gs_p_busdir = \
1276 (u64)((direction) & 0x00000001)
1278#define GS_SET_SIGLBLID(signal_id, label_id) \
1279 *(vu64 *)gs_p_siglblid = \
1280 (u64)((signal_id ) & 0xFFFFFFFF) << 0 | \
1281 (u64)((label_id ) & 0xFFFFFFFF) << 32
1288#define GS_SET_CSR_signal_evnt(val) \
1289 GS_SET_CSR(val,0,0,0,0,0,0,0,0,0,0,0)
1291#define GS_SET_CSR_finish_evnt(val) \
1292 GS_SET_CSR(0,val,0,0,0,0,0,0,0,0,0,0)
1294#define GS_SET_CSR_hsync_intrupt(val) \
1295 GS_SET_CSR(0,0,val,0,0,0,0,0,0,0,0,0)
1297#define GS_SET_CSR_vsync_intrupt(val) \
1298 GS_SET_CSR(0,0,0,val,0,0,0,0,0,0,0,0)
1300#define GS_SET_CSR_write_terminate(val) \
1301 GS_SET_CSR(0,0,0,0,val,0,0,0,0,0,0,0)
1303#define GS_SET_CSR_flush(val) \
1304 GS_SET_CSR(0,0,0,0,0,val,0,0,0,0,0,0)
1306#define GS_SET_CSR_reset(val) \
1307 GS_SET_CSR(0,0,0,0,0,0,val,0,0,0,0,0)
1320#define GS_GET_CSR_signal_evnt \
1321 (*((vu64 *)(gs_p_csr)) & (0x00000001 << 0))
1323#define GS_GET_CSR_finish_evnt \
1324 (*((vu64 *)(gs_p_csr)) & (0x00000001 << 1))
1326#define GS_GET_CSR_hsync_intrupt \
1327 (*((vu64 *)(gs_p_csr)) & (0x00000001 << 2))
1329#define GS_GET_CSR_vsync_intrupt \
1330 (*((vu64 *)(gs_p_csr)) & (0x00000001 << 3))
1332#define GS_GET_CSR_write_terminate \
1333 (*((vu64 *)(gs_p_csr)) & (0x00000001 << 4))
1338#define GS_GET_CSR_write_nfield \
1339 (*((vu64 *)(gs_p_csr)) & (0x00000001 << 12))
1341#define GS_GET_CSR_current_field \
1342 (*((vu64 *)(gs_p_csr)) & (0x00000001 << 13))
1344#define GS_GET_CSR_fifo_status \
1345 (*((vu64 *)(gs_p_csr)) & (0x00000003 << 14))
1347#define GS_GET_CSR_gs_rev_number \
1348 (*((vu64 *)(gs_p_csr)) & (0x000000FF << 16))
1350#define GS_GET_CSR_gs_id \
1351 (*((vu64 *)(gs_p_csr)) & (0x000000FF << 24))
1355#define gs_setPRIM(p, _prim_type,_iip,_tme,_fge,_abe,_aa1,_fst,_ctxt,_fix)\
1356 (p)->prim_type = _prim_type, \
1363 (p)->ctxt = _ctxt, \
1366#define gs_setRGBAQ(p, _r,_g,_b,_a,_q) \
1373#define gs_setST(p, _s,_t) \
1377#define gs_setUV(p, _u,_v) \
1381#define gs_setXYZF2(p, _x,_y,_z,_f) \
1387#define gs_setXYZF3(p, _x,_y,_z,_f) \
1393#define gs_setXYZ2(p, _x,_y,_z) \
1398#define gs_setXYZ3(p, _x,_y,_z) \
1403#define gs_setTEX0_1(p, _tb_addr, _tb_width, _psm, _tex_width, _tex_height, _tex_cc, _tex_funtion, _cb_addr, _clut_pixmode, _clut_smode, _clut_offset, _clut_loadmode)\
1404 (p)->tb_addr = _tb_addr, \
1405 (p)->tb_width = _tb_width, \
1407 (p)->tex_width = _tex_width, \
1408 (p)->tex_height = _tex_height, \
1409 (p)->tex_cc = _tex_cc, \
1410 (p)->tex_funtion = _tex_funtion, \
1411 (p)->cb_addr = _cb_addr, \
1412 (p)->clut_pixmode = _clut_pixmode, \
1413 (p)->clut_smode = _clut_smode, \
1414 (p)->clut_offset = _clut_offset, \
1415 (p)->clut_loadmode = _clut_loadmode
1417#define gs_setTEX0_2 gs_setTEX0_1
1419#define gs_setCLAMP_1(p, wms,wmt,minu,maxu,minv,maxv) \
1427#define gs_setCLAMP_2 gs_setCLAMP_1
1429#define gs_setFOG(p, _f) \
1432#define gs_setTEX1_1(p, _lcm,_mxl,_mmag,_mmin,_mtba,_l,_k) \
1435 (p)->mmag = _mmag, \
1436 (p)->mmin = _mmin, \
1437 (p)->mtba = _mtba, \
1441#define gs_setTEX1_2 gs_setTEX1_1
1443#define gs_setTEX2_1(p, _psm,_cbp,_cpsm,_csm,_csa,_cld) \
1446 (p)->cpsm = _cpsm, \
1451#define gs_setTEX2_2 gs_setTEX2_1
1453#define gs_set_XYOFFSET_1(p, _offset_x,_offset_y) \
1454 (p)->offset_x = _offset_x, \
1455 (p)->offset_y = _offset_y
1457#define gs_set_XYOFFSET_2 gs_set_XYOFFSET_1
1459#define gs_set_PRMODECONT(p, _control) \
1460 (p)->control = _control
1462#define gs_setPRMODE(p, _iip,_tme,_fge,_abe,_aa1,_fst,_ctxt,_fix) \
1469 (p)->ctxt = _ctxt, \
1472#define gs_setTEXCLUT(p, _cbw,_cou,_cov) \
1477#define gs_setSCANMSK(p, _msk) \
1480#define gs_setMIPTBP1_1(p, _tbp1,_tbw1,_tbp2,_tbw2,_tbp3,_tbw3) \
1481 (p)->tbp1 = _tbp1, \
1482 (p)->tbw1 = _tbw1, \
1483 (p)->tbp2 = _tbp2, \
1484 (p)->tbw2 = _tbw2, \
1485 (p)->tbp3 = _tbp3, \
1488#define gs_setMIPTBP1_2 gs_setMIPTBP1_1
1490#define gs_setMIPTBP2_1(p, _tbp4, _tbw4, _tbp5, _tbw5, _tbp6, _tbw6) \
1491 (p)->tbp4 = _tbp4, \
1492 (p)->tbw4 = _tbw4, \
1493 (p)->tbp5 = _tbp5, \
1494 (p)->tbw5 = _tbw5, \
1495 (p)->tbp6 = _tbp6, \
1498#define gs_setMIPTBP2_2 gs_setMIPTBP2_1
1500#define gs_setTEXA(p, _alpha_0, _alpha_method, _alpha_1) \
1501 (p)->alpha_0 = _alpha_0, \
1502 (p)->alpha_method = _alpha_method, \
1503 (p)->alpha_1 = _alpha_1
1505#define gs_setFOGCOLOR(p, _r,_g,_b) \
1510#define gs_setTEXFLUSH(p)
1512#define gs_setSCISSOR_1(p, _clip_x0,_clip_x1,_clip_y0,_clip_y1) \
1513 (p)->clip_x0 = _clip_x0, \
1514 (p)->clip_x1 = _clip_x1, \
1515 (p)->clip_y0 = _clip_y0, \
1516 (p)->clip_y1 = _clip_y1
1518#define gs_setSCISSOR_2 gs_setSCISSOR_1
1520#define gs_setALPHA_1(p, _a,_b,_c,_d,_alpha)\
1527#define gs_setALPHA_2 gs_setALPHA_1
1529#define gs_setDIMX(p, _dimx00,_dimx01,_dimx02,_dimx03,_dimx10,_dimx11,_dimx12,_dimx13,_dimx20,_dimx21,_dimx22,_dimx23,_dimx30,_dimx31,_dimx32,_dimx33) \
1530 (p)->dimx00 = _dimx00, \
1531 (p)->dimx01 = _dimx01, \
1532 (p)->dimx02 = _dimx02, \
1533 (p)->dimx03 = _dimx03, \
1534 (p)->dimx10 = _dimx10, \
1535 (p)->dimx11 = _dimx11, \
1536 (p)->dimx12 = _dimx12, \
1537 (p)->dimx13 = _dimx13, \
1538 (p)->dimx20 = _dimx20, \
1539 (p)->dimx21 = _dimx21, \
1540 (p)->dimx22 = _dimx22, \
1541 (p)->dimx23 = _dimx23, \
1542 (p)->dimx30 = _dimx30, \
1543 (p)->dimx31 = _dimx31, \
1544 (p)->dimx32 = _dimx32, \
1545 (p)->dimx33 = _dimx33
1547#define gs_setDTHE(p, _enable) \
1548 (p)->enable = _enable
1550#define gs_setCOLCLAMP(p, _clamp) \
1553#define gs_setTEST_1(p, _atest_enable, _atest_method, _atest_reference, _atest_fail_method, _datest_enable, _datest_mode, _ztest_enable, _ztest_method) \
1554 (p)->atest_enable = _atest_enable, \
1555 (p)->atest_method = _atest_method, \
1556 (p)->atest_reference = _atest_reference, \
1557 (p)->atest_fail_method = _atest_fail_method, \
1558 (p)->datest_enable = _datest_enable, \
1559 (p)->datest_mode = _datest_mode, \
1560 (p)->ztest_enable = _ztest_enable, \
1561 (p)->ztest_method = _ztest_method
1563#define gs_setTEST_2 gs_setTEST_1
1565#define gs_setPABE(p, _enable) \
1566 (p)->enable = _enable
1568#define gs_setFBA(p, _alpha) \
1571#define gs_setFRAME_1(p, _fb_addr,_fb_width,_psm,_draw_mask) \
1572 (p)->fb_addr = _fb_addr, \
1573 (p)->fb_width = _fb_width, \
1575 (p)->draw_mask = _draw_mask
1577#define gs_setFRAME_2 gs_setFRAME_1
1579#define gs_setZBUF_1(p, _fb_addr,_psm,_update_mask) \
1580 (p)->fb_addr = _fb_addr, \
1582 (p)->update_mask = _update_mask
1584#define gs_setZBUF_2 gs_setZBUF_1
1586#define gs_setBITBLTBUF(p, _src_addr,_src_width,_src_pixmode,_dest_addr,_dest_width,_dest_pixmode) \
1587 (p)->src_addr = _src_addr, \
1588 (p)->src_width = _src_width, \
1589 (p)->src_pixmode = _src_pixmode, \
1590 (p)->dest_addr = _dest_addr, \
1591 (p)->dest_width = _dest_width, \
1592 (p)->dest_pixmode = _dest_pixmode
1594#define gs_setTRXPOS(p, _src_x,_src_y,_dest_x,_dest_y,_direction) \
1595 (p)->src_x = _src_x, \
1596 (p)->src_y = _src_y, \
1597 (p)->dest_x = _dest_x, \
1598 (p)->dest_y = _dest_y, \
1599 (p)->direction = _direction
1601#define gs_setTRXREG(p, _trans_w,_trans_h) \
1602 (p)->trans_w = _trans_w, \
1603 (p)->trans_h = _trans_h
1605#define gs_setTRXDIR(p, _trans_dir) \
1606 (p)->trans_dir = _trans_dir
1608#define gs_setHWREG(p, _data) \
1611#define gs_setSIGNAL(p, _signal_id,_update_mask) \
1612 (p)->signal_id = _signal_id, \
1613 (p)->update_mask= _update_mask
1615#define gs_setFINISH(p) \
1618#define gs_setLABEL(p, _label_id,_update_mask) \
1619 (p)->label_id = _label_id, \
1620 (p)->update_mask= _update_mask
1622#define gs_setNOP(p) \
1627#define gs_setR_PRIM(p, _prim_type,_iip,_tme,_fge,_abe,_aa1,_fst,_ctxt,_fix)\
1628 gs_setPRIM(&p->data, _prim_type,_iip,_tme,_fge,_abe,_aa1,_fst,_ctxt,_fix),\
1631#define gs_setR_RGBAQ(p, _r,_g,_b,_a,_q) \
1632 gs_setRGBAQ(&p->data, _r,_g,_b,_a,_q),\
1633 (p)->reg = gs_g_rgbaq
1635#define gs_setR_ST(p, _s,_t) \
1636 gs_setST(&p->data, _s,_t),\
1639#define gs_setR_UV(p, _u,_v) \
1640 gs_setUV(&p->data, _u,_v),\
1643#define gs_setR_XYZF2(p, _x,_y,_z,_f) \
1644 gs_setXYZF2(&p->data, _x,_y,_z,_f),\
1645 (p)->reg = gs_g_xyzf2
1647#define gs_setR_XYZF3(p, _x,_y,_z,_f) \
1648 gs_setR_XYZF3(&p->data, _x,_y,_z,_f),\
1649 (p)->reg = gs_g_xyzf3
1651#define gs_setR_XYZ2(p, _x,_y,_z) \
1652 gs_setXYZ2(&p->data, _x,_y,_z),\
1653 (p)->reg = gs_g_xyz2
1655#define gs_setR_XYZ3(p, _x,_y,_z) \
1656 gs_setXYZ3(&p->data, _x,_y,_z),\
1657 (p)->reg = gs_g_xyz3
1659#define gs_setR_TEX0_1(p, _fb_addr,_fb_width,_psm,_tex_width,_tex_height,_col_comp,_tex_cc,_clutb_addr,_clut_pixmode,_clut_smode,_clut_offset,_cld)\
1660 gs_setTEX0_1(&p->data, _fb_addr,_fb_width,_psm,_tex_width,_tex_height,_col_comp,_tex_cc,_clutb_addr,_clut_pixmode,_clut_smode,_clut_offset,_cld),\
1661 (p)->reg = gs_g_tex0_1
1663#define gs_setR_TEX0_2(p, _fb_addr,_fb_width,_psm,_tex_width,_tex_height,_col_comp,_tex_cc,_clutb_addr,_clut_pixmode,_clut_smode,_clut_offset,_cld)\
1664 gs_setTEX0_2(&p->data, _fb_addr,_fb_width,_psm,_tex_width,_tex_height,_col_comp,_tex_cc,_clutb_addr,_clut_pixmode,_clut_smode,_clut_offset,_cld),\
1665 (p)->reg = gs_g_tex0_2
1667#define gs_setR_CLAMP_1(p, wms,wmt,minu,maxu,minv,maxv) \
1668 gs_setCLAMP_1(&p->data, wms,wmt,minu,maxu,minv,maxv),\
1669 (p)->reg = gs_g_clamp_1
1671#define gs_setR_CLAMP_2(p, wms,wmt,minu,maxu,minv,maxv) \
1672 gs_setCLAMP_2(&p->data, wms,wmt,minu,maxu,minv,maxv),\
1673 (p)->reg = gs_g_clamp_2
1675#define gs_setR_FOG(p, _f) \
1676 gs_setFOG(&p->data, _f),\
1679#define gs_setR_TEX1_1(p, _lcm,_mxl,_mmag,_mmin,_mtba,_l,_k) \
1680 gs_setTEX1_1(&p->data, _lcm,_mxl,_mmag,_mmin,_mtba,_l,_k),\
1681 (p)->reg = gs_g_tex1_1
1683#define gs_setR_TEX1_2(p, _lcm,_mxl,_mmag,_mmin,_mtba,_l,_k) \
1684 gs_setTEX1_2(&p->data, _lcm,_mxl,_mmag,_mmin,_mtba,_l,_k),\
1685 (p)->reg = gs_g_tex1_2
1687#define gs_setR_TEX2_1(p, _psm,_cbp,_cpsm,_csm,_csa,_cld) \
1688 gs_setTEX2_1(&p->data, _psm,_cbp,_cpsm,_csm,_csa,_cld),\
1689 (p)->reg = gs_g_tex2_1
1691#define gs_setR_TEX2_2(p, _psm,_cbp,_cpsm,_csm,_csa,_cld) \
1692 gs_setTEX2_2(&p->data, _psm,_cbp,_cpsm,_csm,_csa,_cld),\
1693 (p)->reg = gs_g_tex2_2
1695#define gs_setR_XYOFFSET_1(p, _offset_x,_offset_y) \
1696 gs_set_XYOFFSET_1(&p->data, _offset_x,_offset_y),\
1697 (p)->reg = gs_g_xyoffset_1
1699#define gs_setR_XYOFFSET_2(p, _offset_x,_offset_y) \
1700 gs_set_XYOFFSET_2(&p->data, _offset_x,_offset_y),\
1701 (p)->reg = gs_g_xyoffset_2
1703#define gs_setR_PRMODECONT(p, _control) \
1704 gs_set_PRMODECONT(&p->data, _control),\
1705 (p)->reg = gs_g_prmodecont
1707#define gs_setR_PRMODE(p, _iip,_tme,_fge,_abe,_aa1,_fst,_ctxt,_fix) \
1708 gs_setPRMODE(&p->data, _iip,_tme,_fge,_abe,_aa1,_fst,_ctxt,_fix),\
1709 (p)->reg = gs_g_prmode
1711#define gs_setR_TEXCLUT(p, _cbw,_cou,_cov) \
1712 gs_setTEXCLUT(&p->data, _cbw,_cou,_cov),\
1713 (p)->reg = gs_g_texclut
1715#define gs_setR_SCANMSK(p, _msk) \
1716 gs_setSCANMSK(&p->data, _msk),\
1717 (p)->reg = gs_g_scanmsk
1719#define gs_setR_MIPTBP1_1(p, _tbp1,_tbw1,_tbp2,_tbw2,_tbp3,_tbw3) \
1720 gs_setMIPTBP1_1(&p->data, _tbp1,_tbw1,_tbp2,_tbw2,_tbp3,_tbw3),\
1721 (p)->reg = gs_g_miptbp1_1
1723#define gs_setR_MIPTBP1_2(p, _tbp1,_tbw1,_tbp2,_tbw2,_tbp3,_tbw3) \
1724 gs_setMIPTBP1_2(&p->data, _tbp1,_tbw1,_tbp2,_tbw2,_tbp3,_tbw3),\
1725 (p)->reg = gs_g_miptbp1_2
1727#define gs_setR_MIPTBP2_1(p, _tbp4,_tbw4,_tbp5,_tbw5,_tbp6,_tbw6) \
1728 gs_setR_MIPTBP2_1(&p->data, _tbp4,_tbw4,_tbp5,_tbw5,_tbp6,_tbw6),\
1729 (p)->reg = gs_g_miptbp2_1
1731#define gs_setR_MIPTBP2_2(p, _tbp4,_tbw4,_tbp5,_tbw5,_tbp6,_tbw6) \
1732 gs_setMIPTBP2_2(&p->data, _tbp4,_tbw4,_tbp5,_tbw5,_tbp6,_tbw6),\
1733 (p)->reg = gs_g_miptbp2_2
1735#define gs_setR_TEXA(p, _ta0,_aem,_ta1) \
1736 gs_setTEXA(&p->data, _ta0,_aem,_ta1),\
1737 (p)->reg = gs_g_texa
1739#define gs_setR_FOGCOLOR(p, _r,_g,_b) \
1740 gs_setFOGCOLOR(&p->data, _r,_g,_b),\
1741 (p)->reg = gs_g_fogcol
1743#define gs_setR_TEXFLUSH(p)\
1744 (p)->reg = gs_g_texflush
1746#define gs_setR_SCISSOR_1(p, _clip_x0,_clip_x1,_clip_y0,_clip_y1) \
1747 gs_setSCISSOR_1(&p->data, _clip_x0,_clip_x1,_clip_y0,_clip_y1),\
1748 (p)->reg = gs_g_scissor_1
1750#define gs_setR_SCISSOR_2(p, _clip_x0,_clip_x1,_clip_y0,_clip_y1) \
1751 gs_setSCISSOR_2(&p->data, _clip_x0,_clip_x1,_clip_y0,_clip_y1),\
1752 (p)->reg = gs_g_scissor_2
1754#define gs_setR_ALPHA_1(p, _a,_b,_c,_d,_fix) \
1755 gs_setALPHA_1(&p->data, _a,_b,_c,_d,_fix),\
1756 (p)->reg = gs_g_alpha_1
1758#define gs_setR_ALPHA_2(p, _a,_b,_c,_d,_fix) \
1759 gs_setALPHA_2(&p->data, _a,_b,_c,_d,_fix),\
1760 (p)->reg = gs_g_alpha_2
1762#define gs_setR_DIMX(p, _dimx00,_dimx01,_dimx02,_dimx03,_dimx10,_dimx11,_dimx12,_dimx13,_dimx20,_dimx21,_dimx22,_dimx23,_dimx30,_dimx31,_dimx32,_dimx33) \
1763 gs_setDIMX(&p->data, _dimx00,_dimx01,_dimx02,_dimx03,_dimx10,_dimx11,_dimx12,_dimx13,_dimx20,_dimx21,_dimx22,_dimx23,_dimx30,_dimx31,_dimx32,_dimx33),\
1764 (p)->reg = gs_g_dimx
1766#define gs_setR_DTHE(p, _enable) \
1767 gs_setDTHE(&p->data, _enable),\
1768 (p)->reg = gs_g_dthe
1770#define gs_setR_COLCLAMP(p, _clamp) \
1771 gs_setCOLCLAMP(&p->data, _clamp),\
1772 (p)->reg = gs_g_colclamp
1774#define gs_setR_TEST_1(p, _ATE,_ATST,_AREF,_AFAIL,_DATE,_DATM,_ZTE,_ZTST) \
1775 gs_setTEST_1(&p->data, _ATE,_ATST,_AREF,_AFAIL,_DATE,_DATM,_ZTE,_ZTST),\
1776 (p)->reg = gs_g_test_1
1778#define gs_setR_TEST_2(p, _ATE,_ATST,_AREF,_AFAIL,_DATE,_DATM,_ZTE,_ZTST) \
1779 gs_setTEST_2(&p->data, _ATE,_ATST,_AREF,_AFAIL,_DATE,_DATM,_ZTE,_ZTST),\
1780 (p)->reg = gs_g_test_2
1782#define gs_setR_PABE(p, _enable) \
1783 gs_setPABE(&p->data, _enable),\
1784 (p)->reg = gs_g_pabe
1786#define gs_setR_FBA_1(p, _alpha) \
1787 gs_setFBA(&p->data, _alpha),\
1788 (p)->reg = gs_g_fba_1
1790#define gs_setR_FBA_2(p, _alpha) \
1791 gs_setFBA(&p->data, _alpha),\
1792 (p)->reg = gs_g_fba_2
1794#define gs_setR_FRAME_1(p, _fb_addr,_fb_width,_psm,_draw_mask) \
1795 gs_setFRAME_1(&p->data, _fb_addr,_fb_width,_psm,_draw_mask),\
1796 (p)->reg = gs_g_frame_1
1798#define gs_setR_FRAME_2(p, _fb_addr,_fb_width,_psm,_draw_mask) \
1799 gs_setFRAME_2(&p->data, _fb_addr,_fb_width,_psm,_draw_mask),\
1800 (p)->reg = gs_g_frame_2
1802#define gs_setR_ZBUF_1(p, _fb_addr,_psm,_update_mask) \
1803 gs_setZBUF_1(&p->data, _fb_addr,_psm,_update_mask),\
1804 (p)->reg = gs_g_zbuf_1
1806#define gs_setR_ZBUF_2(p, _fb_addr,_psm,_update_mask) \
1807 gs_setZBUF_2(&p->data, _fb_addr,_psm,_update_mask),\
1808 (p)->reg = gs_g_zbuf_2
1810#define gs_setR_BITBLTBUF(p, _src_addr,_src_width,_src_pixmode,_dest_addr,_dest_width,_dest_pixmode) \
1811 gs_setBITBLTBUF(&p->data, _src_addr,_src_width,_src_pixmode,_dest_addr,_dest_width,_dest_pixmode),\
1812 (p)->reg = gs_g_bitbltbuf
1814#define gs_setR_TRXPOS(p, _src_x,_src_y,_dest_x,_dest_y,_direction) \
1815 gs_setTRXPOS(&p->data, _src_x,_src_y,_dest_x,_dest_y,_direction),\
1816 (p)->reg = gs_g_trxpos
1818#define gs_setR_TRXREG(p, _trans_w,_trans_h) \
1819 gs_setTRXREG(&p->data, _trans_w,_trans_h),\
1820 (p)->reg = gs_g_trxreg
1822#define gs_setR_TRXDIR(p, _trans_dir) \
1823 gs_setTRXDIR(&p->data, _trans_dir),\
1824 (p)->reg = gs_g_trxdir
1826#define gs_setR_HWREG(p, _data) \
1827 gs_setHWREG(&p->data, _data),\
1828 (p)->reg = gs_g_hwreg
1830#define gs_setR_SIGNAL(p, _signal_id,_update_mask) \
1831 gs_setSIGNAL(&p->data, _signal_id,_update_mask),\
1832 (p)->reg = gs_g_signal
1834#define gs_setR_FINISH(p)\
1835 (p)->reg = gs_g_finish
1837#define gs_setR_LABEL(p, _label_id,_update_mask) \
1838 gs_setLABEL(&p->data, _label_id,_update_mask),\
1839 (p)->reg = gs_g_label
1841#define gs_setR_NOP(p) \
1842 gs_setNOP(&p->data),\
1843 (p)->reg = gs_g_label
1870#define gs_setGIF_TAG(p, _nloop,_eop,_pre,_prim,_flg,_nreg,_reg)\
1871 (p)->nloop = _nloop, \
1874 (p)->prim = _prim, \
1876 (p)->nreg = _nreg, \
1884#define CRTC_SETTINGS_DEFAULT1 CRTC_SETTINGS_EN1|CRTC_SETTINGS_BLENDVAL|CRTC_SETTINGS_OUTRC1|CRTC_SETTINGS_STYLERC1
1885#define CRTC_SETTINGS_DEFAULT2 CRTC_SETTINGS_EN2|CRTC_SETTINGS_BLENDVAL|CRTC_SETTINGS_OUTRC1|CRTC_SETTINGS_STYLERC1
1888#define CRTC_SETTINGS_EN1 ((u64)(1)<<0)
1890#define CRTC_SETTINGS_EN2 ((u64)(1)<<1)
1892#define CRTC_SETTINGS_ENBOTH CRTC_SETTINGS_EN1|CRTC_SETTINGS_EN2
1894#define CRTC_SETTINGS_BLENDRC1 ((u64)(0)<<5)
1896#define CRTC_SETTINGS_BLENDVAL ((u64)(1)<<5)
1898#define CRTC_SETTINGS_OUTRC1 ((u64)(0)<<6)
1900#define CRTC_SETTINGS_OUTRC2 ((u64)(1)<<6)
1902#define CRTC_SETTINGS_STYLERC1 ((u64)(0)<<7)
1904#define CRTC_SETTINGS_STYLEBG ((u64)(1)<<7)
2279#define GS_PACKET_DATA_QWORD_MAX 32000
2283 GS_GIF_DMACHAIN_TAG tag;
2284 QWORD data[GS_PACKET_DATA_QWORD_MAX];
2336int GsSetXYOffset1(u16 x, u16 y);
2337int GsSetXYOffset2(u16 x, u16 y);
2338int GsSetScissor1(u16 upper_x, u16 upper_y, u16 lower_x, u16 lower_y);
2339int GsSetScissor2(u16 upper_x, u16 upper_y, u16 lower_x, u16 lower_y);
2340int GsSetFrame1(u16 framebuffer_addr, u8 framebuffer_width, u8 psm, u32 draw_mask);
2341int GsSetFrame2(u16 framebuffer_addr, u8 framebuffer_width, u8 psm, u32 draw_mask);
2342int GsTextureFlush(
void);
2343int GsSetPixelTest1(u8 enable_alpha_test, u8 alpha_test_method, u8 alpha_reference, u8 alpha_fail_method, u8 enable_dest_alpha_test, u8 dest_alpha_test_mode, u8 enable_zbuff_test, u8 alpha_zbuff_method);
2344int GsSetPixelTest2(u8 enable_alpha_test, u8 alpha_test_method, u8 alpha_reference, u8 alpha_fail_method, u8 enable_dest_alpha_test, u8 dest_alpha_test_mode, u8 enable_zbuff_test, u8 alpha_zbuff_method);
2345int GsSelectTexure1(u16 tex_addr, u8 addr_width, u8 tex_pixmode, u16 tex_width, u16 tex_height, u16 clut_addr, u8 clut_pixmode, u8 clut_storagemode,u8 clut_offset);
2346int GsSelectTexure2(u16 tex_addr, u8 addr_width, u8 tex_pixmode, u16 tex_width, u16 tex_height, u16 clut_addr, u8 clut_pixmode, u8 clut_storagemode,u8 clut_offset);
2347void GsSetFogColor(u8 r, u8 g, u8 b);
2348void GsEnableColorClamp(u16 enable);
2353void GsResetGraph(
short int mode,
short int interlace,
short int omode,
short int ffmode);
2354void GsResetPath(
void);
2355void GsSetCRTCSettings(u64 settings, u8 alpha_value);
2358void GsSetDefaultDrawEnv(
GS_DRAWENV *drawenv, u16 psm, u16 w, u16 h);
2359void GsSetDefaultDrawEnvAddress(
GS_DRAWENV *drawenv, u16 vram_addr);
2360void GsSetDefaultDisplayEnv(
GS_DISPENV *dispenv, u16 psm, u16 w, u16 h, u16 dx, u16 dy);
2361void GsSetDefaultDisplayEnvAddress(
GS_DISPENV *dispenv, u16 vram_addr);
2362void GsSetDefaultZBufferEnv(
GS_ZENV *zenv, u8 update_mask);
2363void GsSetDefaultZBufferEnvAddress(
GS_ZENV *zenv, u16 vram_addr, u8 psm);
2370void GsPutZBufferEnv1(
GS_ZENV *zenv);
2371void GsPutZBufferEnv2(
GS_ZENV *zenv);
2383int GsLoadImage(
const void *source_addr,
GS_IMAGE *dest);
2385void GsOverridePrimAttributes(s8
override, s8 iip, s8 tme, s8 fge, s8 abe, s8 aa1, s8 fst, s8 ctxt, s8 fix);
2386void GsEnableDithering(u8 enable,
int mode);
2387void GsEnableAlphaTransparency1(u16 enable,u16 method,u8 alpha_ref,u16 fail_method);
2388void GsEnableAlphaTransparency2(u16 enable,u16 method,u8 alpha_ref,u16 fail_method);
2389void GsEnableZbuffer1(u16 enable,u16 test_method);
2390void GsEnableZbuffer2(u16 enable,u16 test_method);
2391void GsEnableAlphaBlending1(u16 enable);
2392void GsEnableAlphaBlending2(u16 enable);
2394void GsDrawSync(
int mode);
2395void GsHSync(
int mode);
2396void GsVSync(
int mode);
2399int GsVramAllocFrameBuffer(s16 w, s16 h, s16 psm);
2400int GsVramAllocTextureBuffer(s16 w, s16 h, s16 psm);
2403void GsVramFreeAll(
void);
2406int GsDbGetDrawBuffer(
void);
2407int GsDbGetDisplayBuffer(
void);
2408void GsDbSwapBuffer(
void);
#define GS_PRIM_LINE_STRIP
GsATestFailedUpdateMethods
void GsClearDrawEnv2(GS_DRAWENV *drawenv)
void GsVramFreeAllTextureBuffer(void)
void GsClearDrawEnv1(GS_DRAWENV *drawenv)