forked from KolibriOS/kolibrios
initialize command processor.
little bit close to 3D rendering git-svn-id: svn://kolibrios.org@791 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
350d7e1cc7
commit
5d19dd9dc0
@ -152,6 +152,64 @@ macro rdr op1, op2
|
||||
mov op1, [edi+op2]
|
||||
}
|
||||
|
||||
macro BEGIN_RING
|
||||
{
|
||||
mov edi, [rhd.ring_base]
|
||||
mov edx, [rhd.ring_wp]
|
||||
}
|
||||
|
||||
macro COMMIT_RING
|
||||
{
|
||||
and edx, 0x1FFF
|
||||
mov [rhd.ring_wp], edx
|
||||
|
||||
lock add [esp], dword 0 ; Flush writes to ring
|
||||
|
||||
wrr RADEON_CP_RB_WPTR, edx
|
||||
rdr eax, RADEON_CP_RB_RPTR
|
||||
}
|
||||
|
||||
macro OUT_PACKET0 reg, count
|
||||
{
|
||||
mov eax, (RADEON_CP_PACKET0 + (count shl 16) + (reg shr 2))
|
||||
mov [edi+edx*4], eax
|
||||
inc edx
|
||||
}
|
||||
|
||||
macro OUT_PACKET3 pkt, count \
|
||||
{
|
||||
mov eax, (RADEON_CP_PACKET3 or pkt or (count shl 16))
|
||||
mov [edi+edx*4], eax
|
||||
inc edx
|
||||
}
|
||||
|
||||
macro OUT_RING val
|
||||
{
|
||||
mov eax, val
|
||||
mov [edi+edx*4], eax
|
||||
inc edx
|
||||
}
|
||||
|
||||
macro RADEON_WAIT_UNTIL_IDLE
|
||||
{
|
||||
OUT_PACKET0 RADEON_WAIT_UNTIL, 0
|
||||
OUT_RING RADEON_WAIT_2D_IDLECLEAN + \
|
||||
RADEON_WAIT_3D_IDLECLEAN + \
|
||||
RADEON_WAIT_HOST_IDLECLEAN
|
||||
}
|
||||
|
||||
macro RADEON_PURGE_CACHE
|
||||
{
|
||||
OUT_PACKET0 R5XX_RB3D_DSTCACHE_CTLSTAT, 0
|
||||
OUT_RING R5XX_RB3D_DC_FLUSH_ALL
|
||||
}
|
||||
|
||||
macro RADEON_PURGE_ZCACHE
|
||||
{
|
||||
OUT_PACKET0 RADEON_RB3D_ZCACHE_CTLSTAT, 0
|
||||
OUT_RING RADEON_RB3D_ZC_FLUSH_ALL
|
||||
}
|
||||
|
||||
macro wrr dest, src
|
||||
{
|
||||
mov edi, [ati_io]
|
||||
@ -1246,6 +1304,267 @@ msgR5xxFIFOWaitLocaltimeout \
|
||||
db 'R5xxFIFOWaitLocal timeout error', 13, 10,0
|
||||
msgR5xx2DIdleLocaltimeout \
|
||||
db 'R5xx2DIdleLocal timeout error', 13,10,0
|
||||
|
||||
align 4
|
||||
R520_cp_microcode:
|
||||
dd 0x4200e000, 0000000000
|
||||
dd 0x4000e000, 0000000000
|
||||
dd 0x00000099, 0x00000008
|
||||
dd 0x0000009d, 0x00000008
|
||||
dd 0x4a554b4a, 0000000000
|
||||
dd 0x4a4a4467, 0000000000
|
||||
dd 0x55526f75, 0000000000
|
||||
dd 0x4a7e7d65, 0000000000
|
||||
dd 0xe0dae6f6, 0000000000
|
||||
dd 0x4ac54a4a, 0000000000
|
||||
dd 0xc8828282, 0000000000
|
||||
dd 0xbf4acfc1, 0000000000
|
||||
dd 0x87b04ad5, 0000000000
|
||||
dd 0xb5838383, 0000000000
|
||||
dd 0x4a0f85ba, 0000000000
|
||||
dd 0x000ca000, 0x00000004
|
||||
dd 0x000d0012, 0x00000038
|
||||
dd 0x0000e8b4, 0x00000004
|
||||
dd 0x000d0014, 0x00000038
|
||||
dd 0x0000e8b6, 0x00000004
|
||||
dd 0x000d0016, 0x00000038
|
||||
dd 0x0000e854, 0x00000004
|
||||
dd 0x000d0018, 0x00000038
|
||||
dd 0x0000e855, 0x00000004
|
||||
dd 0x000d001a, 0x00000038
|
||||
dd 0x0000e856, 0x00000004
|
||||
dd 0x000d001c, 0x00000038
|
||||
dd 0x0000e857, 0x00000004
|
||||
dd 0x000d001e, 0x00000038
|
||||
dd 0x0000e824, 0x00000004
|
||||
dd 0x000d0020, 0x00000038
|
||||
dd 0x0000e825, 0x00000004
|
||||
dd 0x000d0022, 0x00000038
|
||||
dd 0x0000e830, 0x00000004
|
||||
dd 0x000d0024, 0x00000038
|
||||
dd 0x0000f0c0, 0x00000004
|
||||
dd 0x000d0026, 0x00000038
|
||||
dd 0x0000f0c1, 0x00000004
|
||||
dd 0x000d0028, 0x00000038
|
||||
dd 0x0000e000, 0x00000004
|
||||
dd 0x000d002a, 0x00000038
|
||||
dd 0x0000e000, 0x00000004
|
||||
dd 0x000d002c, 0x00000038
|
||||
dd 0x0000e000, 0x00000004
|
||||
dd 0x000d002e, 0x00000038
|
||||
dd 0x0000e000, 0x00000004
|
||||
dd 0x000d0030, 0x00000038
|
||||
dd 0x0000e000, 0x00000004
|
||||
dd 0x000d0032, 0x00000038
|
||||
dd 0x0000f180, 0x00000004
|
||||
dd 0x000d0034, 0x00000038
|
||||
dd 0x0000f393, 0x00000004
|
||||
dd 0x000d0036, 0x00000038
|
||||
dd 0x0000f38a, 0x00000004
|
||||
dd 0x000d0038, 0x00000038
|
||||
dd 0x0000f38e, 0x00000004
|
||||
dd 0x0000e821, 0x00000004
|
||||
dd 0x0140a000, 0x00000004
|
||||
dd 0x00000043, 0x00000018
|
||||
dd 0x00cce800, 0x00000004
|
||||
dd 0x001b0001, 0x00000004
|
||||
dd 0x08004800, 0x00000004
|
||||
dd 0x001b0001, 0x00000004
|
||||
dd 0x08004800, 0x00000004
|
||||
dd 0x001b0001, 0x00000004
|
||||
dd 0x08004800, 0x00000004
|
||||
dd 0x0000003a, 0x00000008
|
||||
dd 0x0000a000, 0000000000
|
||||
dd 0x2000451d, 0x00000004
|
||||
dd 0x0000e580, 0x00000004
|
||||
dd 0x000ce581, 0x00000004
|
||||
dd 0x08004580, 0x00000004
|
||||
dd 0x000ce581, 0x00000004
|
||||
dd 0x00000047, 0x00000008
|
||||
dd 0x0000a000, 0000000000
|
||||
dd 0x000c2000, 0x00000004
|
||||
dd 0x0000e50e, 0x00000004
|
||||
dd 0x00032000, 0x00000004
|
||||
dd 0x00022051, 0x00000028
|
||||
dd 0x00000051, 0x00000024
|
||||
dd 0x0800450f, 0x00000004
|
||||
dd 0x0000a04b, 0x00000008
|
||||
dd 0x0000e565, 0x00000004
|
||||
dd 0x0000e566, 0x00000004
|
||||
dd 0x00000052, 0x00000008
|
||||
dd 0x03cca5b4, 0x00000004
|
||||
dd 0x05432000, 0x00000004
|
||||
dd 0x00022000, 0x00000004
|
||||
dd 0x4ccce05e, 0x00000030
|
||||
dd 0x08274565, 0x00000004
|
||||
dd 0x0000005e, 0x00000030
|
||||
dd 0x08004564, 0x00000004
|
||||
dd 0x0000e566, 0x00000004
|
||||
dd 0x00000055, 0x00000008
|
||||
dd 0x00802061, 0x00000010
|
||||
dd 0x00202000, 0x00000004
|
||||
dd 0x001b00ff, 0x00000004
|
||||
dd 0x01000064, 0x00000010
|
||||
dd 0x001f2000, 0x00000004
|
||||
dd 0x001c00ff, 0x00000004
|
||||
dd 0000000000, 0x0000000c
|
||||
dd 0x00000072, 0x00000030
|
||||
dd 0x00000055, 0x00000008
|
||||
dd 0x0000e576, 0x00000004
|
||||
dd 0x0000e577, 0x00000004
|
||||
dd 0x0000e50e, 0x00000004
|
||||
dd 0x0000e50f, 0x00000004
|
||||
dd 0x0140a000, 0x00000004
|
||||
dd 0x00000069, 0x00000018
|
||||
dd 0x00c0e5f9, 0x000000c2
|
||||
dd 0x00000069, 0x00000008
|
||||
dd 0x0014e50e, 0x00000004
|
||||
dd 0x0040e50f, 0x00000004
|
||||
dd 0x00c0006c, 0x00000008
|
||||
dd 0x0000e570, 0x00000004
|
||||
dd 0x0000e571, 0x00000004
|
||||
dd 0x0000e572, 0x0000000c
|
||||
dd 0x0000a000, 0x00000004
|
||||
dd 0x0140a000, 0x00000004
|
||||
dd 0x0000e568, 0x00000004
|
||||
dd 0x000c2000, 0x00000004
|
||||
dd 0x00000076, 0x00000018
|
||||
dd 0x000b0000, 0x00000004
|
||||
dd 0x18c0e562, 0x00000004
|
||||
dd 0x00000078, 0x00000008
|
||||
dd 0x00c00077, 0x00000008
|
||||
dd 0x000700c7, 0x00000004
|
||||
dd 0x00000080, 0x00000038
|
||||
dd 0x0000e5bb, 0x00000004
|
||||
dd 0x0000e5bc, 0000000000
|
||||
dd 0x0000a000, 0x00000004
|
||||
dd 0x0000e821, 0x00000004
|
||||
dd 0x0000e800, 0000000000
|
||||
dd 0x0000e821, 0x00000004
|
||||
dd 0x0000e82e, 0000000000
|
||||
dd 0x02cca000, 0x00000004
|
||||
dd 0x00140000, 0x00000004
|
||||
dd 0x000ce1cc, 0x00000004
|
||||
dd 0x050de1cd, 0x00000004
|
||||
dd 0x00400000, 0x00000004
|
||||
dd 0x0000008f, 0x00000018
|
||||
dd 0x00c0a000, 0x00000004
|
||||
dd 0x0000008c, 0x00000008
|
||||
dd 0x00000091, 0x00000020
|
||||
dd 0x4200e000, 0000000000
|
||||
dd 0x00000098, 0x00000038
|
||||
dd 0x000ca000, 0x00000004
|
||||
dd 0x00140000, 0x00000004
|
||||
dd 0x000c2000, 0x00000004
|
||||
dd 0x00160000, 0x00000004
|
||||
dd 0x700ce000, 0x00000004
|
||||
dd 0x00140094, 0x00000008
|
||||
dd 0x4000e000, 0000000000
|
||||
dd 0x02400000, 0x00000004
|
||||
dd 0x400ee000, 0x00000004
|
||||
dd 0x02400000, 0x00000004
|
||||
dd 0x4000e000, 0000000000
|
||||
dd 0x000c2000, 0x00000004
|
||||
dd 0x0240e51b, 0x00000004
|
||||
dd 0x0080e50a, 0x00000005
|
||||
dd 0x0080e50b, 0x00000005
|
||||
dd 0x00220000, 0x00000004
|
||||
dd 0x000700c7, 0x00000004
|
||||
dd 0x000000a4, 0x00000038
|
||||
dd 0x0080e5bd, 0x00000005
|
||||
dd 0x0000e5bb, 0x00000005
|
||||
dd 0x0080e5bc, 0x00000005
|
||||
dd 0x00210000, 0x00000004
|
||||
dd 0x02800000, 0x00000004
|
||||
dd 0x00c000ab, 0x00000018
|
||||
dd 0x4180e000, 0x00000040
|
||||
dd 0x000000ad, 0x00000024
|
||||
dd 0x01000000, 0x0000000c
|
||||
dd 0x0100e51d, 0x0000000c
|
||||
dd 0x000045bb, 0x00000004
|
||||
dd 0x000080a7, 0x00000008
|
||||
dd 0x0000f3ce, 0x00000004
|
||||
dd 0x0140a000, 0x00000004
|
||||
dd 0x00cc2000, 0x00000004
|
||||
dd 0x08c053cf, 0x00000040
|
||||
dd 0x00008000, 0000000000
|
||||
dd 0x0000f3d2, 0x00000004
|
||||
dd 0x0140a000, 0x00000004
|
||||
dd 0x00cc2000, 0x00000004
|
||||
dd 0x08c053d3, 0x00000040
|
||||
dd 0x00008000, 0000000000
|
||||
dd 0x0000f39d, 0x00000004
|
||||
dd 0x0140a000, 0x00000004
|
||||
dd 0x00cc2000, 0x00000004
|
||||
dd 0x08c0539e, 0x00000040
|
||||
dd 0x00008000, 0000000000
|
||||
dd 0x03c00830, 0x00000004
|
||||
dd 0x4200e000, 0000000000
|
||||
dd 0x0000a000, 0x00000004
|
||||
dd 0x200045e0, 0x00000004
|
||||
dd 0x0000e5e1, 0000000000
|
||||
dd 0x00000001, 0000000000
|
||||
dd 0x000700c4, 0x00000004
|
||||
dd 0x0800e394, 0000000000
|
||||
dd 0000000000, 0000000000
|
||||
dd 0x0000e8c4, 0x00000004
|
||||
dd 0x0000e8c5, 0x00000004
|
||||
dd 0x0000e8c6, 0x00000004
|
||||
dd 0x0000e928, 0x00000004
|
||||
dd 0x0000e929, 0x00000004
|
||||
dd 0x0000e92a, 0x00000004
|
||||
dd 0x000000c8, 0x00000008
|
||||
dd 0x0000e928, 0x00000004
|
||||
dd 0x0000e929, 0x00000004
|
||||
dd 0x0000e92a, 0x00000004
|
||||
dd 0x000000cf, 0x00000008
|
||||
dd 0xdeadbeef, 0000000000
|
||||
dd 0x00000116, 0000000000
|
||||
dd 0x000700d3, 0x00000004
|
||||
dd 0x080050e7, 0x00000004
|
||||
dd 0x000700d4, 0x00000004
|
||||
dd 0x0800401c, 0x00000004
|
||||
dd 0x0000e01d, 0000000000
|
||||
dd 0x02c02000, 0x00000004
|
||||
dd 0x00060000, 0x00000004
|
||||
dd 0x000000de, 0x00000034
|
||||
dd 0x000000db, 0x00000008
|
||||
dd 0x00008000, 0x00000004
|
||||
dd 0xc000e000, 0000000000
|
||||
dd 0x0000e1cc, 0x00000004
|
||||
dd 0x0500e1cd, 0x00000004
|
||||
dd 0x000ca000, 0x00000004
|
||||
dd 0x000000e5, 0x00000034
|
||||
dd 0x000000e1, 0x00000008
|
||||
dd 0x0000a000, 0000000000
|
||||
dd 0x0019e1cc, 0x00000004
|
||||
dd 0x001b0001, 0x00000004
|
||||
dd 0x0500a000, 0x00000004
|
||||
dd 0x080041cd, 0x00000004
|
||||
dd 0x000ca000, 0x00000004
|
||||
dd 0x000000fb, 0x00000034
|
||||
dd 0x0000004a, 0x00000008
|
||||
dd 0000000000, 0000000000
|
||||
dd 0000000000, 0000000000
|
||||
dd 0000000000, 0000000000
|
||||
dd 0000000000, 0000000000
|
||||
dd 0000000000, 0000000000
|
||||
dd 0000000000, 0000000000
|
||||
dd 0000000000, 0000000000
|
||||
dd 0000000000, 0000000000
|
||||
dd 0000000000, 0000000000
|
||||
dd 0x000c2000, 0x00000004
|
||||
dd 0x001d0018, 0x00000004
|
||||
dd 0x001a0001, 0x00000004
|
||||
dd 0x000000fb, 0x00000034
|
||||
dd 0x0000004a, 0x00000008
|
||||
dd 0x0500a04a, 0x00000008
|
||||
dd 0000000000, 0000000000
|
||||
dd 0000000000, 0000000000
|
||||
dd 0000000000, 0000000000
|
||||
dd 0000000000, 0000000000
|
||||
|
||||
|
||||
end if
|
||||
|
||||
if 0
|
||||
|
@ -66,6 +66,57 @@ if 0
|
||||
|
||||
end if
|
||||
|
||||
RADEON_CP_ME_RAM_ADDR equ 0x07d4
|
||||
RADEON_CP_ME_RAM_RADDR equ 0x07d8
|
||||
RADEON_CP_ME_RAM_DATAH equ 0x07dc
|
||||
RADEON_CP_ME_RAM_DATAL equ 0x07e0
|
||||
|
||||
RADEON_CP_RB_BASE equ 0x0700
|
||||
RADEON_CP_RB_CNTL equ 0x0704
|
||||
RADEON_RB_NO_UPDATE equ (1 shl 27)
|
||||
RADEON_CP_RB_RPTR_ADDR equ 0x070c
|
||||
RADEON_CP_RB_RPTR equ 0x0710
|
||||
RADEON_CP_RB_WPTR equ 0x0714
|
||||
|
||||
RADEON_CP_CSQ_CNTL equ 0x0740
|
||||
RADEON_CSQ_CNT_PRIMARY_MASK equ (0xff shl 0)
|
||||
RADEON_CSQ_PRIDIS_INDDIS equ (0 shl 28)
|
||||
RADEON_CSQ_PRIPIO_INDDIS equ (1 shl 28)
|
||||
RADEON_CSQ_PRIBM_INDDIS equ (2 shl 28)
|
||||
RADEON_CSQ_PRIPIO_INDBM equ (3 shl 28)
|
||||
RADEON_CSQ_PRIBM_INDBM equ (4 shl 28)
|
||||
RADEON_CSQ_PRIPIO_INDPIO equ (15 shl 28)
|
||||
|
||||
RADEON_CP_RB_WPTR_DELAY equ 0x0718
|
||||
|
||||
RADEON_SCRATCH_UMSK equ 0x0770
|
||||
RADEON_SCRATCH_ADDR equ 0x0774
|
||||
|
||||
RADEON_ISYNC_CNTL equ 0x1724
|
||||
RADEON_ISYNC_ANY2D_IDLE3D equ (1 shl 0)
|
||||
RADEON_ISYNC_ANY3D_IDLE2D equ (1 shl 1)
|
||||
RADEON_ISYNC_TRIG2D_IDLE3D equ (1 shl 2)
|
||||
RADEON_ISYNC_TRIG3D_IDLE2D equ (1 shl 3)
|
||||
RADEON_ISYNC_WAIT_IDLEGUI equ (1 shl 4)
|
||||
RADEON_ISYNC_CPSCRATCH_IDLEGUI equ (1 shl 5)
|
||||
|
||||
RADEON_AIC_CNTL equ 0x01d0
|
||||
RADEON_PCIGART_TRANSLATE_EN equ (1 shl 0)
|
||||
RADEON_AIC_STAT equ 0x01d4
|
||||
RADEON_AIC_PT_BASE equ 0x01d8
|
||||
RADEON_AIC_LO_ADDR equ 0x01dc
|
||||
RADEON_AIC_HI_ADDR equ 0x01e0
|
||||
RADEON_AIC_TLB_ADDR equ 0x01e4
|
||||
RADEON_AIC_TLB_DATA equ 0x01e8
|
||||
|
||||
RADEON_WAIT_UNTIL equ 0x1720
|
||||
RADEON_WAIT_CRTC_PFLIP equ (1 shl 0)
|
||||
RADEON_WAIT_2D_IDLE equ (1 shl 14)
|
||||
RADEON_WAIT_3D_IDLE equ (1 shl 15)
|
||||
RADEON_WAIT_2D_IDLECLEAN equ (1 shl 16)
|
||||
RADEON_WAIT_3D_IDLECLEAN equ (1 shl 17)
|
||||
RADEON_WAIT_HOST_IDLECLEAN equ (1 shl 18)
|
||||
|
||||
D1GRPH_PITCH equ 0x6120
|
||||
D1GRPH_X_END equ 0x6134
|
||||
D1GRPH_Y_END equ 0x6138
|
||||
@ -103,6 +154,11 @@ R5XX_DP_CNTL equ 0x16c0
|
||||
R5XX_DP_DST_TILE_MICRO equ (2 shl 3)
|
||||
R5XX_DP_DST_TILE_BOTH equ (3 shl 3)
|
||||
|
||||
RADEON_RB3D_ZCACHE_CTLSTAT equ 0x3254
|
||||
RADEON_RB3D_ZC_FLUSH equ (1 shl 0)
|
||||
RADEON_RB3D_ZC_FREE equ (1 shl 2)
|
||||
RADEON_RB3D_ZC_FLUSH_ALL equ 0x5
|
||||
RADEON_RB3D_ZC_BUSY equ (1 shl 31)
|
||||
|
||||
R5XX_RB3D_DSTCACHE_CTLSTAT equ 0x325C
|
||||
R5XX_RB3D_DC_FLUSH equ (3 shl 0)
|
||||
@ -249,6 +305,9 @@ R5XX_DP_SRC_FRGD_CLR equ 0x15d8
|
||||
|
||||
R5XX_DP_WRITE_MASK equ 0x16cc
|
||||
|
||||
|
||||
RADEON_CP_PACKET0 equ 0x00000000
|
||||
|
||||
struc RHD
|
||||
{
|
||||
.control rd 1
|
||||
@ -256,10 +315,15 @@ struc RHD
|
||||
.datatype rd 1
|
||||
.surface_cntl rd 1
|
||||
.dst_pitch_offset rd 1
|
||||
.ring_base rd 1
|
||||
.ring_rp rd 1
|
||||
.ring_wp rd 1
|
||||
};
|
||||
|
||||
R5XX_LOOP_COUNT equ 2000000
|
||||
|
||||
|
||||
|
||||
align 4
|
||||
R5xxFIFOWaitLocal:
|
||||
|
||||
@ -484,14 +548,93 @@ R5xx2DPreInit:
|
||||
|
||||
ret
|
||||
|
||||
RADEON_BUS_CNTL equ 0x0030
|
||||
RADEON_BUS_MASTER_DIS equ (1 shl 6)
|
||||
|
||||
align 4
|
||||
R5xxCpInit:
|
||||
stdcall CreateRingBuffer, 0x8000, PG_SW+PG_NOCACHE
|
||||
test eax, eax
|
||||
jz .fail
|
||||
|
||||
mov [rhd.ring_base], eax
|
||||
call GetPgAddr
|
||||
|
||||
wrr RADEON_CP_RB_BASE, eax
|
||||
|
||||
wrr RADEON_CP_RB_WPTR_DELAY, 0
|
||||
|
||||
rdr ebx, RADEON_CP_RB_RPTR
|
||||
wrr RADEON_CP_RB_WPTR, ebx
|
||||
|
||||
mov [rhd.ring_rp], ebx
|
||||
mov [rhd.ring_wp], ebx
|
||||
|
||||
wrr RADEON_CP_RB_RPTR_ADDR, 0 ;ring buffer read pointer
|
||||
;no update
|
||||
|
||||
wrr RADEON_CP_RB_CNTL, RADEON_RB_NO_UPDATE + 12
|
||||
wrr RADEON_SCRATCH_UMSK, 0 ;no scratch update
|
||||
|
||||
rdr ebx, RADEON_BUS_CNTL
|
||||
and ebx, not RADEON_BUS_MASTER_DIS
|
||||
|
||||
wrr RADEON_BUS_CNTL, ebx
|
||||
|
||||
; wrr RADEON_LAST_FRAME_REG, 0
|
||||
; wrr RADEON_LAST_DISPATCH_REG, 0
|
||||
; wrr RADEON_LAST_CLEAR_REG, 0
|
||||
|
||||
call R5xx2DIdleLocal
|
||||
|
||||
wrr RADEON_ISYNC_CNTL, RADEON_ISYNC_ANY2D_IDLE3D + \
|
||||
RADEON_ISYNC_ANY3D_IDLE2D + \
|
||||
RADEON_ISYNC_WAIT_IDLEGUI + \
|
||||
RADEON_ISYNC_CPSCRATCH_IDLEGUI
|
||||
.fail:
|
||||
ret
|
||||
|
||||
align 4
|
||||
load_microcode:
|
||||
|
||||
pushfd
|
||||
cli
|
||||
|
||||
call R5xx2DIdleLocal
|
||||
|
||||
wrr RADEON_CP_ME_RAM_ADDR, 0
|
||||
|
||||
lea esi, [R520_cp_microcode]
|
||||
mov ecx, 256
|
||||
@@:
|
||||
mov eax, [esi]
|
||||
mov ebx, [esi+4]
|
||||
wrr RADEON_CP_ME_RAM_DATAH, ebx
|
||||
wrr RADEON_CP_ME_RAM_DATAL, eax
|
||||
add esi, 8
|
||||
loop @B
|
||||
|
||||
popfd
|
||||
ret
|
||||
|
||||
|
||||
align 4
|
||||
R5xx2DInit:
|
||||
|
||||
call R5xx2DPreInit
|
||||
wrr R5XX_RB3D_CNTL, 0
|
||||
|
||||
call R5xx2DReset
|
||||
call R5xx2DSetup
|
||||
|
||||
rdr eax, RADEON_AIC_CNTL ;disable GART
|
||||
and eax, not RADEON_PCIGART_TRANSLATE_EN
|
||||
wrr RADEON_AIC_CNTL, eax
|
||||
|
||||
call load_microcode
|
||||
|
||||
call R5xxCpInit
|
||||
|
||||
rdr eax, D1GRPH_X_END
|
||||
rdr ebx, D1GRPH_Y_END
|
||||
dec eax
|
||||
@ -502,6 +645,14 @@ R5xx2DInit:
|
||||
mov [__xmax], eax
|
||||
mov [__ymax], ebx
|
||||
|
||||
wrr RADEON_CP_CSQ_CNTL, RADEON_CSQ_PRIBM_INDBM
|
||||
|
||||
; BEGIN_RING
|
||||
; RADEON_PURGE_CACHE
|
||||
; RADEON_PURGE_ZCACHE
|
||||
; RADEON_WAIT_UNTIL_IDLE
|
||||
; COMMIT_RING
|
||||
|
||||
ret
|
||||
|
||||
proc R5xxSetupForSolidFill stdcall,color:dword, rop:dword, planemask:dword
|
||||
@ -665,6 +816,17 @@ end virtual
|
||||
|
||||
GXcopy equ 3
|
||||
|
||||
RADEON_CP_PACKET3 equ 0xC0000000
|
||||
|
||||
PAINT_MULTI equ 0xC0009A00
|
||||
|
||||
DST_PITCH_OFFSET_CNTL equ ( 1 shl 1)
|
||||
BRUSH_SOLID_COLOR equ ( 13 shl 4)
|
||||
COLOR_ARGB equ ( 6 shl 8)
|
||||
SRC_DATATYPE_COLOR equ ( 3 shl 12)
|
||||
|
||||
;RADEON_ROP3_P equ
|
||||
|
||||
; esi= input params
|
||||
align 4
|
||||
solid_fill:
|
||||
@ -696,32 +858,30 @@ solid_fill:
|
||||
test eax, eax
|
||||
jnz .exit
|
||||
|
||||
mov edx, [R5xxRops+4+GXcopy*8]
|
||||
or edx, [rhd.control]
|
||||
or edx, (R5XX_GMC_BRUSH_SOLID_COLOR or R5XX_GMC_SRC_DATATYPE_COLOR)
|
||||
;mov edx, [R5xxRops+4+GXcopy*8]
|
||||
;or edx, [rhd.control]
|
||||
;or edx, (R5XX_GMC_BRUSH_SOLID_COLOR or R5XX_GMC_SRC_DATATYPE_COLOR)
|
||||
|
||||
pushfd
|
||||
cli
|
||||
|
||||
mov eax, 7
|
||||
call R5xxFIFOWait
|
||||
|
||||
wrr R5XX_DP_GUI_MASTER_CNTL, edx
|
||||
BEGIN_RING
|
||||
OUT_PACKET3 PAINT_MULTI, 4
|
||||
OUT_RING (DST_PITCH_OFFSET_CNTL + \
|
||||
BRUSH_SOLID_COLOR + \
|
||||
COLOR_ARGB + \
|
||||
SRC_DATATYPE_COLOR + \
|
||||
(1 shl 28)+(1 shl 30) + \
|
||||
R5XX_ROP3_P)
|
||||
|
||||
mov eax, [esi+FILL.color]
|
||||
wrr R5XX_DP_BRUSH_FRGD_CLR, eax
|
||||
|
||||
wrr R5XX_DP_WRITE_MASK, 0xFFFFFFFF
|
||||
|
||||
wrr R5XX_DP_CNTL, (R5XX_DST_X_LEFT_TO_RIGHT or R5XX_DST_Y_TOP_TO_BOTTOM)
|
||||
|
||||
mov eax, [rhd.dst_pitch_offset]
|
||||
wrr R5XX_DST_PITCH_OFFSET, eax
|
||||
OUT_RING [rhd.dst_pitch_offset]
|
||||
OUT_RING [esi+FILL.color]
|
||||
|
||||
mov ebx, [esi+FILL.y]
|
||||
shl ebx, 16
|
||||
mov bx, word [esi+FILL.x]
|
||||
wrr R5XX_DST_Y_X, ebx
|
||||
OUT_RING ebx
|
||||
|
||||
mov ecx, [esp+4] ;x2
|
||||
sub ecx, [esi+FILL.x]
|
||||
@ -732,8 +892,44 @@ solid_fill:
|
||||
inc eax ;h
|
||||
|
||||
shl ecx, 16
|
||||
mov cx, ax ;w|h
|
||||
wrr R5XX_DST_WIDTH_HEIGHT, ecx
|
||||
mov cx, ax ;w|h
|
||||
|
||||
OUT_RING ecx
|
||||
COMMIT_RING
|
||||
|
||||
if 0
|
||||
; mov eax, 7
|
||||
; call R5xxFIFOWait
|
||||
|
||||
; wrr R5XX_DP_GUI_MASTER_CNTL, edx
|
||||
|
||||
; mov eax, [esi+FILL.color]
|
||||
; wrr R5XX_DP_BRUSH_FRGD_CLR, eax
|
||||
|
||||
; wrr R5XX_DP_WRITE_MASK, 0xFFFFFFFF
|
||||
|
||||
; wrr R5XX_DP_CNTL, (R5XX_DST_X_LEFT_TO_RIGHT or R5XX_DST_Y_TOP_TO_BOTTOM)
|
||||
|
||||
; mov eax, [rhd.dst_pitch_offset]
|
||||
; wrr R5XX_DST_PITCH_OFFSET, eax
|
||||
|
||||
; mov ebx, [esi+FILL.y]
|
||||
; shl ebx, 16
|
||||
; mov bx, word [esi+FILL.x]
|
||||
; wrr R5XX_DST_Y_X, ebx
|
||||
|
||||
; mov ecx, [esp+4] ;x2
|
||||
; sub ecx, [esi+FILL.x]
|
||||
; inc ecx ;w
|
||||
|
||||
; mov eax, [esp+8] ;y2
|
||||
; sub eax, [esi+FILL.y]
|
||||
; inc eax ;h
|
||||
|
||||
; shl ecx, 16
|
||||
; mov cx, ax ;w|h
|
||||
; wrr R5XX_DST_WIDTH_HEIGHT, ecx
|
||||
end if
|
||||
popfd
|
||||
.exit:
|
||||
add esp, 8
|
||||
|
Loading…
Reference in New Issue
Block a user