SDL_DOUBLEBUF problem

Hi everyone.

Reading the documentation of SDL says that you have to use SDL_HWSURFACE
on SDL_SetVideoMode to be able to set SDL_DOUBLEBUF for using double
buffering.

Making a small axample that is:

#include “SDL.h”
#include <stdio.h>
#include <stdlib.h>

int main() {
SDL_Surface *screen;

if ((SDL_Init(SDL_INIT_VIDEO) == -1)) {
printf(“Unable to init SDL.\n”);
exit(1);
}

atexit(SDL_Quit);

screen = SDL_SetVideoMode(320, 200, 8, SDL_HWSURFACE | SDL_DOUBLEBUF |
SDL_FULLSCREEN);

if (screen == NULL) {
printf(“Unable to init screen.\n”);
exit(1);
}

if (screen->flags & SDL_HWSURFACE)
printf(“Using hardware surface.\n”);
else
printf(“Not using hardware surface.\n”);

if (screen->flags & SDL_DOUBLEBUF)
printf(“Using double buffering.\n”);
else
printf(“Not using double buffering.\n”);

exit(0);
}

Running it on a console using SVGALIB on Linux is throws:

Using hardware surface.
Not using double buffering.

So, as you can see, it set the SDL_HWSURFACE flag but not the
SDL_DOUBLEBUF one.

Could someone explain me why it could happen?, is a video card problem?.

Greettings.
Ernesto.

Ernesto Domato wrote:

Reading the documentation of SDL says that you have to use SDL_HWSURFACE
on SDL_SetVideoMode to be able to set SDL_DOUBLEBUF for using double
buffering.

correct

Running it on a console using SVGALIB on Linux is throws:

Using hardware surface.
Not using double buffering.

this can very well happen — either the video target does not support
page-flipping or some other constraint was not being met (like
insufficient video memory). In other words, you cannot count on
page-flipping being available even when hardware surfaces are

Reading the documentation of SDL says that you have to use SDL_HWSURFACE
on SDL_SetVideoMode to be able to set SDL_DOUBLEBUF for using double
buffering.

correct

Running it on a console using SVGALIB on Linux is throws:

Using hardware surface.
Not using double buffering.

this can very well happen — either the video target does not support
page-flipping or some other constraint was not being met (like
insufficient video memory). In other words, you cannot count on
page-flipping being available even when hardware surfaces are

Ok, thanks, I thought that it could be an issue on the video card. Anyway,
it is a ATI Rage 128 Pro (AGP) with 16 Mb of video memory, so I guess that
it must not support page-flipping (have to find out) because I think that
16 Mb is enough memory :wink:

Greettings.
Ernesto.

Ok, thanks, I thought that it could be an issue on the video card.
Anyway,
it is a ATI Rage 128 Pro (AGP) with 16 Mb of video memory, so I guess
that
it must not support page-flipping (have to find out) because I think
that
16 Mb is enough memory :wink:

I would think that any card with more than 2Mb of video memory would
support page flipping (certainly every 4Mb card I’ve ever seen has), so
maybe there’s some other problem here…–
Ben Sizer

Ok, thanks, I thought that it could be an issue on the video card.
Anyway,
it is a ATI Rage 128 Pro (AGP) with 16 Mb of video memory, so I guess
that
it must not support page-flipping (have to find out) because I think
that
16 Mb is enough memory :wink:

I would think that any card with more than 2Mb of video memory would
support page flipping (certainly every 4Mb card I’ve ever seen has), so
maybe there’s some other problem here…

Ok, so, how can I found out what the problem could be?, have anyone some
idea about this?

Thanks for the help.
Ernesto.

Ok, so, how can I found out what the problem could be?, have anyone some
idea about this?

What SDL driver are you using, again?

There is no page flipping in X11. Ever.

–ryan.

What SDL driver are you using, again?

There is no page flipping in X11. Ever.

I tried with 1.2.0 and CVS from last night.

I know that it doesn’t work under X11, for that reason i was sayibg that I
try it with SVGALIB. Maybe is a problem with SVGALIB?.

Under X11, my test throws that it can’t use double buffering and harware
surface that is correct.

Greettings.
Ernesto.

I know that it doesn’t work under X11, for that reason i was sayibg that I
try it with SVGALIB. Maybe is a problem with SVGALIB?.

Double buffering isn’t implemented in the SDL SVGAlib driver. Anybody want
to add it?

See ya,
-Sam Lantinga, Software Engineer, Blizzard Entertainment

I know that it doesn’t work under X11, for that reason i was sayibg that I
try it with SVGALIB. Maybe is a problem with SVGALIB?.

Double buffering isn’t implemented in the SDL SVGAlib driver. Anybody want
to add it?

Ok, that explain why I wasn’t able to use double buffering with SVGALIB.
=)

About what you have said, that double buffering is not implemented in the
SDL SVGALIB drive, it means that is not a feature of SVGALIB, or is just
not implemented on the SDL library?

The last question (sorry for my newbies questions), on which drivers are
implemented double buffering?

Thanks for the help and greettings.
Ernesto.

There is no page flipping in X11. Ever.

Why not ? Isn’t that VERY bad (specially for games) ?

Will it be implented in the future ?–
Trick

Trick wrote:

There is no page flipping in X11. Ever.

Why not ? Isn’t that VERY bad (specially for games) ?

Will it be implented in the future ?

In XFree86 style fullscreen mode, have your virtual resolution at least
twice the X or Y of the desired fullscreen mode. IE you’ll have to be
running at least 1280x980 to do 640x480.

Switch to a 640x480 modeline, but split up the screen into 640x480
sections. Pan the display to whatever piece you want displayed.

Ta da. Double, triple, or even quadruple buffering.

And you can even do snazzy hardware scrolling tricks with this.
Knowledge of the old ways is useful.

About what you have said, that double buffering is not implemented in the
SDL SVGALIB drive, it means that is not a feature of SVGALIB, or is just
not implemented on the SDL library?

I was using svgalib some time ago, it seems to me that it was able to do
double buffering. I’m just getting the latest SDL CVS to see if I can do
something about it.

The last question (sorry for my newbies questions), on which drivers are
implemented double buffering?

The framebuffer (fbcon) driver should support it. Any others?

Alex.

In XFree86 style fullscreen mode, have your virtual resolution at
least twice the X or Y of the desired fullscreen mode. IE you’ll
have to be running at least 1280x980 to do 640x480.

Switch to a 640x480 modeline, but split up the screen into 640x480
sections. Pan the display to whatever piece you want displayed.

Ta da. Double, triple, or even quadruple buffering.

And you can even do snazzy hardware scrolling tricks with this.
Knowledge of the old ways is useful.

Neat! Will SDL do this buffer-trickery in the future ? That would be
great, so that i wouldn’t need any system-dependent stuff in the
buffering code…–
Trick