Welcome, Guest. Please login or register.

Author Topic: Tales from an AmigaOS 4.1 Developer…  (Read 5366 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline ArgoTopic starter

  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 3219
    • Show only replies by Argo
Tales from an AmigaOS 4.1 Developer…
« on: June 08, 2011, 07:01:31 AM »
From the Hyperion Entertainment Blog:

Quote
In the words of Dr. Nick, "Hello everybody!"...

I suppose I better start by introducing myself.  My name is Karl Churchill whom you may know as Karlos from one or more of the various Amiga forums.  I've been an Amiga enthusiast since I first had a go of a friend's A500 back in 1988.  I didn't actually own one until 1992, but from then on, I've not been without one.  I've been asked to write a few words about my involvement with OS4.1 for classic.  Well, there's the short version and the long version.  The short version is that I've been working as a contributor to add Warp3D support for the Permedia2.  Work began in October last year as an evening project.
The version of the driver in the repository had not been touched in the best part of a decade and whilst it compiled, that was all it did.   Any attempt to launch a 3D application would simply freeze the machine.   The first challenge was to get it to a point where it would at least allow an application to start, even if it didn't render anything.  Working on low-level code is not without it's complications.  Thankfully, the kernel provides a debug printing service but I don't have a serial line debugger (the serial port on that machine is not entirely reliable) so every time there was a crash, I'd have to reboot and run DumpDebugBuffer to see what had blown up.  Progress was slow at first, but eventually I was rewarded with a blank screen and not a DSI.  

Over the following months I got all the basic drawing routines up and running, starting with the basic V1-V3 API calls.  Along the way, I found some amusing undocumented bugs in the Permedia2 that were the cause of a lot of head scratching and finally I got up to the point where I could implement the V4 API.  This is where everything changes and is a good time to start the "long" version of the story... as if this one wasn't long enough already!
Back in 2001 or so, I was developing my own applications that were using Warp3D as an "advanced rasterizer" for 2D.  If you've ever used RTG as a developer on OS3.x, you'll doubtless be as dismayed as I was with the extent of it's hardware acceleration.   The functions provided by Warp3D were much more capable and efficient for 2D graphics work. Warp3D 4 was released and introduced it's vertex array functions.  For what I was doing at the time, these were perfect.  I refactored my code to use them and then discovered to my dismay that various chunks of the advertised API just weren't implemented by the driver, especially line and point rendering.

I badgered Hyperion about this at the time who were busy with other things but responded by giving me access to the source. It's fair to say that after a few months, I had the only driver that implemented every drawing operation the API specified.  The original V4 functions used templates (i.e. C macros) to generate a drawing function for each possible combination of primitive and supported vertex format.  Conceptually, this is the most efficient way of doing it but in reality it produces a lot of code which is mostly redundant and not cache friendly. After adding the extra primitives, the driver had reached an unprecedented size (well over 1MB) which was clearly too big.  The only thing that actually varied from one format to the next is the way in which the vertex data was fetched.  So, I scrapped the existing code and started a new version that has drawing routines for each primitive, but uses a function pointer to invoke a fetcher that is specific to the format being used.  The code was well within acceptable size again and ran considerably faster despite having to make up to 3 indirect function calls per vertex (one for geometry, one for colour and one for texture/fog).

I went on to fine tune this implementation by adding versions of the fetchers that were not only specific to the vertex format but also the currently selected states.  This moves a lot of state-dependent conditional logic out of the fetch routine and as they represent the innermost level of the code, that's always a good thing.  Eventually, some of theV4 routines were over 2x faster than the original version, depending on the vertex format and state.  Unfortunately, this driver never found it's way into the wild.  Mostly because I never considered it finished it due to the constant need to tweak and improve it; there was always some new experiment to try.  DMA FIFO transport is still "the one that got away" but I've promised to behave and actually release versions this time.  The vertex fetch idea caught on though and became the standard method used for all later drivers, so at least the work wasn't entirely wasted.  I was later asked if I'd be interested in making an OS4.0 version of it.  Seeing as this meant I'd get to play with something new on my A1200 (the then upcoming OS4.0 classic), I naturally agreed and having got the beta version on my machine started work on it.  Classic 4.0 was very much in beta at that time and I ran into a lot of issues just running it, development using it was even trickier.  Then life took a series of increasingly difficult turns which ultimately left me out of the scene for many years.  OS4.0 for the classic came and went in the meantime.  I had thought things had hit an inflection point when a close uncle passed away suddenly but things reached a new low in 2007 when my mother was diagnosed with a life-limiting illness and passed away just two short years later in the spring of 2009.  She was not to be the last.  By the end of that year, I felt I needed to get back into my hobbies, doing something, anything, would be therapeutic.

So I bought OS4.1 for the inherited A1 that was sat under my desk for about 4 years unused to see how things had moved on since my early experiences with 4.0 beta for the Classic.  Quite a bit, as it happens.  As I got back into it, I got the SDK and started playing about with some code.  And that's where the long and the even longer versions of the story recombine. This time I have a nice stable machine to do the actual compilation on, which has helped considerably. The present driver for 4.1 has incorporated all the fundamental changes the unreleased v4 driver had and then some; even the old V1-V3 drawing routines now use a set of vertex fetchers, all designed around W3D_Vertex, but optimised for each state combination that has an effect on their operation. The FIFO code has been completely rewritten, as has the state handling. Finally there is as much support as is feasible for the V5 API. Unique challenges this time around are trying to appease some old applications that did naughty things (like poking the context instead of making the proper API calls) without sacrificing too much performance and trying to track down some really persistent bugs. The latter has led to having to work through the main library and even the RTG driver. It's a frustrating task a lot of the time; you think you nailed a bug, only to discover the "it works for me" phenomenon is genuinely real and the same bug is still affecting other users.  So, back to the drawing board.  Still, seeing Quake3 run on my 20-year old A1200 was fun enough to make it worthwhile.

So, the Permedia2 driver is still in development and won't be considered final until the various bugs are ironed out.  In a case of history repeating itself, I also noticed that the R200 driver doesn't draw everything advertised in the API either. I guess I'll have to look into that one next...

http://blog.hyperion-entertainment.biz/?p=439
« Last Edit: June 08, 2011, 12:49:10 PM by SysAdmin »
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16867
  • Country: gb
  • Thanked: 4 times
    • Show only replies by Karlos
Re: Tales from an AmigaOS 4.1 Developer…
« Reply #1 on: June 08, 2011, 07:55:45 AM »
TL;DR :lol:
int p; // A
 

Offline magnetic

  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 2531
    • Show only replies by magnetic
Re: Tales from an AmigaOS 4.1 Developer…
« Reply #2 on: June 08, 2011, 10:39:50 AM »
Karlos

GOGOGOGGOGOGOGGOGO!!!! :)
bPlan Pegasos2 G4@1ghz
Quad Boot:Reg. MorphOS | OS4.1 U4 |Ubuntu GNU-Linux | MacOS X

