A.D.A. Amiga Demoscene Archive

        Welcome guest!

  

  

  

log in with SceneID

  

Demos Amiga Demoscene Archive Forum / Coding / AGA Blitting performance

 

Author Message
Agnus
Member
#1 - Posted: 8 Nov 2007 14:28 - Edited
Reply Quote
How fast is a plain PAL A1200 with 68020 and NO FASTRAM with Blitting on a LoRes-Screen in 8Bit when you move a block of 192x24 Pixel who used the whole Palette (around ~240 colors) really?
And additionally in every frame a masked Blit/operation is needed (because the background isnīt one colored but a still background-image who contains the same palette)

Are 50 FPS possible?

And what is the best strategy to get the fastest result?

Only Blitter?
Only CPU?
Combination of both?
Blueberry
Member
#2 - Posted: 9 Nov 2007 10:25
Reply Quote
Let's see...

You have (192+16)*24*8/16 = 2496 words to blit. With full masking the blitter uses 8 cycles per word, that is 19968 cycles. You will have to both clear the previous position (by copying in the background over it) and draw the new one, so be multiply by 1.5 (4 cycles per word for the copy) landing us at 29952 cycles.

The blitter runs at 7MHz, giving you around 140000 cycles per frame. So there should be plenty of time. Assuming of course that you use a reasonable fetch mode for the 8bpl screen so the screen DMA doesn't eat up all the blitter DMA bandwidth.

Beware of vblank synchronization when you do singe-buffered effects. If you are drawing on a full-height (256 pixels) screen and might be drawing anywhere on it, the clearing+drawing take a little too much time to fit completely into the vblank (313-256 = 57 scanlines = 25878 cycles), so in that case, you might have to start the blit at a different time depending on where you are drawing.

Though when you only draw 192 pixels in width, the blit should be progressing faster than the raster beam, so if you use interleaved bitplanes and draw using a single blit, you just have to start the blit before the beam reaches the top.
Agnus
Member
#3 - Posted: 15 Jan 2008 22:06
Reply Quote
WEll, I have some more questions: First: How to achieve a proper fetch mode for 8bit masked blits with an OS made screen? Are there any special screen mode properties? Second: How would you load the blitter registers for such a blit, if all bitmaps are interleaved (+mask)?

Do you have some example code using QBSBlit() with C?
Blueberry
Member
#4 - Posted: 20 Jan 2008 11:08
Reply Quote
On a system screen, the bitplane pointers can be read from screen->RastPort.BitMap->Planes[] and the number of bytes per row from screen->RastPort.BitMap->BytesPerRow. The bytes per row is the stride from the start of a scanline to the start of the next scanline in the same bitplane, so for an interleaved screen with 8 bitplanes, this value will be 8 times the actual bitplane bytes per row.

In order to obtain an interleaved system screen, you have to give the SA_Interleaved, TRUE tag to OpenScreenTags. The system does not guarantee that you get an interleaved screen back, though (if there is not enough contiguous chip ram, it will allocate each bitplane separately). You can check that the screen is interleaved by checking that the distance between the first two bitplane pointers is less than the BytesPerRow.

Blitting into an interleaved screen with 8 bitplanes is like blitting into a screen that is 8 times as high. For a masked blit, your mask has to be 8 times as high as well (you can of course have a different mask for each bitplane, but your palette has to be very special for that to make sense).

Suppose you have your image in an interleaved bitmap W words wide and H*8 pixels high (and your mask similarly). You want to place it so that the upper left corner of the image ends up at pixel position X,Y on the screen. For a standard masked, interleaved blit, the blitter registers will have to be set like this (where BytesPerRow is the value read from the OS BitMap structure):

A ptr: Address of the mask
B ptr: Address of the image to blit
C ptr: Address to the screen word containing the pixel where the upper left corner of the image should be placed. That is, Planes[0]+Y*BytesPerRow+(X/16)*2
D ptr: As C ptr
A modulo: -2
B modulo: -2
C modulo: BytesPerRow/8 - W*2 - 2
D modulo: As C modulo
A shift: X & 15
B shift: As A shift
A first word mask: $ffff
A last word mask: $0000
Minterms: $CA (cookie cut function: (B and A) or (C and not A))
Size: ((H*8) << 6) + (W+1) (H*8 pixels high, W+1 words wide)

Remember to set the size last, as setting this starts the blit.

So, if I haven't forgotten something, that should do the trick. :)

 

  Please log in to comment

  

  

  

 

A.D.A. Amiga Demoscene Archive, Version 3.0