SDL Initialization / Issues

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
framerate
Posts: 20
Joined: Sun Aug 14, 2005 2:30 am

SDL Initialization / Issues

Post by framerate »

So I wrote my recent RPG engine on my Macbook pro using SDL (for faster compilation and testing) and began running it on the PSP last week. I'm noticing some definitely issues and lag when running on the handheld.

- The first issue was my fading screen code was "flickering" when using double buffering. Now, I'm sure this is something I can figure out... but is there an issue with SDL_DOUBLEBUF that I need to be aware of?

- The main issues is the lagging. I'm rather new to the PSP scene, and my graphics are NOT optimized in any way shape or form (they're rather big). Could it be possible that the graphics are taking up too much memory causing the game to lag a bit? Or would this be based entirely on the CPU?

- My currently released demo uses the following initialization:

Code: Select all

screen = SDL_SetVideoMode(480, 272, 32,SDL_SWSURFACE|SDL_NOFRAME);
SDL_ShowCursor(SDL_DISABLE);
Notice the lack of doublebuf since I didn't notice any improvement with it enabled... I may be naive here so I was hoping I could get some suggestions on the best way to initialize SDL for the PSP? (hardware vs software.. does doublebuf make a big difference? I read up on how SDL handles it if doublebuf is NOT present and it seems very similar...)

Thanks in advance for the help guys!
danzel
Posts: 182
Joined: Fri Nov 04, 2005 11:03 pm

Post by danzel »

Go to 16 bit color to get a big speed increase:

screen = SDL_SetVideoMode(480, 272, 16,SDL_SWSURFACE|SDL_NOFRAME);
framerate
Posts: 20
Joined: Sun Aug 14, 2005 2:30 am

Post by framerate »

danzel wrote:Go to 16 bit color to get a big speed increase:

screen = SDL_SetVideoMode(480, 272, 16,SDL_SWSURFACE|SDL_NOFRAME);
It really makes that big of a difference, eh?. Also, you're recommending SWSURFACE over HWSURFACE and don't think DOUBLEBUF makes that big of a diff? Or just correcting my code? :)
danzel
Posts: 182
Joined: Fri Nov 04, 2005 11:03 pm

Post by danzel »

Not really sure on what flags to pass through, In AFKIM I'm passing 0.

Based on the readme I don't think passing SDL_HWSURFACE will do anything
Video - yes, single 32-bit ABGR framebuffer surface only; SDL will
emulate other formats as necessary. No HW accel. No 3D.
ufoz
Posts: 86
Joined: Thu Nov 10, 2005 2:36 am
Location: Tokyo
Contact:

Post by ufoz »

danzel wrote:Not really sure on what flags to pass through, In AFKIM I'm passing 0.

Based on the readme I don't think passing SDL_HWSURFACE will do anything
Video - yes, single 32-bit ABGR framebuffer surface only; SDL will
emulate other formats as necessary. No HW accel. No 3D.
Looking at the sdl-psp source, it makes all the difference. HW_SURFACE data goes in video memory and uses the GU for blits, and I remember it being a huge speedup when I finally remembered setting it back when I tried SDL.

(then I abandoned SDL because the input lagged horribly, not sure why that was happening)
framerate
Posts: 20
Joined: Sun Aug 14, 2005 2:30 am

Post by framerate »

ufoz wrote:
danzel wrote:Not really sure on what flags to pass through, In AFKIM I'm passing 0.

Based on the readme I don't think passing SDL_HWSURFACE will do anything
Video - yes, single 32-bit ABGR framebuffer surface only; SDL will
emulate other formats as necessary. No HW accel. No 3D.
Looking at the sdl-psp source, it makes all the difference. HW_SURFACE data goes in video memory and uses the GU for blits, and I remember it being a huge speedup when I finally remembered setting it back when I tried SDL.

(then I abandoned SDL because the input lagged horribly, not sure why that was happening)
Interesting...

I'm gonna try a build tomorrow with SDL_HWSURFACE and 16 bit textures.. see how drastic the framerate increase is.

Any experiences enable/disable SDL_DOUBLEBUF ?
Post Reply