Hi!
Tiny little bug in SDL I’ve found:
In SDL_dgavideo.c:
843: static int DGA_FlipHWSurface(_THIS, SDL_Surface surface)
844: {
845: int yoffset;
846:
847: / Wait for vertical retrace and then flip display /
848: yoffset = flip_pagesurface->h;
849: while ( XDGAGetViewportStatus(DGA_Display, DGA_Screen) )
850: /* Keep waiting for the hardware … */ ;
851: XDGASetViewport(DGA_Display, DGA_Screen, 0, yoffset, XDGAFlipRetrace);
852: flip_page = !flip_page;
853:
854: surface->pixels = flip_address[flip_page];
855: return(0);
856: }
Notice that the code is waiting for all pending XDGASetViewport() requests
on line 849. After that it calls XDGASetViewport(). This of course is
totally wrong since it defeat the whole purpose of doing it in the first
place (which is to wait for the vertical retrace to end before switching the
viewport).
What happens in above case is that it waits for the previous viewport change
to complete and then flips it which causes all kinds of flickering.
If you first change the viewport and then polls till it completes you get
the desired effect, i.e. it should be:
849: XDGASetViewport(DGA_Display, DGA_Screen, 0, yoffset, XDGAFlipRetrace);
850: while ( XDGAGetViewportStatus(DGA_Display, DGA_Screen) )
851: /* Keep waiting for the hardware … */ ;
Try it. Make a huge difference (;
Btw, I’d really like to make a suggestion here (one of the main reasons I’m
not keen on using SDL for my projects):
I’d really appreciate it if you guys could change SDL_Flip() from
int SDL_Flip(SDL_Surface *screen);
to
int SDL_Flip(SDL_Surface *screen,int wait_for_vertical_refresh);
Sometimes, especially when programming, it is desirable to disable waiting
for the vertical refresh so that one can get a clear indication of the
framerate achieved.
Forcing people to wait for the screen refresh isn’t very cool…
In fact, I think waiting for the vertical refresh and flipping the screen
shouldn’t even be in the same function since almost always it’s better to
first wait for the vertical refresh, then draw everything, flip it to the
screen, etc. E.g.
SDL_WaitForRefresh ();
draw_all_my_stuff_on_buffer ();
SDL_Flip ();
clear_all_my_stuff_on_buffer ();--
Regards
Abraham
Abraham vd Merwe [ZR1BBQ] - Frogfoot Networks
P.O. Box 3472, Matieland, Stellenbosch, 7602
Cell: +27 82 565 4451 - Tel: +27 21 887 8703
Http: http://www.frogfoot.net
Email: @Abraham_vd_Merwe
-------------- next part --------------
A non-text attachment was scrubbed…
Name: not available
Type: application/pgp-signature
Size: 232 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20010109/7f0133d5/attachment.pgp