Amiga 2000 Rom Switcher w/ 3.1 + 1.3 | HardFrame SCSI | CBM Ram board| A Squared LIVE! 2000 | Vlab Motion | Firecracker 24 gfx

Commodore CDTV: 68010 | ECS | 9mb Ram | SCSI -TV | 3.9 Rom | Developer EPROMs
 

Offline nicholas

Re: Tales from an AmigaOS 4.1 Developer…
« Reply #3 on: June 08, 2011, 12:11:48 PM »
Woohoo you're out of the proverbial closet now, prepared for the back lash? ;)
“Een rezhim-i eshghalgar-i Quds bayad az sahneh-i ruzgar mahv shaved.” - Imam Ayatollah Sayyed  Ruhollah Khomeini
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16867
  • Country: gb
  • Thanked: 4 times
    • Show only replies by Karlos
Re: Tales from an AmigaOS 4.1 Developer…
« Reply #4 on: June 08, 2011, 01:13:10 PM »
Quote from: nicholas;643453
Woohoo you're out of the proverbial closet now, prepared for the back lash? ;)


I don't think it was much of a secret, was it?
int p; // A
 

Offline jj

  • Lifetime Member
  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 4051
  • Country: wales
  • Thanked: 2 times
  • Gender: Male
    • Show only replies by jj
Re: Tales from an AmigaOS 4.1 Developer…
« Reply #5 on: June 08, 2011, 01:33:28 PM »
Cant believe you do AOS4.1 Coding.
 
MorphOS is the only AmigaNG OS worht bothering with.
 
Im taking you off my friends list :)
“We don't stop playing because we grow old; we grow old because we stop playing.” - George Bernard Shaw

Xbox Live: S0ulA55a551n2
 
Registered MorphsOS 3.13 user on Powerbook G4 15"
 

Offline jorkany

  • Hero Member
  • *****
  • Join Date: Sep 2006
  • Posts: 1009
    • Show only replies by jorkany
    • http://www.amigaos4.com
Re: Tales from an AmigaOS 4.1 Developer…
« Reply #6 on: June 08, 2011, 02:35:06 PM »
While I think Karlos is wasting his time and talent on OS4, I do have to say that if the majority of the OS4 community and dev team were more like Karlos that would go a long way towards making OS4 less unattractive.
 

Offline Franko

  • Hero Member
  • *****
  • Join Date: Jun 2010
  • Posts: 5707
    • Show only replies by Franko
Re: Tales from an AmigaOS 4.1 Developer…
« Reply #7 on: June 08, 2011, 04:47:23 PM »
Ahh Haa... so that explains the reason why Karlos always get very defensive about OS4 whenever I say it's slower than a dead donkey... ;)

and here was me thinking he was just a deluded OS4 fanatic... :)
 

Offline nyteschayde

  • VIP / Donor - Lifetime Member
  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 643
    • Show only replies by nyteschayde
    • http://www.nyteshade.com
