English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Asm / Hardware

 
 
Thread Tools
Old 29 December 2020, 03:06   #1
Jobbo
Registered User

Jobbo's Avatar
 
Join Date: Jun 2020
Location: Druidia
Posts: 326
Fmode and blitter speeds

For AGA how do different Fmode settings affect blitter speeds?

I imagine that the peak blitter bandwidth is unaffected but you can free up more DMA slots that would've been needed for bitplanes and sprites otherwise.

I have a demo effect that's using HAM5 which isn't possible on AGA. To make it compatible I'm detecting AGA and using HAM6, but this uses more bandwidth so the blitter ends up running slower for AGA. I'm thinking that I can get the speed back with Fmode, sound right?

How accurate at this stuff is Winuae when emulating an A1200?

Thanks
Jobbo is offline  
Old 29 December 2020, 08:22   #2
ross
Defendit numerus

ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 52
Posts: 3,962
Quote:
Originally Posted by Jobbo View Post
For AGA how do different Fmode settings affect blitter speeds?

I imagine that the peak blitter bandwidth is unaffected but you can free up more DMA slots that would've been needed for bitplanes and sprites otherwise.
Yes for bitplanes, see how they are 'packed':
https://eab.abime.net/showpost.php?p...65&postcount=2
Not for sprites, they are just wider but same DMA slots usage.

Quote:
I have a demo effect that's using HAM5 which isn't possible on AGA. To make it compatible I'm detecting AGA and using HAM6, but this uses more bandwidth so the blitter ends up running slower for AGA. I'm thinking that I can get the speed back with Fmode, sound right?
Yes, I've also patched some code this way.
Just change BPLCON0 from $7a00 to $6a00 and setup the masks previously in BPL5/6DAT as fetched data.
Even FMODE=x2 is more than enough to recover loss of blitter speed due to the two more bitplane fetches needed.

EDIT: uh, I realized that I have described to you what is usually used for a 7bpls/HAM4+ effect
But obviously the same also applies to the HAM5 (BPLCON0=$5a00), indeed in the latter case you only have a bitplane of difference, so even less speed loss for the blitter.


Quote:
How accurate at this stuff is Winuae when emulating an A1200?
In CE mode the AGA chipset emulation is absolutely consistent, you may have differences in CPU cycles, but in that case it is your code that has to adapt to the different possible processors speeds.

Cheers.

Last edited by ross; 29 December 2020 at 09:25.
ross is offline  
Old 29 December 2020, 18:57   #3
Jobbo
Registered User

Jobbo's Avatar
 
Join Date: Jun 2020
Location: Druidia
Posts: 326
Thanks Ross.

I have AGA allocating an extra blank plane just like you described.

Fmode 4x seems to more than do the trick in Winuae to gain back the speed loss, but I wanted to double check.

I also find I need to adjust Ddfstop. With Fmode set to 4x it seems like I need to stop the display fetch early by 48...64ish pixels.

Does anyone know the exact rules for how Ddfstop should be setup? I know there's different rules for low and high resolution so I imagine the full rule set for AGA gets a bit complicated.
Jobbo is offline  
Old 29 December 2020, 19:58   #4
ross
Defendit numerus

ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 52
Posts: 3,962
DDFSTOP is where the last BPL DMA fetch is done, dependently of is wide.

So DDFSTOP=DDFSTRT+(px-DMA_width)/2 works.

Example: 320 px, DDFSTRT=$38, FMODE=4x ->
DDFSTOP=
$38+(320-64)/2=
$B8


EDIT: however if you put values slightly >$b8 (like $c0) there would be anyway a further fetch (so 320+64..), so you can use a 'range'

Last edited by ross; 29 December 2020 at 20:29.
ross is offline  
Old 29 December 2020, 20:23   #5
Jobbo
Registered User

Jobbo's Avatar
 
Join Date: Jun 2020
Location: Druidia
Posts: 326
That's what I've tried and it works fine for fmode 0, 1 and 3 but not for fmode 2?


Maybe there's a Winuae bug, it seems to swap each display word pair around in that mode.

