gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > hardware doublebuffering for BG_BMP8_256X256

#75655 - GPFerror - Tue Mar 14, 2006 11:46 pm

anyone know how?

I tried to use the libnds doublebuffering example but its for BG_BMP16_256X256 and not BG_BMP8_256X256. And since you can't do 8bit writes to vram is there a solution ?

I know i can rendered to a buffer in main ram and dma/mem copy it to my video buffer. Looking for hardware doublebuffering though, not software doublebuffering.

Thanks,
Troy(GPF)
http://gpf.dcemu.co.uk

#75660 - tepples - Wed Mar 15, 2006 12:29 am

It depends on what you want your engine to do. If you have a need for constantly rewriting an 8-bit plane given the increased VRAM and hardware 3D capability of the Nintendo DS, we'll need to know what you want your engine to do so that we can help you design your engine so that it writes two pixels at a time.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#75666 - DekuTree64 - Wed Mar 15, 2006 12:49 am

For any game using software rendering, it would probably be best to turn on the cache/write buffer for your VRAM backbuffer. Faster, and lets you use 8-bit writes (since the CPU loads and stores full cache lines (32 bytes) at a time). Might be a nice feature for libnds to have a user-configurable protection region for such things.
_________________
___________
The best optimization is to do nothing at all.
Therefore a fully optimized program doesn't exist.
-Deku

#75786 - GPFerror - Wed Mar 15, 2006 11:52 pm

tepples wrote:
It depends on what you want your engine to do. If you have a need for constantly rewriting an 8-bit plane given the increased VRAM and hardware 3D capability of the Nintendo DS, we'll need to know what you want your engine to do so that we can help you design your engine so that it writes two pixels at a time.


just swapscreens as fast as possible, without the extra step of a copy.

in the libnds doublebuffering example.
Code:
        //swap
        u16* temp = frontBuffer;
        frontBuffer = backBuffer;
        backBuffer = temp;
       
        //flip
        //base is 16KB and screen size is 256x256x2 (128KB)
        BG3_CR ^= BG_BMP_BASE( 128 / 16 );


was curious if there was a way to do this in 8bit mode.

DekuTree64 wrote:
For any game using software rendering, it would probably be best to turn on the cache/write buffer for your VRAM backbuffer. Faster, and lets you use 8-bit writes (since the CPU loads and stores full cache lines (32 bytes) at a time). Might be a nice feature for libnds to have a user-configurable protection region for such things.


got an example that I can use untill its added :)

thanks,
Troy(GPF)

#75809 - tepples - Thu Mar 16, 2006 4:26 am

GPFerror wrote:
tepples wrote:
It depends on what you want your engine to do. If you have a need for constantly rewriting an 8-bit plane given the increased VRAM and hardware 3D capability of the Nintendo DS, we'll need to know what you want your engine to do so that we can help you design your engine so that it writes two pixels at a time.

just swapscreens as fast as possible, without the extra step of a copy.

I meant: What are you drawing on the screens?
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.