Paeryn's Hw Sdl Libs, Where Do I Get Them From?


I don't use SDL_GP2X_WaitForBlitter, what does it do? :-\

- Alex
 
Gadget posted on Aug 27 2006 at 07:35 AM said:
Thanks! Tried all of that to no avail :blink:

Can I confirm that someone here has FW 2.0 and the HW libs working? As in, working with HW surfaces actually on?

I have double buffering enabled, do my blits, then SDL_GP2X_WaitForBlitter, then the SDL_Flip(screen).

Do I need more than one surface?? Presumably my backbuffer (screen) is 640 x 240 in size even though I set it to 320 x 240, and the flipping chain is all handled automatically? There is nothing special I need to do after blit, wait for blit, flip?
Try SDL_GP2X_WaitForBlitter after each blit rather then after all the blits.

@Alex: I assume it waits until the blitter has finished blitting before moving on with the code.
 
Last edited by a moderator:
Gadget posted on Aug 27 2006 at 07:35 AM said:
Can I confirm that someone here has FW 2.0 and the HW libs working? As in, working with HW surfaces actually on?

I have double buffering enabled, do my blits, then SDL_GP2X_WaitForBlitter, then the SDL_Flip(screen).
You shouldn't really be calling SDL_GP2X_WaitForBlitter(), both the Blit() & Flip() functions call it internally.
What exactly is the problem you are having with surfaces?
Do I need more than one surface?? Presumably my backbuffer (screen) is 640 x 240 in size even though I set it to 320 x 240, and the flipping chain is all handled automatically? There is nothing special I need to do after blit, wait for blit, flip?
Actually the screen surface is still 320x240 but there are two of them. There is only one surface but it is special in that it's bitmap pointers swap between the two bitmaps every time you call SDL_Flip(). After a Flip() the surface bitmap is of the frame that had been shown prior to the flip.
Example (surface is the one returned by SetVideoMode, display is whet you see on the LCD),
Code:
  Start of program   |  surface=blank	|  display=blank
  draw 1st frame	 |  surface=frame 1 |  display=blank
  SDL_Flip()		  |  surface=blank	|  display=frame 1
  draw 2nd frame	|  surface=frame 2  |  display=frame 1
  SDL_Flip()		  |  surface=frame 1  |  display=frame 2
  draw 3rd frame	| surface=frame 3  |  display=frame 2
  SDL_Flip()		  |  surface=frame 2  |  display=frame 3
SDL_Flip() handles all synchronization and house-keeping stuff.

As for hiding the cursor, you have to call SDL_ShowCursor() after SetVideoMode() due to how my memory management works. SDL creates the cursor before setting the video mode, but the HW cursor has to reside in the upper memory which isn't available until after SetVideoMode. I keep forgetting to add code to re-disable it if the cursor had already been disabled.
 
Last edited by a moderator:
yaustar posted on Aug 28 2006 at 01:09 AM said:
Nice to see you back paeryn, regarding the WaitForBlitter Issue, I had to call it after each blit otherwise my sprites/graphics tend to tear or 'shiver'. More details in this thread:
http://www.gp32x.de/board/index.php?showtopic=31307
Thanks, hopefully I'll be able to get back to working on this a couple of days a week. I've just heard from djwillis that SDL is now at 1.2.11 so I'll be updating as soon as I can.
As for the tearing the only thing I can think of off the top of my head is if you Flip() straight after a Blit() - the blitter might not be updating it's registers fast enough. If the blitter hasn't finished setting itself up from the last blit the WaitForBlitter could possibly be returning early. I tried downloading Dance but it just locks up with a blank screen - I'll try again in-case the files got corrupt when copying them.
 
Last edited by a moderator:
Cheers for that. I have only tested Dance2x with firmware 2.0 if that's any help. I believe I am flipping straight after a series of blits. No rush though, just extremely curious wha the problem could be...
 
yaustar posted on Aug 28 2006 at 01:38 AM said:
Cheers for that. I have only tested Dance2x with firmware 2.0 if that's any help. I believe I am flipping straight after a series of blits. No rush though, just extremely curious wha the problem could be...

Thanks for all the support guys! I had two problem, the main one was so stupid it's not funny...

SDL_Init(SDL_INIT_JOYSTICK | SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER | SDL_DOUBLEBUF);//

screen = SDL_SetVideoMode( 320, 240, 16, SDL_HWSURFACE | SDL_DOUBLEBUF);

The SDL_DOUBLEBUF was missing from SetVideoMode. I thought it wasn't required as it's already set in SDL_Init.

My second problem was related to a memory leak in the way I was using SDL_CreateRGBSurfaceFrom, which I have now resolved. I do still get the occasional frame that seems to 'tear', almost like the page flip has occured in the wrong place? I get half of the frame displayed part way across the screen, about half to two thirds the way down the screen. I tried adding a call to SDL_GP2X_WaitForBlitter() but that makes no difference. Could be another memory leak or a bug in the SDL HW stuff. I can live with it for now!


Thanks very much for the support guys!! It's one of the fun things about the GP2X and this community, the way people help each other out is trully awesome!
 
Last edited by a moderator:
I think it is the other way around actually, SDL_DOUBLEBUF is required in SetVideoMode but not in Init. Take a look at the SDL doc wiki for SDL_Init and for SDL_SetVideoMode.

Everything is going well for me too, as I said with a good 30+ FPS boost over the stock SDL. Now I'll give background music another try, see if I'll be able to keep it at 60 FPS. :)

I agree with you Gadget, it's great to see experienced developers like Yaustar, Paeryn, and DJWillis always willing to help beginners out! Thanks a lot guys :)

- Alex
 
Alex. posted on Aug 28 2006 at 01:54 PM said:
I think it is the other way around actually, SDL_DOUBLEBUF is required in SetVideoMode but not in Init. Take a look at the SDL doc wiki for SDL_Init and for SDL_SetVideoMode.

Everything is going well for me too, as I said with a good 30+ FPS boost over the stock SDL. Now I'll give background music another try, see if I'll be able to keep it at 60 FPS. :)

I agree with you Gadget, it's great to see experienced developers like Yaustar, Paeryn, and DJWillis always willing to help beginners out! Thanks a lot guys :)

- Alex

Bah, of course it is!! How could I have been so stupid. :angry:
 
Last edited by a moderator:
Back
Top