SDL not honoring flags to SDL_SetVideoMode

Hello-

I hope this is not the second time getting this message. I used the wrong
account to send it earlier and sdl (i think) rejected it.---------------------------------------------------------
Now on with the problem…
Let me just get my machine info out of the way real quick :wink:

PII 400
RedHat 7.1
XFree86 Version 4.0.3
Vid card: ATI Technologies Inc 3D Rage Pro AGP 1X/2X
Vid card driver: ati
modules loaded by X:
Section "Module"
Load "GLcore"
Load "dbe"
Load "extmod"
Load "fbdevhw"
Load "pex5"
Load "dri"
Load "glx"
Load "pex5"
Load "record"
Load "xie"
EndSection

Being an SDL newbie I do not know if this is incorrect behavior or not but I
wanted to ask. I have noticed that when I create a SDL_Surface using :

if ((screen = SDL_SetVideoMode(WIDTH,HEIGHT,BPP,0)) == 0) {
}

that the flags for screen are actually 0x20000000 which is SDL_HWPALETTE.
I dont know if this is causing the segfault in my application but the segfault
is in the SDL code. There is a null pointer that SDL tries to reference and I think
that it is in SDL_video.c in UpdateRects when it calls this:

saved_colors = pal->colors;

UpdateRect is called in my code after I draw to an SDL_Surface using the
getpixel/putpixel calls found in the example code.

Thanks,
Nick Kidd

----- End forwarded message -----

I hope this is not the second time getting this message. I used the wrong
account to send it earlier and sdl (i think) rejected it.

Can you send a minimal complete example that shows this problem, as well
as provide the output of xdpyinfo?

Thanks,
-Sam Lantinga, Software Engineer, Blizzard Entertainment

Sam-
Sorry for the delay. My question was mainly about SDL ignoring the flags
passed to SetVideoMode. I did find that if I used SDL_ANYFORMAT in my
application that it did not segfault and using SDL_SWSURFACE it segfaults.
I would think that the below output should be reversed. That SDL_ANYFORMAT
would try to grab the best video mode and specifically requesting a
SWSURFACE would keep flags set at 0. I am going to try and get a smaller
example of the segfaulting code…it is a bit big right now. I have not
heard of xdpyinfo but will look into that and get you the information that
you want.

Thanks,
Nick

The below is to show how SDL is setting the flags…

Here is the output from my prompt: (FLAGS is SDL_ANYFORMAT, FLAGS2 is SDL_SWSURFACE)-------------------------------------------------------------------------------
nkidd at unclefunk:foo> gcc -ggdb -o using_FLAGS test.c sdl-config --libs --cflags
nkidd at unclefunk:foo> ./using_FLAGS
SDL_Surface - flags: 20000000
SDL_HWPALETTE: 20000000
nkidd at unclefunk:foo> gcc -ggdb -o using_FLAGS2 test.c sdl-config --libs --cflags
nkidd at unclefunk:foo> ./using_FLAGS2
SDL_Surface - flags: 0
SDL_HWPALETTE: 20000000

Here is the code:

#include “SDL.h”
#include <stdio.h>
#define FLAGS SDL_SWSURFACE
#define FLAGS2 SDL_ANYFORMAT
int
main() {
SDL_Surface *screen;
Uint32 fgColor;
const SDL_VideoInfo videoInfo = NULL;
SDL_Event event;
/
ints for movement */
int quit = 0,
tmp;

/* init the SDL /
if (SDL_Init( SDL_INIT_VIDEO ) < 0) {
/
There was an error, return code and quit */
fprintf (stderr, “Could not initialize SDL: %s\n”,SDL_GetError());
exit(-1);
}

/* Dont forget to clean up when exiting */
atexit(SDL_Quit);

if ((screen = SDL_SetVideoMode(640,480,8,FLAGS2)) == 0) {
fprintf( stderr, “Could not set VideoMode: %s\n”, SDL_GetError());
exit(1);
}

fprintf ( stderr,“SDL_Surface - flags: %x\n”, screen->flags);
fprintf ( stderr,"\tSDL_HWPALETTE: %x\n",SDL_HWPALETTE);
return 0;
}

  • Sam Lantinga [011102 14:49]:

I hope this is not the second time getting this message. I used the wrong
account to send it earlier and sdl (i think) rejected it.

Can you send a minimal complete example that shows this problem, as well
as provide the output of xdpyinfo?

Thanks,
-Sam Lantinga, Software Engineer, Blizzard Entertainment


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl