Closed DvdBoon closed 9 years ago
Of course this is worth investigating, but let's keep in mind 68k and PPC have separate memories. And in our case access from 68k CPU to PPC memory is terribly slow compared to situation where both processor have equally fast access to the memory (like in CSPPC). So it might be purely a hardware design problem...
Now the Sonnet is also running with a Radeon 92xx card (and benefiting from the extra gfx speed and extra memory) it is weird to find that the context-switch has gone up to a staggering 90ms. A game like Quake (which apparently uses not much context-switches) is now even playable on 800x600x8 (15fps). However simple console programs now take forever when they do a lot of switching.
Why changing a PCI cards affects the context-switch time (PCI-latency) so much has to be figured out.
Extra time during the context switch originates from the PCI Interrupt Server from the pci.library. Looking into it. Turning it off results in a normal context switch time (15ms) and a Quake timedemo at 320x240x8 at 37 FPS. Turning it off results also in some PCI cards not working anymore (network card in my case).
Some testing resulted in the observation that at least the communication from ppc to 68k is not working. The noticed communication was actually a by-effect of SCSI interrupts on INT2 where also the sonnet card is listening to. I'm guessing that the PCI interrupt server from pc I.library should be used for correct interrupting of the 68k by the ppc. Installing a timed interrupt on a CIA B timer actually brings the context switch time within CSPPC levels (1ms) resulting in like 60fps for Quake without noticing speed decrease of normal apps due to the frequent CIA interrupts (using INT6). Rather have actual interrupts going from the ppc to 68k then have a timed interrupt, though.
Fixed it at least for the PPC -> 68K communication (using an interrupt through the pci.library). Context switch now 0.4ms so 30-40 times faster than before. Still looking at the 13ms context switch from 68K->PPC but that one is less crucial for WarpOS programs.
Seeing that the context-switch time from 68K to PPC is not really critical, i'm calling this issue closed
Addendum:
68K to PPC was fixed by timing the function RunPPC and finding out that allocating a large chunk of memory with MEMF_CLEAR was not the smart way to do that. It is now also 400 microseconds.
I know this one is closed, but after a few upgrades to the library latest tests show:
RunPPC: 280 microseconds Run68K: 310 microseconds
Which is quite faster than the CSPPC at the moment (400 microseconds).
Looking at the output of WarpRace regarding context switches on the 604e of the Cyberstorm and the Sonnet there is an order of a magnitude of difference (1.500ms versus 15.000ms). This is probably linked to WarpRace executing 68k code within sonnet memory and/or reading data with the 68k from sonnet memory but I am not sure. Will have to look into it.