21 August 2020, 08:48 | #1 |
This cat is no more
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,161
|
blitter waits and hardware bugs
Something I'm not sure of even today
Is that a correct way to wait for blitter on all machines? Code:
.wait BTST #6,$DFF002 BNE.B .wait or should we add something like Code:
tst.b $BFE001 or something first to wait a while before waiting? Isn't there a bug in some machine chipset (like A4000) that makes the blitwait inefficient in some circumstances ? |
21 August 2020, 08:57 | #2 |
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 3,215
|
The correct way is to call WaitBlit() of the graphics library. The problem with the blitter is that it has a couple of issues, depending on the machine, where it does not yet indicate that the blit has started because the CPU is ahead of the blitter, and the latter only updates its state based on the 7Mhz clock of the custom chips. Another issue the blitter has that it may erase the blitter-busy flag too soon while, in fact, the last word is still being blitted.
The graphics.library contains workarounds for such issues, it is thus the recommended way. |
21 August 2020, 09:37 | #3 | |
Registered User
Join Date: Mar 2016
Location: Australia
Posts: 881
|
Quote:
|
|
21 August 2020, 09:55 | #4 |
Registered User
Join Date: May 2013
Location: Grimstad / Norway
Posts: 839
|
I'm sure Toni has a better explanation, but there is a bug that makes BUSY not flag until the blitter has actually started working. The workaround is thus that after an access to the chip bus you will be guaranteed that it actually has. (Correct?)
I don't know what revision fixed this to flag it as soon as the size register is written. |
21 August 2020, 10:02 | #5 | ||||
Registered User
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,408
|
Quote:
Quote:
Quote:
Quote:
Note that the HRM provides Blitter Waiting code which also works like how it's been described in this thread (below is a copy from the HRM Blitter examples): Code:
waitblit: btst.b #DMAB_BLTDONE-8,DMACONR(a1) waitblit2: btst.b #DMAB_BLTDONE-8,DMACONR(a1) bne waitblit2 rts Last edited by roondar; 21 August 2020 at 10:12. |
||||
21 August 2020, 10:13 | #6 |
Registered User
Join Date: Mar 2016
Location: Australia
Posts: 881
|
I'm guessing that turning on BLITHOG before the "broken" wait loop and turning it off after the wait loop would avoid any issues as that would give you the required custom chip access ?
|
21 August 2020, 10:17 | #7 |
Registered User
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,408
|
Yes, this is another common solution. It also has the extra benefit of making the waiting impact the Blitter a lot less, so the Blit will be done faster.
|
21 August 2020, 10:29 | #8 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,502
|
A1000 blitter sets BUSY when it gets first memory cycle. All (?) blitters clear BUSY when it has internally processed last word, not when last word gets written to memory. (which means at least 2 cycle delay). EDIT: this is almost always harmless (unless you access exact same word with CPU in next cycle) because any blitter register can be written safely during this period, including BLTSIZE. (which needed extra logic in emulation because there was demo that did it..)
I think you should already know that even when this is correct answer, it is also useless answer in this forum. |
21 August 2020, 10:31 | #9 | ||
This cat is no more
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,161
|
Quote:
Quote:
Maybe Toni you could add a special "agnus bug" option to be able to reproduce those bugs. I already love your "chipset hack" to find broken audio replays, it helped a lot. Maybe adding another bit in chipset hack could be enough. |
||
21 August 2020, 10:34 | #10 | |
Registered User
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,408
|
Quote:
I suppose it's possible an issue could arise if the CPU tries to read the very last word blit directly after BUSY is cleared. On fast machines this should then give the CPU the old pre-blit answer rather than the new. Not sure this is really going to cause many issues, but it's certainly interesting! This should really only affect the A1000. But, it's always wise to have the extra access just in case |
|
21 August 2020, 10:35 | #11 |
This cat is no more
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,161
|
So maybe waiting BEFORE writing to blitter registers is more dangerous than waiting just after having written to BLTSIZE (even if the first solution is less wasteful because the CPU can work in the meantime, specially when the blit is interleaved)
I rarely could insert blitwaits before blitter operations in games I fixed. It almost never worked... But it's also more difficult because if another routine changes a bitter register (not BLTSIZE) before you wait, you're toast. |
21 August 2020, 10:51 | #12 | |
Registered User
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,408
|
Quote:
However, I'll defer judgement of this to Toni - he knows a heck of a lot more than me, that's for sure. |
|
21 August 2020, 22:15 | #13 |
This cat is no more
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,161
|
I fixed the incorrect blitter errors and it seems to have done it for a A4000/040 user...
http://mantis.whdload.de/view.php?id=4440 so thanks. And it seems that some A4000 machines have an issue like this too... |
21 August 2020, 22:31 | #14 |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
|
There is this interesting old thread: http://eab.abime.net/showthread.php?t=31758
I would like to understand why the addition of waits with CIA access improves the situation on fast machines.. The maximum I had at the time was a 030/50 so the fewer wasted waits I did the better it was |
21 August 2020, 22:41 | #15 |
This cat is no more
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,161
|
it's probably not wasted if you have to wait most of the time anyway.
|
21 August 2020, 23:11 | #16 |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
|
|
22 August 2020, 11:58 | #17 |
Registered User
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,408
|
My guess is that using the CIA to wait is simply a good way to wait a specified number of cycles. Why this affects faster machines more is an interesting question though, it doesn't feel like it should - most of these machines access chip memory slower than the A1200 does.
|
22 August 2020, 12:12 | #18 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,502
|
I guess one unknown when the question was asked (which is now known) feature was blitter idle cycles being usable by the CPU but if blitter nasty is off and CPU steals cycle from blitter (by reading DMACONR) and it was going to be blitter idle cycle: blitter loses the cycle. Without cycle steal both blitter and CPU would have "used" it.
|
22 August 2020, 12:28 | #19 | |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
|
Quote:
|
|
22 August 2020, 14:56 | #20 |
This cat is no more
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,161
|
well if the code is running in chipmem and if you enable blitter nasty I guess you don't even have to loopwait. Enable it, wait just enough so the blitter understands that it can steal all cpu and disable it again.
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Amiga 1200 hardware fixes for Gayle bugs | Mick | support.Hardware | 0 | 10 November 2019 12:59 |
Triple buffering, blitter queues and bugs | deimos | Coders. General | 0 | 03 October 2019 11:25 |
Blitter settings + amiga hardware ref. | Legionary | Amiga scene | 1 | 25 September 2016 16:57 |
Chip's Challenge slowdown due to blitter waits | Gaula92 | project.WHDLoad | 33 | 10 March 2013 16:43 |
Lack of blitter waits on A500 | Codetapper | Coders. Asm / Hardware | 3 | 09 September 2012 13:45 |
|
|