Yeah. 2 things happening there.
The first is a race condition between EE and IOP that causes some GPU commands to arrive in the wrong order.
Wisi found a good fix for this in the PGPU itself.
The 2nd issue is an IOP core problem.
We never implemented proper cycle delays for the opcodes and maybe worse, DMA transfers don't stall the CPU as they should.
There's also no DMA priority handling at all, not that it matters much under these conditions.
This appears to be okay for PS2 mode, but in PSX mode, this screws up some common routines.
I have some ideas for this but we need tests. Particularly something silly that PSX code likes to do:
Code:
int i = 9999;
while (i-- > 1);
This and other variants of active wait...
They take time on hardware and I suspect it doesn't on the current IOP implementations (or not the right amount).
A test for this would have to be in MIPS ASM and we need a way to run this on PS2 hardware and PCSX2.
Real PSX support would be a nice bonus, to check whether the PS2 implementation is different there.
Edit:
Here's a better example, part of the original PSX startup code:
Code:
_96_init()
{
long tmp;
0xbfc07330();
tmp = 0;
while (tmp <50000) { /* this loop might be stupid, but its */
tmp=tmp; /* what it does */
tmp++;
}
dev_cd_initfs();
}
Clearly that while loop was important for some reason.