English Amiga Board


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

 
 
Thread Tools
Old 29 November 2017, 21:52   #21
ross
Defendit numerus
 
ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,476
Quote:
Originally Posted by dissident View Post
Just check my copper-demo
Yeah, I know your demo
Absolutely a copper usage masterpiece (is the AGA counterpart of Angels Copper Master).

Thanks for the detailed response.

ross is offline  
Old 30 November 2017, 20:03   #22
Emufr3ak
Registered User
 
Join Date: Mar 2016
Location: Thun / Switzerland
Posts: 57
Quote:
Originally Posted by Toni Wilen View Post
There is not much gained by running CPU and blitter simultaneously if blitter cycle sequence does not have any idle cycles (which are always available for the CPU. Don't waste them!). In no-idle-cycle case CPU is immediately (technically after 2 or 3 cycles) blocked until blitter finishes.

IMHO it is practically only useful when clearing (every other blitter cycle is idle cycle) or D=A filling (every 3rd cycle is idle cycle). All other common channel combinations don't have idle cycles.

Only exception is if code is running in real fast ram. (or blitter nasty not set but why would you do that in a demo or game?)
Is this also true for Amiga 1200? Or does the faster CPU make a difference there?
Emufr3ak is offline  
Old 01 December 2017, 13:09   #23
Kalms
Registered User
 
Join Date: Nov 2006
Location: Stockholm, Sweden
Posts: 237
Quote:
Originally Posted by phx View Post
I would really prefer when the game engine, which renders the frames, runs in an interrupt, triggered by VERTB. This way I have a kind of multitasking and let the "main program" do tasks which are not VERTB-synced, like reading data from the disk.
Side note, I implemented a thread switcher with the intent of supporting a small number of parallel threads ("track loading from disc", "MFM decoding", "decompression", "realtime graphics") and push as much logic as possible out of the interrupt handlers. Source code here.

The homemade threading solution was reasonably efficient for all types of threading transitions except for when an interrupt wakes up another thread (timings at the bottom of the page). It was difficult to write and mistakes when using it results in hard-to-debug deadlocks... so all in all I cannot really recommend using it. Was good to get an understanding of what sort of performance can be expected from a thread switcher.

It is possible to speed up the context switches triggered within interrupts further, but that involves rather intricate engineering.
Kalms is offline  
Old 01 December 2017, 13:35   #24
ross
Defendit numerus
 
ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,476
Quote:
Originally Posted by Kalms View Post
Side note, I implemented a thread switcher with the intent of supporting a small number of parallel threads ("track loading from disc", "MFM decoding", "decompression", "realtime graphics") and push as much logic as possible out of the interrupt handlers.
..
Was good to get an understanding of what sort of performance can be expected from a thread switcher.
This is exactly what i'm talking about!
When I have time I will inspect your code to see if I can use it for my purposes
(logically I will publish any valuable variation).

EDIT:
Quote:
It is possible to speed up the context switches triggered within interrupts further, but that involves rather intricate engineering.
Yes, my idea is to reduce context register saving, using a "maximum" of numbered tasks, everyone working in different IRQ level (plus user mode).
IRQ levels forced by a master (VBL?) that steer other sub-levels.

Thanks!

Last edited by ross; 01 December 2017 at 13:46.
ross is offline  
Old 01 December 2017, 14:01   #25
ross
Defendit numerus
 
ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,476
Draft:

Code:
EXTER	Level 6 External interrupt (free from control, music routine, timed fast execution)
DSKSYN	Level 5 Disk Sync value found (catched, support to disk routine for read error)
AUDx	Level 4 Audio Interrupt (free, unused) 
VERTB	Level 3 Vertical Blank Interrupt (master, some scattered MFM decoding)
PORTS	Level 2 CIA Interrupt (double: forced, user code, high priority, semaphored; CIA timed routine)
SOFT	Level 1 Software Interrupt (forced, user code, normal priority, depack routine)
USER	Level 0 User Mode (user code, low priority, pre-calc, synthetic audio sample generation)
Written in hurry

Last edited by ross; 01 December 2017 at 14:52.
ross is offline  
Old 01 December 2017, 20:12   #26
dissident
Registered User
 
Join Date: Sep 2015
Location: Germany
Posts: 260
Quote:
Originally Posted by Toni Wilen View Post
IMHO it is practically only useful when clearing (every other blitter cycle is idle cycle) or D=A filling (every 3rd cycle is idle cycle). All other common channel combinations don't have idle cycles.
I guess you refer to the blitter cycle sequence table 6-2 of the HRM http://amigadev.elowar.com/read/ADCD.../node0127.html

Right?
dissident is offline  
Old 01 December 2017, 20:16   #27
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,526
Quote:
Originally Posted by dissident View Post
I guess you refer to the blitter cycle sequence table 6-2 of the HRM http://amigadev.elowar.com/read/ADCD.../node0127.html
Yes and no. It is correct in non-fill cases but it does not mention that some fill channel combinations add extra idle cycle (for example commonly used D=A takes in fill mode 3 cycles, A read, one idle and D write)

Interestingly enough first HRM revision had more complete table and included this special case. Later editions removed it.
Toni Wilen is offline  
Old 01 December 2017, 20:28   #28
dissident
Registered User
 
Join Date: Sep 2015
Location: Germany
Posts: 260
Quote:
Originally Posted by ross View Post
Yeah, I know your demo
Absolutely a copper usage masterpiece (is the AGA counterpart of Angels Copper Master).

Thanks for the detailed response.

It was a pleasure to me. And thanks for the praise. Yes, I remember that in a different thread you already mentioned you know my copper demo. I'm getting old.
dissident is offline  
Old 01 December 2017, 20:34   #29
dissident
Registered User
 
Join Date: Sep 2015
Location: Germany
Posts: 260
Quote:
Originally Posted by ross View Post
Yes, my idea is to reduce context register saving, using a "maximum" of numbered tasks, everyone working in different IRQ level (plus user mode).
IRQ levels forced by a master (VBL?) that steer other sub-levels.
Just like the OS where the VBI steers the system multitasking. Sounds good.
dissident is offline  
Old 01 December 2017, 20:52   #30
dissident
Registered User
 
Join Date: Sep 2015
Location: Germany
Posts: 260
Quote:
Originally Posted by Toni Wilen View Post
Yes and no. It is correct in non-fill cases but it does not mention that some fill channel combinations add extra idle cycle (for example commonly used D=A takes in fill mode 3 cycles, A read, one idle and D write)

Interestingly enough first HRM revision had more complete table and included this special case. Later editions removed it.
I guess I found this first HRM revision here https://archive.org/stream/Amiga_Har.../n189/mode/2up but to me this table is not extended or different.
dissident is offline  
Old 01 December 2017, 20:57   #31
dissident
Registered User
 
Join Date: Sep 2015
Location: Germany
Posts: 260
Quote:
Originally Posted by ross View Post
Draft:

Code:
EXTER    Level 6 External interrupt (free from control, music routine, timed fast execution)
DSKSYN    Level 5 Disk Sync value found (catched, support to disk routine for read error)
AUDx    Level 4 Audio Interrupt (free, unused) 
VERTB    Level 3 Vertical Blank Interrupt (master, some scattered MFM decoding)
PORTS    Level 2 CIA Interrupt (double: forced, user code, high priority, semaphored; CIA timed routine)
SOFT    Level 1 Software Interrupt (forced, user code, normal priority, depack routine)
USER    Level 0 User Mode (user code, low priority, pre-calc, synthetic audio sample generation)
Written in hurry
Or more detailed here: http://amigadev.elowar.com/read/ADCD.../node016F.html
dissident is offline  
Old 01 December 2017, 21:26   #32
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,526
Quote:
Originally Posted by dissident View Post
I guess I found this first HRM revision here https://archive.org/stream/Amiga_Har.../n189/mode/2up but to me this table is not extended or different.
It is not old enough. This one: http://www.bombjack.org/amiga/amiga-books.htm (276 page "Amiga Hardware Manual")
Toni Wilen is offline  
Old 03 December 2017, 11:34   #33
dissident
Registered User
 
Join Date: Sep 2015
Location: Germany
Posts: 260
Quote:
Originally Posted by Toni Wilen View Post
It is not old enough. This one: http://www.bombjack.org/amiga/amiga-books.htm (276 page "Amiga Hardware Manual")
Not quite. I've checked it. The "Blitter Cycle Sequence"-table (and some other chapters) are missing in the original "Amiga Hardware Manual" and can be found in the "Amiga Hardware Manual Errata", same link as mentioned above.
Anyway a very interesting site with lots of good amiga books for downloading. Many thanks, Toni.
dissident is offline  
Old 30 September 2021, 03:48   #34
Jobbo
Registered User
 
Jobbo's Avatar
 
Join Date: Jun 2020
Location: Druidia
Posts: 389
Hi

I'm resurrecting this thread because I'm looking to do something alone similar lines.

I have a background thread that's busy doing work as fast as possible.
I also have a frame update thread called from the vertb handler.
The copper is pretty busy so I don't want to use that for blits.
What I'd like is for the frame update to start a queue of blits, which will be continued by a handler each time the blitter finishes, leaving the frame update to do it's thing.

Anyway the suggested method seems to be to put the frame update inside a soft interrupt handler so this frees up the level-3 handler for repondsing to the blitter interrupts.

My main question is if this seems like the most reasonable approach, and if that has been successful for others? I'll certainly give it a try but wanted to hear if anyone run into trouble?

Thanks
Jobbo is offline  
Old 01 October 2021, 12:40   #35
Antiriad_UK
OCS forever!
 
Antiriad_UK's Avatar
 
Join Date: Mar 2019
Location: Birmingham, UK
Posts: 418
Quote:
Originally Posted by Jobbo View Post
Hi

I'm resurrecting this thread because I'm looking to do something alone similar lines.

I have a background thread that's busy doing work as fast as possible.
I also have a frame update thread called from the vertb handler.
The copper is pretty busy so I don't want to use that for blits.
What I'd like is for the frame update to start a queue of blits, which will be continued by a handler each time the blitter finishes, leaving the frame update to do it's thing.

Anyway the suggested method seems to be to put the frame update inside a soft interrupt handler so this frees up the level-3 handler for repondsing to the blitter interrupts.

My main question is if this seems like the most reasonable approach, and if that has been successful for others? I'll certainly give it a try but wanted to hear if anyone run into trouble?

Thanks
There's a thread somewhere on here where I did 3 different approaches for blitting bobs (copper, interrupt, "normal"). And that used a soft int for the main work and blit queue interrupt on lev 3. Worked fine. I thought I'd put the code on github but can't find it. You're welcome to it if I dig it out.

My current framework is mostly lev1 soft int and the copper triggering the lev 1 so that if I ever want to add some blit queue stuff I don't have to redesign.
Antiriad_UK is offline  
Old 01 October 2021, 15:08   #36
Jobbo
Registered User
 
Jobbo's Avatar
 
Join Date: Jun 2020
Location: Druidia
Posts: 389
Thanks, I mostly wanted to hear if anyone ran into problems or had better suggestions.

I successfully got my own version working.

I moved the frame update loop into a level 1 handler which I trigger from the level 3 handler when there's a vertb interrupt. My level 3 handler then also responds to blit interrupts.

This means my frame update loop can queue up blits and keep going. Meanwhile in the background I can do whatever processing I need that isn't part of the frame update and the copper can also do whatever I want without the complexity of interleaving blits.

For my particular case this is exactly what I need. The level 1 set up seems to be the most straight forward and stable solution for getting there.

I've seen some other suggestions, such as handling nested interrupts but that didn't sound nearly as simple.

I'm not really sure if I'm missing some downside with this level 1 approach, other than it's tricky to get it working at first! I spent quite a while confused by deadlocks and/or run away blits.
Jobbo is offline  
Old 01 October 2021, 19:09   #37
defor
Registered User
 
Join Date: Jun 2020
Location: Brno
Posts: 90
Out of curiosity. Is there any need to have the main loop in the supervisor mode (lev1 interrupt)? Isn't it unnecessary to spend 20+ CPU cycles just to go inside supervisor and (another cycles) to go back? I get the concept of Blitter job queue and hence the lev3 interrupt handler (I guess it's mainly usable for large blits only), but the main loop? Although I guess some interrupt handler (vblank or soft-int triggered by Copper) is always handy if one needs to count frames.

