kometbomb / klystrack

A chiptune tracker
http://kometbomb.github.io/klystrack/
Other
488 stars 28 forks source link

Slow graphics rendering on a debian wheezy netbook #188

Open DepreTux opened 9 years ago

DepreTux commented 9 years ago

Hi!

I installed both the binary you provide and compiled with "debug" and "release" on my atom n455, 1,6GHz, 1GB RAM, running LXDE under a custom RT kernel (which otherwise works good).

The sdl2 packages are coming from wheezy-backports.

Any ideas on how to troubleshoot this?

Thanks!

kometbomb commented 9 years ago

The rendering is quite heavy for what is visible on screen but it could be that SDL is for some reason running in software mode. Could you check if the very first lines in stdout contain this line (run the debug build to see all debug messages):

[DEBUG] Renderer: direct3d (Accelerated)

On Linux the renderer of course should be "opengl" or something like that.

DepreTux commented 9 years ago

This is the output of running the debug version of klystrack and playing the example song "castlevania". The sound gets through, but the pattern tracker only renders what's already behind the cursor, all of this very slowly. This also happened with the binaries.

Anyway, here is the output, which seems to show i'm under opengl

fede@sunra:~/downloads/klystrack-repos/klystrack/bin.debug$ ./klystrack 
[DEBUG] Starting klystrack 1.6.1 20150515
[DEBUG] Loading filebox favorites (/home/fede/.klystrackfavorites)
[DEBUG] Renderer: opengl (Accelerated)
[DEBUG] Setting screen mode (scale = 1)
[DEBUG] Rendering to texture enabled
[DEBUG] Screen size is 640x480
[DEBUG] Window size is 640x480
[DEBUG] init
[DEBUG] Enumerating themes at /usr/lib/klystrack/res
[DEBUG] Got 10 themes
[DEBUG] Enumerating keymaps at /usr/lib/klystrack/key
[DEBUG] Got 3 keymaps
[DEBUG] undo = (nil) redo = (nil)
[DEBUG] init done
[DEBUG] Setting screen mode (scale = 1)
[DEBUG] Rendering to texture enabled
[DEBUG] Screen size is 640x480
[DEBUG] Window size is 640x480
[DEBUG] Setting screen mode (scale = 1)
[DEBUG] Rendering to texture enabled
[DEBUG] Screen size is 640x480
[DEBUG] Window size is 640x480
[DEBUG] Setting screen mode (scale = 1)
[DEBUG] Rendering to texture enabled
[DEBUG] Screen size is 640x480
[DEBUG] Window size is 640x480
[DEBUG] Loading theme '/usr/lib/klystrack/res/Default'
[DEBUG] Opened bundle (9 files)
[DEBUG] statusbar_text=main_text
[DEBUG] Loading font '7x6.fnt'
[DEBUG] Opened bundle (3 files)
[DEBUG] Read charmap (50 chars)
[DEBUG] Loading font '7x6.fnt'
[DEBUG] Opened bundle (3 files)
[DEBUG] Read charmap (50 chars)
[DEBUG] Loading font '7x6.fnt'
[DEBUG] Opened bundle (3 files)
[DEBUG] Read charmap (50 chars)
[DEBUG] Loading font '7x6.fnt'
[DEBUG] Opened bundle (3 files)
[DEBUG] Read charmap (50 chars)
[DEBUG] Loading font '7x6.fnt'
[DEBUG] Opened bundle (3 files)
[DEBUG] Read charmap (50 chars)
[DEBUG] Loading font '7x6.fnt'
[DEBUG] Opened bundle (3 files)
[DEBUG] Read charmap (50 chars)
[DEBUG] Loading font '8x8.fnt'
[DEBUG] Opened bundle (3 files)
[DEBUG] Read charmap (155 chars)
[DEBUG] Loading font '8x8.fnt'
[DEBUG] Opened bundle (3 files)
[DEBUG] Read charmap (155 chars)
[DEBUG] Loading font '8x8.fnt'
[DEBUG] Opened bundle (3 files)
[DEBUG] Read charmap (155 chars)
[DEBUG] Loading font '8x8.fnt'
[DEBUG] Opened bundle (3 files)
[DEBUG] Read charmap (155 chars)
[DEBUG] Loading font '4x6.fnt'
[DEBUG] Opened bundle (3 files)
[DEBUG] Read charmap (18 chars)
[DEBUG] Loading font '4x6.fnt'
[DEBUG] Opened bundle (3 files)
[DEBUG] Read charmap (18 chars)
[DEBUG] Loading font '4x6.fnt'
[DEBUG] Opened bundle (3 files)
[DEBUG] Read charmap (18 chars)
[DEBUG] Theme opened ok
[DEBUG] Loading filebox favorites (/home/fede/.klystrackfavorites)
[DEBUG] Reserving 32 Cyd channels
[DEBUG] Changed num_channels = 4
[DEBUG] Reserving 4 Cyd channels
[DEBUG] Opening SDL audio
[DEBUG] Got 44100 Hz/format 32784/2 channels
[DEBUG] SDL_WINDOWEVENT_SIZE_CHANGED 640x480
[DEBUG] Menu opened
[DEBUG] Opening directory .
[DEBUG] Got 1 files
[DEBUG] Opening directory ..
[DEBUG] Got 17 files
[DEBUG] Opening directory examples
[DEBUG] Got 3 files
[DEBUG] Opening directory songs
[DEBUG] Got 13 files
[DEBUG] Changed num_channels = 4
[DEBUG] Reserving 4 Cyd channels
[DEBUG] Song version = 17
[DEBUG] Loading default volumes at offset 0
[DEBUG] Loading default panning at offset 0
[DEBUG] Loading instrument at offset 0
[DEBUG] Loading instrument at offset 0
[DEBUG] Loading instrument at offset 0
[DEBUG] Loading instrument at offset 0
[DEBUG] Loading instrument at offset 0
[DEBUG] Loading instrument at offset 0
[DEBUG] Loading instrument at offset 0
[DEBUG] Changed num_channels = 6
[DEBUG] Reserving 6 Cyd channels
[DEBUG] cyd_unregister
[DEBUG] Waiting for stuff
[DEBUG] Done waiting
[DEBUG] Closing audio
[DEBUG] SDL_CloseAudio finished
[DEBUG] cyd_deinit
[DEBUG] Saving filebox favorites (/home/fede/.klystrackfavorites)
[DEBUG] deinit
[DEBUG] Draw calls per frame: 4553.5
[DEBUG] klystrack has left the building.
kometbomb commented 9 years ago

Can you run Windows on the same computer? Perhaps it's just that slow on all platforms. :(

kometbomb commented 9 years ago

Oh, I should also add that there is partial support for SDL_gpu (in klystron), which might run faster in this case as it uses way less draw calls per frame. It's just a matter of one define in the makefile (and installing the library) to enable it. I will check that it still works, since I haven't touched that side of the code in a few months.

DepreTux commented 9 years ago

Hey, I tried under windows and it's almost as slow as in linux. I guess no klystrack on a netbook :(

kometbomb commented 9 years ago

Ok, well, I'm afraid the only solution is to at least use a smaller window, especially when editing the pattern so there is less visible pattern data. All characters are separate draw calls which I believe is the source of slowness. Well, the only solution until this is fixed by using SDL_gpu or whatever.

DepreTux commented 9 years ago

Alright, I switched to commit 8893884944a8eb8319e4be48b65bd6b9b13ce9bd (version 1.5.4, I guess) and compiled on the netbook and it works fine.

Maybe there is still something to do about it? Or it was just the adding of features?

Anyway, thanks for the software, it's cool!

DepreTux commented 9 years ago

i forgot to add i also downgraded to klystron commit 34f7a3579efa20048fe727b823e2b0d0ed7f3539

kometbomb commented 9 years ago

I hope it's not because of the SDL 1.2 -> 2.0 switch (I think it is).

I am currently (as in right now) working on updating the grimfang4/sdl-gpu support, which should handle OGL rendering way better, batching stuff automagically and so on. I think I'll also add something like adding support for pure software rendering in case that works at least a bit faster than accelerated rendering.

kometbomb commented 9 years ago

Ok, so: I updated the SDL_gpu support (in klystron, get the latest commit). You can test this by adding something like this in Makefile (line 48):

EXTFLAGS := -DNOSDL_MIXER -DUSESDLMUTEXES -DENABLEAUDIODUMP -DSTEREOOUTPUT -DUSESDL_IMAGE -DUSESDL_GPU $(EXTFLAGS)
LDFLAGS :=  -L ../klystron/bin.$(CFG) -lengine_gfx -lengine_util -lengine_snd -lengine_gui -lSDL2_gpu -lm $(SDLLIBS) 

You of course need to have the library: https://github.com/grimfang4/sdl-gpu

Can you check if this makes everything work faster?

DepreTux commented 9 years ago

I had to add "-I /usr/local/include/SDL" to klystron's and klystrack's INCLUDEFLAGS. and then it make fails with this error: [code] Compiling gfx.c... src/gfx/gfx.c: In function ‘gfx_update_texture’: src/gfx/gfx.c:820:2: warning: passing argument 2 of ‘GPU_UpdateImage’ from incompatible pointer type [enabled by default] In file included from src/gfx/gfxsurf.h:32:0, from src/gfx/tiledescriptor.h:30, from src/gfx/gfx.h:32, from src/gfx/gfx.c:27: /usr/local/include/SDL/SDL_gpu.h:1006:23: note: expected ‘const struct GPURect ’ but argument is of type ‘struct SDL_Surface ’ src/gfx/gfx.c:820:2: error: too few arguments to function ‘GPU_UpdateImage’ In file included from src/gfx/gfxsurf.h:32:0, from src/gfx/tiledescriptor.h:30, from src/gfx/gfx.h:32, from src/gfx/gfx.c:27: /usr/local/include/SDL/SDL_gpu.h:1006:23: note: declared here make[2]: _* [objs.release/gfx_gfx.o] Error 1 make[2]: Leaving directory /home/fede/downloads/klystrack-repo/klystron' make[1]: *** [build] Error 2 make[1]: Leaving directory/home/fede/downloads/klystrack-repo/klystron' make: *\ [build] Error 2 [/code]