Edit, it's not swapping them but it seems like the second word is a copy of the first word, or something like that.
Jobbo is offline  
Old 29 December 2020, 20:25   #6
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 48
Posts: 25,813
DDFSTOP does not equal last fetch. (This is very common error, HRM does not explain it very well). After DDFSTOP has matched, there is always one more complete bitplane DMA "block" (all enabled planes fetched) before DMA stops.

End result can still be same even if value is technically wrong because there is 8/16/32 possible DDFSTOP values that have same result.
Toni Wilen is offline  
Old 29 December 2020, 20:25   #7
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 48
Posts: 25,813
Quote:
Originally Posted by Jobbo View Post
That's what I've tried and it works fine for fmode 0, 1 and 3 but not for fmode 2?

Maybe there's a Winuae bug, it seems to swap each display word pair around in that mode.
You probably didn't expect it but it is correct behavior
FMODE=2 is useless. (EDIT: it has same cycle sequence as FMODE=1 so nothing useful was lost)
Toni Wilen is offline  
Old 29 December 2020, 20:33   #8
Jobbo
Registered User

Jobbo's Avatar
 
Join Date: Jun 2020
Location: Druidia
Posts: 326
Quote:
Originally Posted by Toni Wilen View Post
You probably didn't expect it but it is correct behavior
FMODE=2 is useless. (EDIT: it has same cycle sequence as FMODE=1 so nothing useful was lost)

I was expecting the same behavior as FMODE=1 but instead it does something very strange. I wonder if anyone found a creative use for whatever is happening.
Jobbo is offline  
Old 29 December 2020, 20:37   #9
ross
Defendit numerus

ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 52
Posts: 3,962
Quote:
Originally Posted by Toni Wilen View Post
DDFSTOP does not equal last fetch. (This is very common error, HRM does not explain it very well). After DDFSTOP has matched, there is always one more complete bitplane DMA "block" (all enabled planes fetched) before DMA stops.

End result can still be same even if value is technically wrong because there is 8/16/32 possible DDFSTOP values that have same result.
Toni, so what are the 'official' value for a 320px screen, FMODE=4x, DDFSTRT=$38? DDFSTOP work from $a0 (EDIT: actually $9a ) to $B8.
But I tend to use the value calculate with my simple formula, because that's what the system seems to use when generating copper lists...

Last edited by ross; 29 December 2020 at 20:56.
ross is offline  
Old 29 December 2020, 20:42   #10
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 48
Posts: 25,813
Quote:
Originally Posted by ross View Post
Toni, so what are the 'official' value for a 320px screen, FMODE=4, DDFSTRT=$38? DDFSTOP work from $a0 to $B8.
But a tend to use the value calculate with my simple formula, because that's what the system seems to use when generating copper lists...
Formula works because DDFSTOP "origin" is BPL1DAT write position but it is more like accidental side-effect

Quote:
Originally Posted by Jobbo View Post
I was expecting the same behavior as FMODE=1 but instead it does something very strange. I wonder if anyone found a creative use for whatever is happening.
More details here: http://eab.abime.net/showthread.php?t=86883
Toni Wilen is offline  
Old 29 December 2020, 21:01   #11
ross
Defendit numerus

ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 52
Posts: 3,962
Quote:
Originally Posted by Toni Wilen View Post
Formula works because DDFSTOP "origin" is BPL1DAT write position but it is more like accidental side-effect
ah, ok
However fortunately it is easy to be sure and check for a correct value.

In any case, there is values of all kinds in AGA productions, even absurd things corrected through the modulo and wasted dma fetches...
ross is offline  
Old 29 December 2020, 21:56   #12
Antiriad_UK
OCS forever!

Antiriad_UK's Avatar
 
Join Date: Mar 2019
Location: Birmingham, UK
Posts: 418
I've not done any AGA programming since coming back to Amiga but in my macros include from when I had my A1200 i'd set up these values. Can't remember if I got it out of some dodgy photocopy of the AGA spec I had or if something I just made up because it looked to work for OCS and AGA. It comes to $b8 for fmode=4x, 320px. What value does the OS use?

Code:
MEMORYFETCHMODE	equ	0		;0 (OCS),1 or 3 
	ifeq	MEMORYFETCHMODE
DDF_INCREMENT	equ	1
	else
DDF_INCREMENT	equ	(MEMORYFETCHMODE+1)&$fffe
	endif	

*************************************************************
DDF_START set $38
DDF_WORDWIDTH set 20
DDF_STOP set DDF_START+((DDF_WORDWIDTH-DDF_INCREMENT)*8)
Antiriad_UK is offline  
Old 29 December 2020, 22:16   #13
ross
Defendit numerus

ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 52
Posts: 3,962
Quote:
Originally Posted by Antiriad_UK View Post
DDF_STOP set DDF_START+((DDF_WORDWIDTH-DDF_INCREMENT)*8)
That is equivalent to the formula I've posted :

DDF_WORDWIDTH*16=px, DDF_INCREMENT*16=DMA_width
ross is offline  
Old 19 March 2023, 22:13   #14
Jobbo
Registered User

Jobbo's Avatar
 
Join Date: Jun 2020
Location: Druidia
Posts: 326
Sorry to resurrect this thread but I've been looking at this code again and wondering if HAM5 is even a problem for AGA.

I think I had assume it was because of earlier HAM7 trick tests. But I tried it in Winuae and it seems fine.

Before I delete my AGA specific code path can anyone confirm whether it's needed or not?

Thanks
Jobbo is offline  
Old 19 March 2023, 22:28   #15
ross
Defendit numerus

ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 52
Posts: 3,962
Yes, it should work fine.

I wrote inaccuracies.
See old message #2 and subsequent message for details..

The corner cases that I mentioned would foresee that HAM5 leaves the freedom to manually use BPL5DAT and that HAM could be usable with 5 bitlanes on AGA, which is not possible.
Sorry paraj, I dragged you into my mistake

Last edited by ross; 20 March 2023 at 07:25. Reason: I wrote inaccuracies...
ross is offline  
Old 19 March 2023, 22:53   #16
paraj
Registered User

 
Join Date: Feb 2017
Location: Denmark
Posts: 533
If you post a test executable I (or someone) else can try it out on on an A1200. If you avoid the corner cases that Ross mentions I don't see why it wouldn't work like on an ECS machine at least.
paraj is offline  
Old 19 March 2023, 23:35   #17
Jobbo
Registered User

Jobbo's Avatar
 
Join Date: Jun 2020
Location: Druidia
Posts: 326
Thanks. I’ll test on my 1200 to be sure. But seems like I just got confused at the time and then did a bunch of unnecessary work.
Jobbo is offline  
Old 20 March 2023, 00:36   #18
ross
Defendit numerus

ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 52
Posts: 3,962
Gah.., sorry.
I probably still mixed the HAM4+/7planes/OCS mode with the regular one.
In OCS/normal HAM the unused plane is automatically set to 0, so there is no corner cases (no weirdness with BPL6DAT).

To sum up:

OCS/ECS: HAM works at any bitplane depth.
- HAM4: both missing bitplane will be 0, so a 'regular' 16 colors mode
- HAM4+/7: 4 bitplanes for Agnus, 6 for Denise, so you can manually use BPL5DAT and BPL6DAT to make effects
- HAM5: the missing sixth bitplane will be 0, only blue color component can be modified
- HAM6: regular HAM

AGA:
- HAM bit enable HAM mode only in 6 or 8 bitplanes mode
- this means that to emulate HAM4+ and HAM5 modes you need to enable HAM with 6 bitplanes and let the DMA do a full data fetch (and 'emulate' the effect)

So yeah, you need a separate path in your code to handle the different chipsets.

If there is something more I will add a note

Last edited by ross; 20 March 2023 at 07:15. Reason: message that should clarify the various cases
ross is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Immediate Blitter & Wait for Blitter... volvo_0ne support.WinUAE 32 18 September 2022 09:52
FMODE 0 to FMODE 1 Auscoder Coders. Asm / Hardware 11 28 January 2020 16:37
DMA Time Slot Allocation / FMODE=1 Overrun ross Coders. Asm / Hardware 5 03 December 2017 17:06
FMODE=2 is useless? Toni Wilen Coders. Asm / Hardware 8 01 May 2017 22:07
Blitter busy flag with blitter DMA off? NorthWay Coders. Asm / Hardware 9 23 February 2014 21:05

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 05:56.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, vBulletin Solutions Inc.
Page generated in 0.09132 seconds with 13 queries