Palette operations INCREDIBLY slow!

When using the video mode

ScaledSurface = SDL_SetVideoMode(3202 , 2002, 8, SDL_SWSURFACE);

I notice that updating one color via

SDL_SetColors( ScaledSurface , &ThisOneColor, palpos, 1 );

gives me quite exactly HALF the framerate I have otherwise.
That means a drop from 145 FPS to about 75 FPS on my machine.
Wow! What is taking so long about that? Any ideas? If this
is so I will just stop doing palette operations every frame.
Thanks for any help and kind regards, Johannes Prix.

When using the video mode
ScaledSurface = SDL_SetVideoMode(3202 , 2002, 8, SDL_SWSURFACE);
I notice that updating one color via
SDL_SetColors( ScaledSurface , &ThisOneColor, palpos, 1 );
gives me quite exactly HALF the framerate […]

Hi,

When you init video mode via

ScaledSurface = SDL_SetVideoMode(3202 , 2002, 8, SDL_SWSURFACE);

it brings up a window with the specified size (640x400) and an EMULATED
depth of 8 bit/pixel. That pixel depth is not real. My desktop has 32bit
color
depth, so the window has also 32bit. What I think it’s happening is that
SDL is managing the emulation via software and this is slowing down your
proggie. Try it in fullscreen mode and let’s see…

David D?az wrote:

When using the video mode
ScaledSurface = SDL_SetVideoMode(3202 , 2002, 8, SDL_SWSURFACE);
I notice that updating one color via
SDL_SetColors( ScaledSurface , &ThisOneColor, palpos, 1 );
gives me quite exactly HALF the framerate […]

Hi,

When you init video mode via

ScaledSurface = SDL_SetVideoMode(3202 , 2002, 8, SDL_SWSURFACE);

it brings up a window with the specified size (640x400) and an EMULATED
depth of 8 bit/pixel. That pixel depth is not real. My desktop has 32bit
color
depth, so the window has also 32bit. What I think it’s happening is that
SDL is managing the emulation via software and this is slowing down your
proggie. Try it in fullscreen mode and let’s see…

Yes. I tried it with fullscreen mode and its exactly the same. I use
X11 and also color dephth >= 16 bit. If I get that right X11 does not
change color depth when switching to fullscreen mode, because its just
changing resolution and grabing the mouse cursor to the one window while
the rest of the 1280x1024 desktop is still there but the screen shows
just the 640x480 of the window. Maybe the emulation is the cause of the
problem, but fullscreen mode does not seem to solve it. Well, I still
can go around these palette operations and change the actual pixmaps
instead of their color table. Thanks and regards, Johannes.

[…fullscreen…]

Yes. I tried it with fullscreen mode and its exactly the same. I use
X11 and also color dephth >= 16 bit. If I get that right X11 does not
change color depth when switching to fullscreen mode, because its just
changing resolution and grabing the mouse cursor to the one window
while the rest of the 1280x1024 desktop is still there but the screen
shows just the 640x480 of the window.

Correct.

Maybe the emulation is the cause
of the problem, but fullscreen mode does not seem to solve it.

It’s not expected to either. The only way to avoid emulation is to change
the physical depth to 8 bits palettized, which is not supported by most X
servers.

Well, I
still can go around these palette operations and change the actual
pixmaps instead of their color table.

Yes, that should be faster than the emulation, if done right.

//David Olofson — Programmer, Reologica Instruments AB

.- M A I A -------------------------------------------------.
| Multimedia Application Integration Architecture |
| A Free/Open Source Plugin API for Professional Multimedia |
----------------------------> http://www.linuxdj.com/maia -' .- David Olofson -------------------------------------------. | Audio Hacker - Open Source Advocate - Singer - Songwriter |-------------------------------------> http://olofson.net -'On Sunday 19 May 2002 14:46, Johannes Prix wrote: