forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Linear data copy to VRAM

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
Loothor



Joined: 07 Sep 2005
Posts: 6

PostPosted: Thu Nov 03, 2005 12:14 am    Post subject: Linear data copy to VRAM Reply with quote

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
View user's profile Send private message
matkeupon



Joined: 02 Jul 2005
Posts: 26

PostPosted: Thu Nov 03, 2005 11:03 pm    Post subject: Reply with quote

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
View user's profile Send private message
Jim



Joined: 02 Jul 2005
Posts: 487
Location: Sydney

PostPosted: Fri Nov 04, 2005 7:38 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
jsgf



Joined: 12 Jul 2005
Posts: 254

PostPosted: Fri Nov 04, 2005 9:17 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Loothor



Joined: 07 Sep 2005
Posts: 6

PostPosted: Fri Nov 04, 2005 10:38 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group