Last edited by defor; 01 October 2021 at 22:30.
defor is offline  
Old 01 October 2021, 19:25   #38
Jobbo
Registered User
 
Jobbo's Avatar
 
Join Date: Jun 2020
Location: Druidia
Posts: 389
My render update is in the interrupt handler because the main user mode code needs to churn through other work that isn't easily divided up each frame.

Currently I'm triggering a soft interrupt from the vertb interrupt handler, which is double the cost.

I hadn't considered triggering the soft interrupt using the copper, will have to check if that's possible?
Jobbo is offline  
Old 01 October 2021, 19:54   #39
defor
Registered User
 
Join Date: Jun 2020
Location: Brno
Posts: 90
Quote:
Originally Posted by Jobbo View Post
I hadn't considered triggering the soft interrupt using the copper, will have to check if that's possible?
It's quite common.
defor 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
Q: Copper Interrupt Herpes Coders. Asm / Hardware 3 25 April 2016 13:31
Trigger level 7 interrupt geir support.FS-UAE 2 15 August 2015 22:45
Interrupt 7 BigT support.WinUAE 2 07 September 2013 22:25
level 7 interrupt on A600 xc8 Hardware mods 1 26 October 2008 14:53
Level 7 interrupt Kintaro support.WinUAE 1 21 January 2004 17:31

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 11:00.

Top

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