The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
Re: VERY slow SDL_SetColors() changes when using bittorrent
Matt Klein
Guest

Josh Matthews <mrlachatte <at> gmail.com> writes:

Quote:
It's also possible that Bittorrent is taking up a lot of CPU time, which would
lag other things running.

Dear Josh,

Thanks for your answer.

Unfortunately, it is not. Bittorrent uses 10% CPU on a PIII 550 Mhz. Replacing
Bittorrent by another application that uses even +50% CPU won't make any lag in
the fading effect.


Various info that could help regarding this bug:

1. The application is the 'Duke Nukem 3D' game. It will work fine at its full
speed with bittorrent until the Duke 3D orders a fading effect with
SDL_SetColors().

2. This bugs occured on at least 3 different PCs managed by different people,
from 550 Mhz to +3.4Ghz, using both Intel and AMD, using different graphic cards.

3. I could easily reproduce this bug from user's reports.

4. Only a very few applications can make SDL_SetColors()lag. Known applications
to date are: Bittorrent and the Longhorn Inspirat theme for Win XP.

5. SDL_SetColors() is the same as SDL_SetPalette but uses SDL_LOGPAL |
SDL_PHYSPAL. Using SDL_SetPalette shows that only the SDL_PHYSPAL lags, not
SDL_LOGPAL. (!)

6. You can test the issue by running XP (and surely any Win32) and Duke3d
Rancidmeat reloaded v19.6 at http://duke3d.m-klein.com (you'll need the provided
shareware GRP file as well) and bittorrent http://www.bittorrent.com.
Alternatively, you can check out Icculus version (http://www.icculus.org/) of
Duke3d that is also affected.
Re: VERY slow SDL_SetColors() changes when using bittorrent
Sam Lantinga
Guest

Quote:
Various info that could help regarding this bug:

Quote:
1. The application is the 'Duke Nukem 3D' game. It will work fine at its full
speed with bittorrent until the Duke 3D orders a fading effect with
SDL_SetColors().

Is this using a software renderer? What version of SDL are you using?
If you're using one built from CVS, try 1.2.9 released code.

-Sam Lantinga, Senior Software Engineer, Blizzard Entertainment
Re: VERY slow SDL_SetColors() changes when using bittorrent
Ryan C. Gordon
Guest

Quote:
Is this using a software renderer? What version of SDL are you using?
If you're using one built from CVS, try 1.2.9 released code.

(It's a software renderer, writing to an 8-bit, palettized framebuffer)
I'm wondering if it's a bad interaction with his DirectX drivers, and if
turning off the hardware palette in Duke3D would help.

In buildengine/sdl_driver.c, find this around line 1297:
sdl_flags |= SDL_HWPALETTE;

And delete it. Rebuild and see if the problem goes away.

--ryan.
Re: VERY slow SDL_SetColors() changes when using bittorrent
Matt Klein
Guest

Ryan C. Gordon <icculus <at> icculus.org> writes:

Quote:


Quote:
Is this using a software renderer? What version of SDL are you using?
If you're using one built from CVS, try 1.2.9 released code.

(It's a software renderer, writing to an 8-bit, palettized framebuffer)
I'm wondering if it's a bad interaction with his DirectX drivers, and if
turning off the hardware palette in Duke3D would help.

In buildengine/sdl_driver.c, find this around line 1297:
sdl_flags |= SDL_HWPALETTE;

And delete it. Rebuild and see if the problem goes away.

--ryan.



Hi Sam and Ryan. Thanks again for your ideas. We are getting closer. Here are
the answers following your suggestions + more relevant informations:

// SDL libs are embedded in exe to allow an easier putenv under Win32 and
// to avoid users to mess up with the various version of the SDL dll.

if( BFullScreen )
putenv("SDL_VIDEODRIVER=directx"); // FullScreen Mode, trying
else
putenv("SDL_VIDEODRIVER=windib"); // Window Mode, trying windib

sdl_flags = BFullScreen ? SDL_FULLSCREEN : 0;
sdl_flags |= SDL_HWPALETTE;

The conditions for the palette lag to happen must be:

----
SDL_FULLSCREEN + SDL_VIDEODRIVER=directx + bittorent (must display an active
progress bar by downloading something) + game's FPS below 100. In this case
the fadding effect (palette changes loop) will drop the game's FPS down to
2 or 3 FPS. Makes the game unplayable when getting hurt or picking up
new weapons.
----

* Doing a (fullscreen + Windib) or a (Windowed mode + Directx) is all good.

* The SDL_HWPALETTE can be used or removed, it doesn't change anything.

* Issue happens in both stable SDL 1.2.4 and 1.2.9 (I have not tryed any top
tree version of the CVS archive yet. I will try a top version though and let you
know).

* If the game's FPS is huge (say +400 fps) then the lag effect is less noticable
but it's still there.

* The Jonof port of duke3d (in fact of the Ken Silverman's Build Engine) uses
DirectX full screen, but no SDL. Palette changes are always fine.