my SDL ports are darn slow

Post Reply
jotd
Posts: 32
Joined: Sun Dec 13, 2009 9:43 pm
Location: France
Contact:

my SDL ports are darn slow

Post by jotd » Wed Jun 09, 2010 10:32 pm

Hi,

I have coded some C++/SDL ports of some games (either from me or from other 3rd party developpers), however I found out that the games are darn slow. And I'm wondering if it is not linked to the update from libnds 1.4.1 to libnds 1.4.2

Also what's the fastest mode on the DS? Is that 8-bit? I'm always using 8-bit because I found this a lot faster than the other modes.

Does the screen hardware rescale eats CPU power or is this transparent?

On my PC, one of my games uses 4% of CPU (CoreDuo) but it crawls on my DS and it is the same C++ code & both using SDL (I know SDL is not very optimal for the DS, but come on!!!).

help, I don't seem to be able to finish anything. I have tested jEnesis and have the proof that the DS is very capable to run CPU-intensive and 2D GFX intensive stuff. Very frustrating!!

Sorry for the basic and vague questions...

bye

WinterMute
Site Admin
Posts: 1404
Joined: Tue Aug 09, 2005 3:21 am
Location: UK
Contact:

Re: my SDL ports are darn slow

Post by WinterMute » Thu Jun 10, 2010 12:31 am

The fastest graphics modes on the DS are tile based, it's not really designed for pixel pushing and SDL is something that will never run well on the DS.

Your core duo is probably running at around 1.8GHz or more, the DS ARM9 runs at 66MHz so, in theory at least, something that requires 4% CPU usage on the former will need approximately 110% CPU on the latter. Obviously things aren't quite that simple but it does illustrate a point.
Help keep devkitPro toolchains free, Donate today

devkitPro IRC support
Personal Blog

jotd
Posts: 32
Joined: Sun Dec 13, 2009 9:43 pm
Location: France
Contact:

Re: my SDL ports are darn slow

Post by jotd » Thu Jun 10, 2010 9:12 pm

Thanks for this reply. I wonder how jEnesis does to be so fast, whilist emulating a 68000 & sound!
Or the MarcaDS emulator.

Ok they don't use SDL but SDL DS actually performs blits using devkitpro, and emulators are pixel-pushing programs too (even if blits can be sometimes emulated with blits but that's not easy if the pixel format is not native!)

Discostew
Posts: 103
Joined: Sun Mar 08, 2009 7:24 pm

Re: my SDL ports are darn slow

Post by Discostew » Thu Jun 10, 2010 11:26 pm

jotd wrote:Thanks for this reply. I wonder how jEnesis does to be so fast, whilist emulating a 68000 & sound!
Or the MarcaDS emulator.

Ok they don't use SDL but SDL DS actually performs blits using devkitpro, and emulators are pixel-pushing programs too (even if blits can be sometimes emulated with blits but that's not easy if the pixel format is not native!)
As far as I know, BLITs with SDL on the DS are all done via software-rasterizing and framebuffers, and on a 66Mhz CPU, you can't expect to do much else.

The Genesis uses 2D hardware to render visuals in much the same way as the SNES, GBA, and DS handle it, so it's only logical that if the hardware is available (as is the case for jEnesis and the DS), using the 2D hardware acceleration with just a little bit of translation is a far better solution than to create your own rasterizer on a limited CPU. That is one reason why on devices like the DS, using SDL is not an option for me. You may gain flexibility, but the losses far outweigh the gains of what the program is capable of if the hardware is not used.

User avatar
dopefish
Posts: 6
Joined: Wed Nov 07, 2007 3:33 pm
Contact:

Re: my SDL ports are darn slow

Post by dopefish » Fri Jun 11, 2010 7:18 pm

I've ported a handful of applications to the DS using SDL. It's not a good fit.

Audio, input, networking, and timers will most likely have to be redone anyway, so those parts of SDL aren't doing you any favors. Which basically just leaves you the video stuff.
Using SDL for video on the DS does work reasonably well as far as bitmap graphics go, but like WinterMute said, the DS is really designed for tiles or 3D instead.

SDL is valid for helping you get a port up and running quickly (as in development speed, not necessarily execution speed), but unless it's a simple app you're probably better off writing DS-specific rendering code.
#include <sig.h>

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests