Raspberry Pi Bare Metal - Double Buffering???
Posted: Tue May 28, 2013 12:32 pm
Hi,
I've looked at the available (and limited) information for using the Mailbox to output graphics to the screen, and even though I've not yet implemented anything, I see a potential problem...
I'm aiming to develop a basic system, called RetrOS, which will allow retro games to be played and programmed (via an interpreter, RetroBASIC) on the Raspberry Pi. The only thing is, to do this it would be ideal if I could implement double-buffering. From what I've read however, I couldn't simply draw my graphics to a certain portion of memory and update a pointer to point to that area of memory, as the GPU decides the location of the buffer itself; the only way I'll be able to achieve double-buffering is to copy the data from a back buffer to the front buffer.
The question is, how can I do this quickly? I'm a bit of a n00b when it comes to the Pi, but from what I've read it looks like DMA is going to be the way forward. Basically, I'll get my front buffer's address by using the Mailbox, then I'll set up a back buffer somewhere else in memory, draw to it, then when I'm finished drawing I'll use DMA to copy the contents of the back buffer to the front buffer. Does this sound a sensible way forward (if it's even plausible)?
Thanks in advance!
I've looked at the available (and limited) information for using the Mailbox to output graphics to the screen, and even though I've not yet implemented anything, I see a potential problem...
I'm aiming to develop a basic system, called RetrOS, which will allow retro games to be played and programmed (via an interpreter, RetroBASIC) on the Raspberry Pi. The only thing is, to do this it would be ideal if I could implement double-buffering. From what I've read however, I couldn't simply draw my graphics to a certain portion of memory and update a pointer to point to that area of memory, as the GPU decides the location of the buffer itself; the only way I'll be able to achieve double-buffering is to copy the data from a back buffer to the front buffer.
The question is, how can I do this quickly? I'm a bit of a n00b when it comes to the Pi, but from what I've read it looks like DMA is going to be the way forward. Basically, I'll get my front buffer's address by using the Mailbox, then I'll set up a back buffer somewhere else in memory, draw to it, then when I'm finished drawing I'll use DMA to copy the contents of the back buffer to the front buffer. Does this sound a sensible way forward (if it's even plausible)?
Thanks in advance!