| View previous topic :: View next topic |
| Author |
Message |
Loothor
Joined: 07 Sep 2005 Posts: 6
|
Posted: Thu Nov 03, 2005 12:14 am Post subject: Linear data copy to VRAM |
|
|
I have some data I'd like to store in VRAM, and of course I'd like to transfer it as quickly as possible. As far as I know, this entails using sceGuCopyImage(). However, sceGuCopyImage seems tailored to placing images in VRAM with a rectangular layout, and I'd really like to just copy various sizes of data to specified VRAM addresses in a linear fashion. My code currently works fine using:
memcpy(pVRAMAddr, pData, size);
but this is not as quick as the DMA copy triggered by sceGuCopyImage from what I understand... Can somebody give me some info on how to do a DMA copy of data to VRAM in a linear fashion? I tried using various manglings of sceGuCopyImage, but most of them just seem to crash the PSP or write data non-linearly. |
|
| Back to top |
|
 |
matkeupon
Joined: 02 Jul 2005 Posts: 26
|
Posted: Thu Nov 03, 2005 11:03 pm Post subject: |
|
|
I also had a performance problem with memcpy and the VRAM (it seems, copying the content of the whole screen with it is longer than 1/60s...).
There is an alignment requirement in the use of sceGuCopyImage() if I remember correctly. But using the Dmac functions would be better in your case.
http://forums.ps2dev.org/viewtopic.php?t=3890
This post talks about alignment requirement of the Dmac functions. I don't know if there is a way to know if the transfer is finished, must be a stub no one has found yet. |
|
| Back to top |
|
 |
Jim

Joined: 02 Jul 2005 Posts: 487 Location: Sydney
|
Posted: Fri Nov 04, 2005 7:38 am Post subject: |
|
|
Is it possible just to set width = gfx_x * gfx_y and height = 1 in the transfer? ie, pretend you're transferring one very long thin bitmap.
Jim _________________ http://www.dbfinteractive.com |
|
| Back to top |
|
 |
jsgf
Joined: 12 Jul 2005 Posts: 254
|
Posted: Fri Nov 04, 2005 9:17 am Post subject: |
|
|
You could, though I'm not sure what the limit is; if you can factor your copy area into two approximately equal products, then you can still do it in a 2D way.
Also, there doesn't seem to be much cost in issuing lots of separate copies. In PSPGL, I flip images by copying each scanline as a separate copy operation, with no obvious performance hit compared to doing a single bulk copy. |
|
| Back to top |
|
 |
Loothor
Joined: 07 Sep 2005 Posts: 6
|
Posted: Fri Nov 04, 2005 10:38 pm Post subject: |
|
|
| The sceDmacMemcpy() stub worked perfectly. Thanks so much for pointing out that thread. I didn't have any problems with alignment as discussed in that thread, but all of the data I am transferring is aligned on 16-byte boundaries. |
|
| Back to top |
|
 |
|