storing stuff in unused pvr memory

If you have any questions on programming, this is the place to ask them, whether you're a newbie or an experienced programmer. Discussion on programming in general is also welcome. We will help you with programming homework, but we will not do your work for you! Any porting requests must be made in Developmental Ideas.
Post Reply
GPF
DC Developer
DC Developer
Posts: 529
https://www.artistsworkshop.eu/meble-kuchenne-na-wymiar-warszawa-gdzie-zamowic/
Joined: Wed Oct 17, 2001 7:44 pm
Location: Texas
Has thanked: 0
Been thanked: 0
Contact:

storing stuff in unused pvr memory

Post by GPF »

how would I store something in unused pvr memory, untill i needed it?

thanks,
Troy(GPF)
http://gpf.dcemu.co.uk
BlackAura
DC Developer
DC Developer
Posts: 9951
Joined: Sun Dec 30, 2001 9:02 am
Has thanked: 0
Been thanked: 1 time

Post by BlackAura »

If you're using the PVR for rendering, you can just allocate a chunk of memory like so:

Code: Select all

pvr_ptr_t pvr_mem_handle =  pvr_mem_malloc(size);
void *pointer = (void *)pvr_mem_handle;
memcpy(pointer, source, size);
To get it back, just copy it back again:

Code: Select all

memcpy(dest, pointer, size);
You could also use store queues (or DMA, if the data's just laying around in main memory already) to copy the data to VRAM, and I think you could probably use DMA to transfer it back as long as you remember to flush the data cache over the area you copied it back to.

If you're not using the PVR (you're just using the framebuffer), there's no need to use pvr_mem_malloc. Just grab a pointer to the framebuffer (vram_s works nicely), add the size of the framebuffer, and use that.
Post Reply