Alright Ive just now got around to testing the PVR DMA transfers.BB Hood wrote:Probably should have told you that in the beginning: viewtopic.php?p=1009854#p1009854
Did you do any DMA stuff yet?
Here is a test I have made that decodes a Png texture and transfers to PVR using DMA:
http://www.megaupload.com/?d=67C2LYOR
Can anyone confirm this is the correct usage?
Here is the main bit, the full source is included in the link above:
Code: Select all
#include <dc/pvr.h>
#include <dc/video.h>
#include <malloc.h>
#include <png/png.h>
#include <zlib/zlib.h>
#define PVR_TEX_WIDTH 1024
#define PVR_TEX_HEIGHT 512
// PVR VRMA / DMA Pointers
pvr_ptr_t * pvr_vram_buffer;
ptr_t pvr_dma_cbdata;
pvr_dma_callback_t pvr_dma_callback;
// Decode A PNG texture from /cd/ into RAM, then transfer to VRAM using PVR DMA
static int png_load( char * file_name ) {
// allocate memory to contain the decoded PNG texture; 32-byte aligned
uint32 * png_dec_buffer __attribute__ ((aligned (32)));
png_dec_buffer = memalign( 32, PVR_TEX_WIDTH * PVR_TEX_HEIGHT * 2 );
pvr_vram_buffer = pvr_mem_malloc(PVR_TEX_WIDTH * PVR_TEX_HEIGHT * 2);
if (png_dec_buffer == NULL) {fputs ("Memory error",stderr); exit (2);}
// Decode the PNG file into main RAM
png_to_texture( file_name , png_dec_buffer, PNG_NO_ALPHA);
// transfer the texture from RAM to VRAM using PVR DMA
pvr_txr_load_dma(png_dec_buffer, pvr_vram_buffer,
PVR_TEX_WIDTH * PVR_TEX_HEIGHT * 2, 0, pvr_dma_callback, pvr_dma_cbdata);
}