| View previous topic :: View next topic |
| Author |
Message |
Raphael

Joined: 17 Jan 2006 Posts: 646 Location: Germany
|
Posted: Fri Mar 24, 2006 5:10 am Post subject: SDK ADD: VRAM MMU (valloc/vfree) |
|
|
I coded a small VRAM MMU in the style of the libc alloc files and already submitted it on the PSP Development forum where it had pretty good feedback and also the request to add it to the SDK.
Since I don't have any SVN access and also don't have an idea where to place it best, I'll just provide the link to the sources here, so maybe one of the SDK devs can look over it and then decide to work it into SDK or not.
It's free to use for you guys however you like :)
Best regards,
Raphael
SOURCE |
|
| Back to top |
|
 |
be2003
Joined: 20 Apr 2006 Posts: 144
|
Posted: Mon Apr 23, 2007 3:57 pm Post subject: |
|
|
its a little late...
but I LOVE YOU! _________________ - be2003
blog |
|
| Back to top |
|
 |
Insert_witty_name
Joined: 10 May 2006 Posts: 376
|
|
| Back to top |
|
 |
raf
Joined: 13 Oct 2005 Posts: 57
|
Posted: Tue Apr 24, 2007 1:57 am Post subject: |
|
|
I also use this code from Raphael. It is very useful, and vote for it to be included in the sdk. If nothing else, it should be added to the subversion repository as a library.
What do you guys think?
Raf. |
|
| Back to top |
|
 |
dot_blank

Joined: 28 Sep 2005 Posts: 498 Location: Brasil
|
Posted: Tue Apr 24, 2007 2:06 pm Post subject: |
|
|
i second the notion for a subversion library of this very useful
VRAM source ...possibly name it libpspvram, linking with -lpspvram
to make everything nice and neat and easily rememberable :) _________________ 10011011 00101010 11010111 10001001 10111010 |
|
| Back to top |
|
 |
be2003
Joined: 20 Apr 2006 Posts: 144
|
Posted: Tue Apr 24, 2007 2:26 pm Post subject: |
|
|
i like that idea to
as long as raphael submits this version rather than the newer one
because i for one like having more vram space to allocate
it doesnt really matter how long it takes to allocate it
as long as i get to keep what little space the vram provides _________________ - be2003
blog |
|
| Back to top |
|
 |
Insert_witty_name
Joined: 10 May 2006 Posts: 376
|
Posted: Tue Apr 24, 2007 2:37 pm Post subject: |
|
|
| Newer one is a lot better, and the overhead very small. |
|
| Back to top |
|
 |
be2003
Joined: 20 Apr 2006 Posts: 144
|
Posted: Tue Apr 24, 2007 2:55 pm Post subject: |
|
|
ill try it out
can u please post a download link? _________________ - be2003
blog |
|
| Back to top |
|
 |
Insert_witty_name
Joined: 10 May 2006 Posts: 376
|
Posted: Tue Apr 24, 2007 3:10 pm Post subject: |
|
|
It's the link I gave above.
The code is attached to the bottom of the post. |
|
| Back to top |
|
 |
Raphael

Joined: 17 Jan 2006 Posts: 646 Location: Germany
|
Posted: Tue Apr 24, 2007 8:42 pm Post subject: |
|
|
I didn't think to see this thread once again in my life :)
Nice it gets some recognition at last ;)
I'd be glad to have the lib in the subversion as something like libpspvram or equal, I already had quite some feedback from people using this lib in their programs now (much more than I ever thought).
PS: Regarding the allocation overhead of the newer version: You can easily adjust that by changing the __BLOCK_SIZE define to something smaller than 512. The limit is 64 since the block index needs to fit into 15 bit and you need to reach the whole memory range with that (64*2^15 = 2MB).
Block sizes of 64byte should be good enough though, since it's small enough that a 8x8x8bit texture fits into it without waste and only smaller textures cause some very small loss of VRAM. If anyone is really picky about that, you can always use the older version linked at the top of this thread or (version 1.01 with faster vmemavail function) at my blog.
EDIT:
Current links to the two different versions:
valloc 1.01 - slower and depends on malloc
vram 1.0 - faster but little overhead for small allocations _________________ <Don't push the river, it flows.>
http://wordpress.fx-world.org - my devblog
http://wiki.fx-world.org - VFPU documentation wiki
Alexander Berl |
|
| Back to top |
|
 |
raf
Joined: 13 Oct 2005 Posts: 57
|
Posted: Fri Apr 27, 2007 1:05 am Post subject: |
|
|
Alright,
I committed the libraries to the repository. They are under the libpspvram directory in the trunk.
I added a makefile that will make both the libpspvram.a and the libpspvalloc.a libraries. Make install will install to the pspsdk folders on your system.
For the vram code, I used the latest from Raphael; for the valloc, I used the old code I was using. Will need to update.
I'll let Raphael write some sort of readme, which I could then commit.
SVN WEB: http://svn.ps2dev.org/listing.php?repname=psp&path=%2Ftrunk%2Flibpspvram%2F&rev=0&sc=0
SVN URL (for svn client): svn://svn.ps2dev.org/psp/trunk/libpspvram
Raf. |
|
| Back to top |
|
 |
willow :--)
Joined: 13 Jan 2007 Posts: 126
|
Posted: Sun Dec 06, 2009 11:04 pm Post subject: |
|
|
Sorry to revive an old thread, I have a question about the usage of these libs.
If I initialize my display buffers like this:
fbp0 = ( u32* ) vrelptr ( valloc ( FRAME_BUFFER_SIZE ) );
fbp1 = ( u32* ) vrelptr ( valloc ( FRAME_BUFFER_SIZE ) );
Assuming I want to free them at some point, is it correct to call:
vfree(fbp0);
vfree(fbp1);
or is it incorrect since they are relative pointers ? (And in that case, how should I do it? Have intermediate pointers after the valloc ?) _________________ Wagic. Play that card game against an AI on your PSP |
|
| Back to top |
|
 |
a_noob
Joined: 17 Sep 2006 Posts: 97 Location: _start: jr 0xDEADBEEF
|
Posted: Sun Dec 06, 2009 11:53 pm Post subject: |
|
|
First of all you should probably update it to a more current version, and then you would use vGuPointer(void *) and vCpuPointer(void*). Or you can do
vfree((void*)((u32)fbp0 | 0x04000000)); This will convert it from a relative to a absolute pointer. _________________
| Code: | .øOº'ºOø.
'ºOo.oOº' |
|
|
| Back to top |
|
 |
Raphael

Joined: 17 Jan 2006 Posts: 646 Location: Germany
|
Posted: Mon Dec 07, 2009 1:49 am Post subject: |
|
|
Well, there is no "more current version", as the library was never updated from it's release (didn't have to :). There are just the two different versions (valloc.c old one, vram.c new one), and I still recommend using vram.c, as it doesn't depend on malloc (no dynamic sysram allocations) and is quite a bit faster.
Regarding vfree usage, it expects the exact same pointer that valloc gave, which is an absolute pointer.
So the correct usage would be like this:
| Code: |
void* fbp = valloc(size);
sceGuDrawBuffer( ..., vrelptr(fbp),..);
vfree(fbp);
|
or alternatively (not recommended as null pointers aren't detected any more, but works):
| Code: |
void* fbp = vrelptr(valloc(size));
...
vfree(vabsptr(fbp));
|
_________________ <Don't push the river, it flows.>
http://wordpress.fx-world.org - my devblog
http://wiki.fx-world.org - VFPU documentation wiki
Alexander Berl |
|
| Back to top |
|
 |
|