Last night I thought I would try adding an additional stosb every few rasters and see if it would fit. You can't add an extra stosb every raster or every two rasters, but it seems to be possible to add an extra one every three rasters, maybe.
The problem seems to be that jitter caused by detecting v-retrace at random times and by other things going on, e.g. DRAM refresh means that some of the frames don't finish in time. The way I was handling that previously was by replacing the pattern for the first raster with a few stosws (less than the seven that should fit in a raster) so that there is some slack to be taken up.
This strategy doesn't seem to work with the extra stosb every three rasters. I haven't found a way to stabilise the pattern and about 1-2% of the frames don't complete in time. Moreover, jitter in raster bars towards the end of the frame is greater than an entire raster, and certainly doesn't come anywhere near fitting into the h-retrace period. Inserting nops between the stosw's also seems to just increase the number of frames that don't complete in time and doesn't improve stability.
I'm not sure that's a solvable problem, for two reasons: DRAM refresh is not going to go away and is probably not able to be synced with v-retrace in any way and the dot clock is probably not a small rational multiple of the CPU clock, so that some slack is actually always needed in order to get stability.
I might try adding one stosb per four rasters tonight and see if I can fit that in and still have enough slack for stability.
Having said all that, just putting 7 stosws per raster with zero nops between also did not result in a stable pattern. I actually needed to insert the nops to get the thing stable enough that jitter only occurs during the h-retrace period.
So perhaps the three raster pattern with the extra stosb can be stabilised with some pattern of nops. It doesn't seem all that easy to find if it does exist, though.
I think I may have been incredibly lucky with the 7 stosb per raster pattern that I found. It seems to be hard to find anything similar.
I think this all does add evidence for my contention that there is *something* repeating every raster, though it does show that there is some variability from raster to raster. It's not exactly the same pattern of wait states every time, I don't think.