Page 1 of 1

Allocating space in Graphics card memory for DMA then Blt

Posted: Fri Jul 05, 2013 10:00 am
by Spirantho
Hi,

Thanks to Lyle, I've been able to do a bit more work on my AmiTV program again (I can now get interrupts working on one of my cards! Only one, but it's better than nothing!).

I want to add better support for drawing TV card output on graphics cards with no overlay. At the moment, the TV card DMAs its output into system memory, which is then copied into a bitmap (courtesy of P96LockBitMap() on the drawing window), and the BltBitMapRastPort() into the window's rastport.

This, as you can imagine, is very slow.

What I want to do is to have the TV card send its data into the graphics card memory itself, and then just BltBitMapRastPort or whatever straight into the window's display so that it draws it nicely.
The TV card gives me control over RGB formats and scaling and all that if I need it. The key point is - how should I allocate the memory on the graphics card for this purpose?

Any advice on this would be very gratefully received!

Thanks for an awesome forum (and OS) :)

Re: Allocating space in Graphics card memory for DMA then B

Posted: Fri Jul 05, 2013 11:31 am
by thomasrapp
I would first try to avoid LockBitMap. Have you tried to WritePixelArray directly from system memory into the window's RastPort?

Re: Allocating space in Graphics card memory for DMA then B

Posted: Fri Jul 05, 2013 12:11 pm
by Spirantho
I haven't tried that yet - I figured that locking the bitmap should be faster as I'd be accessing the memory as a block - but if WPA is more optimised it's worth trying.
I think the real bottleneck though may be getting the data across the PCI bus - especially as currently the TV card is filling the PCI bus with its own data. Can you WritePixelArray from video memory to the window's RastPort? I still need to get that video memory somehow though...

Thanks!

Re: Allocating space in Graphics card memory for DMA then B

Posted: Fri Jul 05, 2013 1:20 pm
by thomasrapp
I am not very experienced with speed opitmisation, but from what I read about LockBitMap, it is worth to avoid it. LockBitMap makes the raw bitmap data available in one continuous block for access by your program. In the worst case this might involve moving the bitmap from VRAM to system RAM which is the opposite of what you want to achieve.

Also from my experience LockBitMap in Picasso96 is a serious impact to the system. In CGX LockBitMap locks only the bitmap (probably through a semaphore). But in P96 LockBitMap locks the entire system (probably through Forbid).

Re: Allocating space in Graphics card memory for DMA then B

Posted: Fri Jul 05, 2013 1:35 pm
by Spirantho
OK, I'll try just using WPA then. If anyone can help with getting it kept in graphics memory, though, that may help as well! :)

Thanks for the help!