Re: Tales from an AmigaOS 4.1 Developer…
« Reply #8 on: June 08, 2011, 05:15:17 PM »
Grats Karlos! I've had some long development conversations with Karlos. He really is an amazing developer. I get paid very well for being a software engineer but talking with him usually leaves me feeling dumb. I wish you the best man!
Senior MTS Software Engineer with PayPal
Amigas: A1200T 060/603e PPC • A1200T 060 • A4000D 040 • A3000 (x2) • A2000 Vamp/V2 • A1200 (x4) • A1000 (x3) • A600 Vamp/V1 • A500
 

Offline TheBilgeRat

  • Hero Member
  • *****
  • Join Date: May 2010
  • Posts: 1657
    • Show only replies by TheBilgeRat
Re: Tales from an AmigaOS 4.1 Developer…
« Reply #9 on: June 08, 2011, 05:16:42 PM »
Quote from: Karlos;643432
TL;DR :lol:


Beat me to it :lol:
 

Offline TheGoose

  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 1458
  • Country: us
  • Gender: Male
    • Show only replies by TheGoose
    • http://www.amiga.org/forums/blog.php?u=827
Re: Tales from an AmigaOS 4.1 Developer…
« Reply #10 on: June 08, 2011, 05:28:57 PM »
Quote from: Karlos;643458
I don't think it was much of a secret, was it?


I just thought you had no life and hung out here all day. Now, I think wow, that guy does a lot and I need to get a life...

:lol:
G1200, A3000D, A1200 PPC AOS4.0C

I\'m on Google +
 

Offline lionstorm

Re: Tales from an AmigaOS 4.1 Developer.
« Reply #11 on: June 08, 2011, 06:28:16 PM »
nice read, thanks Karlos !

will the new warpd3D version and new permedia2 driver be released only for AOS4 or will classic warpos will also benefit from your expertise ?
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16867
  • Country: gb
  • Thanked: 4 times
    • Show only replies by Karlos
Re: Tales from an AmigaOS 4.1 Developer.
« Reply #12 on: June 08, 2011, 08:30:21 PM »
Quote from: lionstorm;643546
nice read, thanks Karlos !

will the new warpd3D version and new permedia2 driver be released only for AOS4 or will classic warpos will also benefit from your expertise ?


Well, the current driver is for OS4.1, but I can't really see any technical reasons why it won't run on 4.0.

As for OS3.x/WarpOS, I have an unreleased driver from way back when. It's not quite as developed as the current one, but it was fundamentally the starting point for the big refactor that led to the performance gains for vertex array drawing.

However, it isn't as compatible with existing software as the original 4.2 driver. The present driver likewise has problems. Certain applications don't play nice with Warp3D, calling functions with broken arguments or just poking internal structures directly.

I am not sure what the deal is with that. I signed the necessary NDA at the time to be able to work on it but releases aren't up to me and Warp3D 4 is no longer supported. I could always ask though.
int p; // A
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16867
  • Country: gb
  • Thanked: 4 times
    • Show only replies by Karlos
Re: Tales from an AmigaOS 4.1 Developer…
« Reply #13 on: June 08, 2011, 08:34:23 PM »
Quote from: JJ;643461
Cant believe you do AOS4.1 Coding.


Well, we all have our vices. I'm a total amiga slut; I'll happily do red, blue, black and the original all in the same night and I'm still back by morning :lol:
 
Quote
MorphOS is the only AmigaNG OS worht bothering with.
 
Im taking you off my friends list :)


I wanted to get a decent spec PPC mac for that but the missus is likely to slay me in cold blood if I get one more machine :(
int p; // A
 

Offline klx300r

  • Amiga 1000+AmigaOne X1000
  • Hero Member
  • *****
  • Join Date: Sep 2007
  • Posts: 3246
  • Country: ca
  • Thanked: 20 times
  • Gender: Male
    • Show only replies by klx300r
    • http://mancave-ramblings.blogspot.ca/
Re: Tales from an AmigaOS 4.1 Developer…
« Reply #14 on: June 08, 2011, 10:27:10 PM »
Quote from: Karlos;643458
I don't think it was much of a secret, was it?

nah..too many hints over the years..thanks for the driver work mate!...so do tell when are we getting update 3 huh mr. OS4.1 developer:D

Quote from: Karlos;643584
I wanted to get a decent spec PPC mac for that but the missus is likely to slay me in cold blood if I get one more machine :(

ya of course but she does know that there's room for the new X1000 right;)..I mean the A1XE in your sig needs a new replacement soon :)
____________________________________________________________________
c64-dual sids, A1000, A1200-060@50, A4000-CSMKIII
Indivision AGA & Catweasel MK4+= Amazing
! My Master Miggies-Amiga 1000 & AmigaOne X1000 !
--- www.mancave-ramblings.blogspot.ca ---
  -AspireOS.com & Amikit- Amiga for your netbook-
***X1000- I BELIEVE *** :angel: