18 February 2020, 23:14 | #1 |
Registered User
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,409
|
CPU Assisted Blitting example + source
A while ago I had the idea to make the CPU and Blitter work together for blitting bobs on an unexpanded Amiga 1200. The idea being that the 32 bit access to chip memory of the 68020, coupled with the instruction cache might be capable of offering a boost in performance. Well, I've finally managed to get some time and managed to complete my example program.
And it works In short, using the Blitter and CPU together can give you a modest, but definetly notable, performance increase for blitting bobs. I've decided to create an example program to show this, as well as a YouTube video and an article for my website. Naturally, I've included the full source code and a download of the program itself on my website. I'm especially happy with how easy it is to use this (now that it all works) and that the effect doesn't usually require additional memory*. Note that my example uses the startup code by Photon of Scoopex and a random number generator I found on EAB, written by Meynaf. I hope this might be useful for Amiga coders aiming their code at the unexpanded A1200. The article/source can be found here: http://powerprograms.nl/amiga/cpu-blit-assist.html Here's the YouTube video: [ Show youtube player ] *) Extra memory is only needed for bobs that are not multiples of 32 pixels wide. Such bobs require one additional word of data stored per bitplane per line. Edit: in my haste to get this done yesterday, I forgot to mention in my post what the performance gain actually ended up being. While this can also be found in the article/video, I do think it's nice to add to my post. I ended up getting around 113% of the speed of using the Blitter by itself. Last edited by roondar; 19 February 2020 at 09:45. |
19 February 2020, 00:35 | #2 |
OCS forever!
Join Date: Mar 2019
Location: Birmingham, UK
Posts: 418
|
Neat. Thanks for the detailed write up!
|
19 February 2020, 01:56 | #3 |
Registered User
Join Date: Feb 2007
Location: Melbourne, Australia
Age: 41
Posts: 3,772
|
Very interesting. The only thing that I don't understand is why no one else thought of this. Maybe they did, and decided the added code complexity wasn't worth the increase in performance?
Good to finally put a face to your name too. Maybe I'll post a pic or video of me one day, you'll all get a big surprise if I do. |
19 February 2020, 09:43 | #4 | ||
Registered User
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,409
|
Your welcome!
Got more ideas yet, so there will be more Amiga Tech episodes in the future Quote:
And if you do target accelerated AGA Amigas, you're usually better off doing everything in fast memory and only copying the results to chip memory. Quote:
|
||
19 February 2020, 10:07 | #5 |
Registered User
Join Date: Oct 2017
Location: Sunderland, England
Posts: 2,702
|
As if you have read my mind roondar. I’m currently working on a bob routine for blitting objects into 6 bitplanes, the sizes vary.
What i would say is a more practical application for me would be to have the cpu blit one or two bitplanes where only a nand/or function is required as opposed to a cookie cut. The example i have is that i have a 16 colour 32x64 bob, blitting into a 6 bitplane screen, i only coolie cut the first 4 planes but then select 16 colour banks by nanding or or’ing the last two planes. I’ll be sure to try your theory out as it was on my ideas list for optimisation. Real nice work! Geezer |
19 February 2020, 10:15 | #6 | |
Lemon. / Core Design
Join Date: Mar 2016
Location: Tier 5
Posts: 1,211
|
Quote:
Even on the A500, you were / are always trying to maximise blitter and CPU concurrency... the classic example being the Blitter/CPU clear combo. |
|
19 February 2020, 10:19 | #7 | ||||
Registered User
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,409
|
Quote:
Quote:
This can be best seen in the speed of the copy (restore) routine vs the cookie-cut routine. The latter is actually more of a speedup over the Blitter than the copy routine (~115% vs ~110%), even though the copy routine is much simpler and is run with extra idle cycles for the CPU to use. Quote:
Quote:
|
||||
19 February 2020, 11:31 | #8 | |
Moderator
Join Date: Sep 2004
Location: France
Age: 50
Posts: 4,277
|
Quote:
An blitter interuption can be used to optimized usage of cpu and blitter. |
|
19 February 2020, 11:32 | #9 | |
Moderator
Join Date: Sep 2004
Location: France
Age: 50
Posts: 4,277
|
Quote:
An blitter interupt can be used to optimized usage of cpu and blitter. |
|
19 February 2020, 13:38 | #10 | ||
Registered User
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,409
|
Quote:
That said, I am completely unaware of coders using Blitter+CPU to draw bobs on the A1200. I did look for something like this on EAB and other places, but couldn't find it. I did find several threads/posts on Blitter queues, Blitter interrupts, etc. But those tended to be quite negative on the prospects of such methods actually ending up with a better performing game (other than in the case of Blitter clearing+CPU clearing, as you rightly point out). Do you know of any examples? I would love to see stuff like this in a "real" program rather than my tech demos/examples Quote:
In fact, this was of the reasons for me to do this. I've read a number of posts where coders point out it was quite difficult to keep the Blitter and CPU working concurrently in a useful fashion. At the same time, I've also read multiple times that using Blitter interrupts is not very efficient. My hope is that this method helps make it easier to get that extra efficiency |
||
19 February 2020, 14:39 | #11 | |
Moderator
Join Date: Sep 2004
Location: France
Age: 50
Posts: 4,277
|
Quote:
|
|
19 February 2020, 16:39 | #12 |
Registered User
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,409
|
|
19 February 2020, 16:48 | #13 |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
|
Kudos for article and video
|
19 February 2020, 17:01 | #14 |
Registered User
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,409
|
That reminds me... We had a small discussion over PM about some of the weirdness I ran into when making this. Might be interesting to share some of it with a wider audience now. I'll add a bonus item so you'll have something to read as well
So there were some issues I ran into while coding this:
Last edited by roondar; 19 February 2020 at 17:09. |
19 February 2020, 17:20 | #15 | |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
|
Item found
Quote:
If you look at my non-system FFS 020+ loader, you can see it used appropriately (maybe.. ). |
|
19 February 2020, 17:27 | #16 | |
Registered User
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,409
|
Quote:
Anyway, I don't think all code must be hyper-optimized, so there are surely places in which they are useful |
|
19 February 2020, 17:32 | #17 | ||
Registered User
Join Date: Dec 2014
Location: germany
Posts: 439
|
Quote:
Quote:
|
||
19 February 2020, 17:45 | #18 |
Registered User
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,409
|
That's quite interesting. Normally not all that important I guess, but the A1200 has quite slow memory and running the Blitter makes it even slower (from the perspective of the CPU), so I guess it all adds up.
|
19 February 2020, 19:23 | #19 |
Registered User
Join Date: Feb 2011
Location: Italy/Rome
Posts: 2,281
|
You can even skip screens' restore for bob that don't overlap, so you can gaing a lot speed
|
19 February 2020, 20:37 | #20 |
Phone Homer
Join Date: Jun 2006
Location: 5150
Posts: 5,773
|
Interesting there was something for Amos called PowerBobs that I believe is along the same lines.
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Selling A3660 CPU card, including Rev 5 CPU - NEW - professionally built | tbtorro | MarketPlace | 1 | 17 June 2018 19:14 |
Blitting one bitplane | Shatterhand | Coders. Blitz Basic | 13 | 01 February 2017 16:13 |
Problem with blitting.... | xboxown | Coders. Language | 0 | 09 March 2014 21:51 |
Source for A4000D CPU card plastic standoffs | alexh | support.Hardware | 38 | 12 June 2011 19:15 |
Blitting question | sandruzzo | Coders. General | 30 | 06 April 2011 11:29 |
|
|