SDL port for Android SDK/NDK 1.6

Quickly share your Android Code Snippets here...

Re: SDL port for Android SDK/NDK 1.6

Postby wryun » Mon Nov 07, 2011 1:07 am

This is probably the wrong place to ask this question, but I've been noticing that pelya's ports of Ur-Quan Masters and Tyrian work reasonably well... as long as the music is off, at which point the framerate drops through the floor. Does anyone have any insights as to why this might be happening, or similar experiences? If I play with the code, are there likely to be any easy ways to improve things?

(Note: it may just be my cruddy Huawei U8300 phone, ARMv6 and no GPU, and seems to burn CPU with non 44.1khz audio based on video playing experience)
wryun
Freshman
Freshman
 
Posts: 2
Joined: Mon Nov 07, 2011 1:04 am

Top

Re: SDL port for Android SDK/NDK 1.6

Postby pelya » Mon Nov 07, 2011 11:06 am

gjtorikian wrote:Ugh, also, I just screwed up my git commit in order to synch to your latest changes. Can you remove me as a collaborator? This is probably the third time I've done something stupid. Not sure how it actually pushed, when all I did was a commit.

Your last commit was done 2 months ago, as my Git history shows, so you did not screw anything.

I'll check the start-up menu timeout set to zero, maybe there's a bug, because I rarely use such setting.

wryun wrote:This is probably the wrong place to ask this question, but I've been noticing that pelya's ports of Ur-Quan Masters and Tyrian work reasonably well... as long as the music is off, at which point the framerate drops through the floor. Does anyone have any insights as to why this might be happening, or similar experiences? If I play with the code, are there likely to be any easy ways to improve things?

(Note: it may just be my cruddy Huawei U8300 phone, ARMv6 and no GPU, and seems to burn CPU with non 44.1khz audio based on video playing experience)


According to the specs, it has 528 MHz CPU and 256 Mb RAM, which is indeed low-profile. UQM uses .OGG music, which is like 2x-3x more CPU intensive compared to playing .MP3 file, and it is using fixed-point decoder which also gives some strain on CPU (I cannot give hard numbers here, just approximation).
OpenTyrian though should not be so slow, because it's music plays through emulated OPL3 chip or something like that.
Anyway, you may try to increase audio buffer size in SDL startup settings, it should give some minor performance improvement (and some audio lag too).
pelya
Master Developer
Master Developer
 
Posts: 323
Joined: Mon Nov 23, 2009 11:31 am

Re: SDL port for Android SDK/NDK 1.6

Postby wryun » Mon Nov 07, 2011 12:23 pm

pelya wrote:UQM uses .OGG music, which is like 2x-3x more CPU intensive compared to playing .MP3 file, and it is using fixed-point decoder which also gives some strain on CPU (I cannot give hard numbers here, just approximation).
OpenTyrian though should not be so slow, because its music plays through emulated OPL3 chip or something like that.


Thanks for the insight (and prompt response). Yes, sounds like the OGGs would mess things up (should have discovered that myself). But isn't the only alternative to the fixed point decoder a floating point one (i.e. probably even worse for ARM)? Also, I assume neither tries to use Android's default audio handling (therefore using a DSP for MP3s at least)...

With OpenTyrian, I guess the OPL3 emu is just the straw the breaks the camel's back on top of the sound effects and the framebuffer. But it's annoying that it apparently works ok on a significantly lower-spec device (GP2X) with only a drop to 22khz audio, whilst Android apparently adds enough overhead for it to fall over completely.
wryun
Freshman
Freshman
 
Posts: 2
Joined: Mon Nov 07, 2011 1:04 am

Re: SDL port for Android SDK/NDK 1.6

Postby pelya » Tue Nov 08, 2011 10:26 am

The audio path in Android is indeed complicated - when SDL generates a new chunk of audio data it feeds that to the Java code (it uses android.media.AudioTrack API), the Java code feeds it to the AudioFlinger system service (which is basically a separate process that manages audio), and AudioFlinger mixes the audio from multiple sources and feeds it to the underlying Alsa drivers. Also almost all apps use 44kHz audio, that depends on the app itself however.

Most middle and high-end phones have hardware floating point support, and it impacts the .OGG decoding speed a lot, however I still cannot give any hard numbers here because I did not do any measurements. On the other hand, high-end phones can decode .OGG with reasonable speed even using fixed-point decoder, and low-end phones do not contain hardware FPU, so I'm usually releasing apps for only fixed-point ARM architecture.

BTW your phone has enough buttons, you may try to disable on-screen controls from SDL startup menu, this should increase FPS for a bit.
pelya
Master Developer
Master Developer
 
Posts: 323
Joined: Mon Nov 23, 2009 11:31 am

Re: SDL port for Android SDK/NDK 1.6

Postby slvn » Thu Nov 10, 2011 6:32 pm

Hello,

Just wondering about internationalization .. not to handle the many encoding available, but how to provide a text in the native language of the user ?

How would you do that? Is it a phone/android property ? would a "getenv(LOCAL)" be fine ?

thanks,
slvn
Developer
Developer
 
Posts: 33
Joined: Thu Jul 28, 2011 7:45 am

Re: SDL port for Android SDK/NDK 1.6

Postby pelya » Thu Nov 10, 2011 6:41 pm

SDL sets environment variables LANGUAGE and LANG to the code of the current Android OS language, before runnong your main(). So getenv("LANG") in the C code will return you something like "en" or "en_US".
pelya
Master Developer
Master Developer
 
Posts: 323
Joined: Mon Nov 23, 2009 11:31 am

Top

Re: SDL port for Android SDK/NDK 1.6

Postby slvn » Thu Nov 10, 2011 7:05 pm

Ok ! Thanks for the fast answer !
slvn
Developer
Developer
 
Posts: 33
Joined: Thu Jul 28, 2011 7:45 am

Re: SDL port for Android SDK/NDK 1.6

Postby gjtorikian » Thu Nov 10, 2011 10:10 pm

It adds the country code too, so you might want to strip it out in your Settings.java file:

Code: Select all
String lang = new String(Locale.getDefault().getLanguage());

      // GJT: Only get country code of PT or ZH
      if (lang.startsWith("zh") || lang.startsWith("pt"))
      {
         if( Locale.getDefault().getCountry().length() > 0 )
            lang = lang + "_" + Locale.getDefault().getCountry();
      }

      System.out.println( "libSDL: setting envvar LANGUAGE to '" + lang + "'");
gjtorikian
Developer
Developer
 
Posts: 46
Joined: Wed May 12, 2010 4:35 pm

Re: SDL port for Android SDK/NDK 1.6

Postby slvn » Fri Nov 11, 2011 9:45 am

Ok thanks for the snapshot ! I do it from native layer, so I get whatever is in getenv("LANG") and only consider the first two chars.


Here's another question : how to add an external Jar into the pelya-build process (without using Eclipse!) ??

And also :
What about putting some extra "user" variables into the AndroidAppSettings.cfg ? So that the user can customize a little bit the *.java templates.
(basically user_field_[1-10] that would appear as Java String in the MainActivity template or as global variable(?)) ?
slvn
Developer
Developer
 
Posts: 33
Joined: Thu Jul 28, 2011 7:45 am

Re: SDL port for Android SDK/NDK 1.6

Postby george.guo » Mon Dec 12, 2011 2:56 pm

Hi Pelya,

I'm trying to port my application to use your SDL port. Compile is able to success, but when run it on emulator, it generate the following error like in logcat. Can you please help check usually what cause this error? Thanks a lot.
Code: Select all
I/System.out(  539): libSDL: loading lib /data/data/com.MtLua.motiontek/files/../lib/libsdl-1.2.so
D/dalvikvm(  539): Trying to load lib /data/data/com.MtLua.motiontek/files/../lib/libsdl-1.2.so 0x413594e0
D/dalvikvm(  539): Added shared lib /data/data/com.MtLua.motiontek/files/../lib/libsdl-1.2.so 0x413594e0
I/System.out(  539): libSDL: loading lib /data/data/com.MtLua.motiontek/files/../lib/libcurl.so
D/dalvikvm(  539): Trying to load lib /data/data/com.MtLua.motiontek/files/../lib/libcurl.so 0x413594e0
D/dalvikvm(  539): Added shared lib /data/data/com.MtLua.motiontek/files/../lib/libcurl.so 0x413594e0
D/dalvikvm(  539): No JNI_OnLoad found in /data/data/com.MtLua.motiontek/files/../lib/libcurl.so 0x413594e0, skipping init
I/System.out(  539): libSDL: loading lib /data/data/com.MtLua.motiontek/files/../lib/libzlib.so
D/dalvikvm(  539): Trying to load lib /data/data/com.MtLua.motiontek/files/../lib/libzlib.so 0x413594e0
D/dalvikvm(  539): Added shared lib /data/data/com.MtLua.motiontek/files/../lib/libzlib.so 0x413594e0
D/dalvikvm(  539): No JNI_OnLoad found in /data/data/com.MtLua.motiontek/files/../lib/libzlib.so 0x413594e0, skipping init
I/System.out(  539): libSDL: loading lib /data/data/com.MtLua.motiontek/files/../lib/liblua.so
D/dalvikvm(  539): Trying to load lib /data/data/com.MtLua.motiontek/files/../lib/liblua.so 0x413594e0
D/dalvikvm(  539): Added shared lib /data/data/com.MtLua.motiontek/files/../lib/liblua.so 0x413594e0
D/dalvikvm(  539): No JNI_OnLoad found in /data/data/com.MtLua.motiontek/files/../lib/liblua.so 0x413594e0, skipping init
I/System.out(  539): libSDL: loading lib /data/data/com.MtLua.motiontek/files/../lib/libsdl_image.so
D/dalvikvm(  539): Trying to load lib /data/data/com.MtLua.motiontek/files/../lib/libsdl_image.so 0x413594e0
D/dalvikvm(  539): Added shared lib /data/data/com.MtLua.motiontek/files/../lib/libsdl_image.so 0x413594e0
D/dalvikvm(  539): No JNI_OnLoad found in /data/data/com.MtLua.motiontek/files/../lib/libsdl_image.so 0x413594e0, skipping init
I/System.out(  539): libSDL: Loading settings
I/System.out(  539): libSDL: Settings.Load(): enter
I/System.out(  539): libSDL: Settings.Load(): loading settings failed, running config dialog
I/System.out(  539): libSDL: stdout-test passed, your libc seems to be good
D/gralloc_goldfish(  539): Emulator without GPU emulation detected.
I/ActivityManager(   84): Displayed com.MtLua.motiontek/.MainActivity: +2s707ms
V/PhoneStatusBar(  138): setLightsOn(true)
W/NetworkManagementSocketTagger(   84): setKernelCountSet(10004, 0) failed with errno -2
D/dalvikvm(   84): GC_EXPLICIT freed 126K, 7% free 12789K/13639K, paused 5ms+35ms
I/System.out(  539): libSDL: Starting data downloader
I/System.out(  539): libSDL: Starting downloader
V/PhoneStatusBar(  138): setLightsOn(true)
W/InputManagerService(   84): Starting input on non-focused client com.android.internal.view.IInputMethodClient$Stub$Proxy@414f69b8 (uid=10004 pid=174)
W/IInputConnectionWrapper(  174): showStatusIcon on inactive InputConnection
D/dalvikvm(  539): GC_CONCURRENT freed 791K, 8% free 11175K/12103K, paused 5ms+4ms
I/System.out(  539): libSDL: Initializing video and SDL application
V/SDL     (  539): GLSurfaceView_SDL::EglHelper::start(): creating GL context
D/libEGL  (  539): Emulator without GPU support detected. Fallback to software renderer.
D/libEGL  (  539): loaded /system/lib/egl/libGLES_android.so
V/SDL     (  539): GL config 0: R5G6B5A0 depth 0 stencil 0 type 1 (GLES) caveat SLOW nr 1 pos 5
V/SDL     (  539): GL config 1: R5G6B5A0 depth 16 stencil 0 type 1 (GLES) caveat SLOW nr 1 pos 10
V/SDL     (  539): GL config 2: R8G8B8A0 depth 0 stencil 0 type 1 (GLES) caveat SLOW nr 1 pos 13
V/SDL     (  539): GL config 3: R8G8B8A0 depth 16 stencil 0 type 1 (GLES) caveat SLOW nr 1 pos 18
V/SDL     (  539): GL config 4: R8G8B8A8 depth 0 stencil 0 type 1 (GLES) caveat SLOW nr 1 pos 21
V/SDL     (  539): GL config 5: R8G8B8A8 depth 16 stencil 0 type 1 (GLES) caveat SLOW nr 1 pos 26
V/SDL     (  539): GL config 6: R0G0B0A8 depth 0 stencil 0 type 1 (GLES) caveat SLOW nr 1 pos 29
V/SDL     (  539): GL config 7: R0G0B0A8 depth 16 stencil 0 type 1 (GLES) caveat SLOW nr 1 pos 34
V/SDL     (  539): GLSurfaceView_SDL::EGLConfigChooser::chooseConfig(): selected 0: R5G6B5A0 depth 0 stencil 0 type 1 (GLES) caveat SLOW nr 1 pos 5
V/SDL     (  539): GLSurfaceView_SDL::EglHelper::createSurface(): creating GL context
I/System.out(  539): libSDL: DemoRenderer.onSurfaceCreated(): paused false mFirstTimeStart true
I/libSDL  (  539): Physical screen resolution is 800x480, virtual screen 800x480
D/dalvikvm(  539): GC_FOR_ALLOC freed 140K, 9% free 11107K/12103K, paused 32ms
D/dalvikvm(  539): GC_CONCURRENT freed 14K, 5% free 11569K/12103K, paused 4ms+3ms
D/dalvikvm(  539): GC_FOR_ALLOC freed <1K, 5% free 11569K/12103K, paused 29ms
I/dalvikvm-heap(  539): Grow heap (frag case) to 11.856MB for 486264-byte allocation
D/dalvikvm(  539): GC_FOR_ALLOC freed <1K, 5% free 12044K/12615K, paused 29ms
I/ARMAssembler(  539): generated scanline__00000177:03010104_00009001_00000000 [119 ipp] (144 ins) at [0x47d451e8:0x47d45428] in 6386001 ns
D/dalvikvm(  539): Trying to load lib /mnt/asec/com.MtLua.motiontek-1/lib/libapplication.so 0x413594e0
D/dalvikvm(  539): Added shared lib /mnt/asec/com.MtLua.motiontek-1/lib/libapplication.so 0x413594e0
D/dalvikvm(  539): No JNI_OnLoad found in /mnt/asec/com.MtLua.motiontek-1/lib/libapplication.so 0x413594e0, skipping init
D/dalvikvm(  539): Trying to load lib /mnt/asec/com.MtLua.motiontek-1/lib/libsdl_main.so 0x413594e0
I/System.out(  539): libSDL: error loading lib: java.lang.UnsatisfiedLinkError: Cannot load library: get_lib_extents[777]:    35 - No loadable segments found in /mnt/asec/com.MtLua.motiontek-1/lib/libsdl_main.so.
I/System.out(  539): libSDL: loading lib /data/data/com.MtLua.motiontek/cache/libapplication.so
D/dalvikvm(  539): Trying to load lib /data/data/com.MtLua.motiontek/cache/libapplication.so 0x413594e0
D/dalvikvm(  539): Added shared lib /data/data/com.MtLua.motiontek/cache/libapplication.so 0x413594e0
D/dalvikvm(  539): No JNI_OnLoad found in /data/data/com.MtLua.motiontek/cache/libapplication.so 0x413594e0, skipping init
I/System.out(  539): libSDL: loading lib /data/data/com.MtLua.motiontek/cache/libsdl_main.so
D/dalvikvm(  539): Trying to load lib /data/data/com.MtLua.motiontek/cache/libsdl_main.so 0x413594e0
I/System.out(  539): libSDL: error loading lib: java.lang.UnsatisfiedLinkError: Cannot load library: load_library[1091]: Library '/data/data/com.MtLua.motiontek/cache/libsdl_main.so' not found
D/dalvikvm(  539): GC_FOR_ALLOC freed 1130K, 13% free 11273K/12871K, paused 30ms
D/dalvikvm(  539): GC_CONCURRENT freed 427K, 13% free 11301K/12871K, paused 4ms+4ms
D/dalvikvm(  539): GC_FOR_ALLOC freed 440K, 12% free 11331K/12871K, paused 37ms
D/dalvikvm(  539): GC_CONCURRENT freed 439K, 12% free 11345K/12871K, paused 4ms+3ms
D/dalvikvm(  539): GC_FOR_ALLOC freed 374K, 12% free 11362K/12871K, paused 31ms
D/dalvikvm(  539): GC_CONCURRENT freed 423K, 12% free 11376K/12871K, paused 4ms+4ms
D/dalvikvm(  539): GC_FOR_ALLOC freed 461K, 12% free 11388K/12871K, paused 30ms
D/dalvikvm(  539): GC_FOR_ALLOC freed 329K, 12% free 11399K/12871K, paused 31ms
D/dalvikvm(  539): GC_FOR_ALLOC freed 357K, 12% free 11412K/12871K, paused 31ms
D/dalvikvm(  539): GC_CONCURRENT freed 381K, 12% free 11423K/12871K, paused 5ms+3ms
D/dalvikvm(  539): GC_FOR_ALLOC freed 397K, 12% free 11429K/12871K, paused 31ms
D/dalvikvm(  539): GC_CONCURRENT freed 412K, 12% free 11436K/12871K, paused 4ms+3ms
D/dalvikvm(  539): GC_FOR_ALLOC freed 427K, 12% free 11446K/12871K, paused 36ms
D/dalvikvm(  539): GC_CONCURRENT freed 444K, 11% free 11459K/12871K, paused 3ms+4ms
D/dalvikvm(  539): GC_FOR_ALLOC freed 233K, 11% free 11468K/12871K, paused 31ms
D/dalvikvm(  539): GC_FOR_ALLOC freed 242K, 11% free 11476K/12871K, paused 29ms
D/dalvikvm(  539): GC_FOR_ALLOC freed 250K, 11% free 11479K/12871K, paused 31ms
D/dalvikvm(  539): GC_FOR_ALLOC freed 253K, 11% free 11483K/12871K, paused 33ms
I/System.out(  539): libSDL: setting envvar LANGUAGE to 'en_US'
I/System.out(  539): libSDL: accelerometer start required: false
W/dalvikvm(  539): No implementation found for native Lcom/MtLua/motiontek/DemoRenderer;.nativeInit (Ljava/lang/String;Ljava/lang/String;I)V
W/dalvikvm(  539): threadid=12: thread exiting with uncaught exception (group=0x409951f8)
E/AndroidRuntime(  539): FATAL EXCEPTION: GLThread
E/AndroidRuntime(  539): java.lang.UnsatisfiedLinkError: nativeInit
E/AndroidRuntime(  539):    at com.MtLua.motiontek.DemoRenderer.nativeInit(Native Method)
E/AndroidRuntime(  539):    at com.MtLua.motiontek.DemoRenderer.onDrawFrame(Video.java:322)
E/AndroidRuntime(  539):    at com.MtLua.motiontek.GLSurfaceView_SDL$GLThread.run(GLSurfaceView_SDL.java:1000)
W/ActivityManager(   84):   Force finishing activity com.MtLua.motiontek/.MainActivity
W/WindowManager(   84): Failure taking screenshot for (180x300) to layer 21015
I/System.out(  539): libSDL: stopping accelerometer
V/SDL     (  539): GLSurfaceView_SDL::onPause()
I/InputReader(   84): Reconfiguring input devices.  changes=0x00000004
I/InputReader(   84): Device reconfigured: id=0, name='qwerty2', surface size is now 480x800, mode is 1
I/ActivityManager(   84): Config changed: {1.0 310mcc260mnc en_US layoutdir=0 sw320dp w320dp h533dp nrml long port finger qwerty/v/v tball/v s.5}
W/NetworkManagementSocketTagger(   84): setKernelCountSet(10004, 1) failed with errno -2
W/NetworkManagementSocketTagger(   84): setKernelCountSet(10042, 0) failed with errno -2
I/dalvikvm(   84): Jit: resizing JitTable from 4096 to 8192
I/ARMAssembler(   34): generated scanline__00000177:03515104_00008001_00000000 [134 ipp] (158 ins) at [0x412f14b0:0x412f1728] in 4985000 ns
D/dalvikvm(  138): GC_CONCURRENT freed 5637K, 36% free 10727K/16519K, paused 5ms+33ms
I/libSDL  (  539): quitting...
I/libSDL  (  539): quit OK
E/JavaBinder(  539): Unknown binder error code. 0xfffffff7
I/Process (  539): Sending signal. PID: 539 SIG: 9
I/WindowManager(   84): WIN DEATH: Window{415c12e8 SurfaceView paused=false}
I/ActivityManager(   84): Process com.MtLua.motiontek (pid 539) has died.
W/InputDispatcher(   84): channel '41698af8 com.MtLua.motiontek/com.MtLua.motiontek.MainActivity (server)' ~ Consumer closed input channel or an error occurred.  events=0x8
E/InputDispatcher(   84): channel '41698af8 com.MtLua.motiontek/com.MtLua.motiontek.MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
I/WindowManager(   84): WIN DEATH: Window{41698af8 com.MtLua.motiontek/com.MtLua.motiontek.MainActivity paused=false}
W/InputDispatcher(   84): Attempted to unregister already unregistered input channel '41698af8 com.MtLua.motiontek/com.MtLua.motiontek.MainActivity (server)'
I/WindowManager(   84): WINDOW DIED Window{41698af8 com.MtLua.motiontek/com.MtLua.motiontek.MainActivity paused=false}
W/InputManagerService(   84): Got RemoteException sending setActive(false) notification to pid 539 uid 10042
D/dalvikvm(   84): GC_EXPLICIT freed 112K, 6% free 12858K/13639K, paused 5ms+9ms
W/ActivityManager(   84): Activity destroy timeout for ActivityRecord{41518db8 com.MtLua.motiontek/.MainActivity}
W/ThrottleService(   84): unable to find stats for iface rmnet0
F/NetworkStats(   84): problem reading network stats
george.guo
Freshman
Freshman
 
Posts: 5
Joined: Mon Dec 12, 2011 2:44 pm

Re: SDL port for Android SDK/NDK 1.6

Postby george.guo » Mon Dec 12, 2011 2:57 pm

Hi Pelya,

I'm trying to port my application to use your SDL port. Compile is able to success, but when run it on emulator, it generate the following error like in logcat. Can you please help check usually what cause this error? Thanks a lot.
Code: Select all
I/System.out(  539): libSDL: loading lib /data/data/com.MtLua.motiontek/files/../lib/libsdl-1.2.so
D/dalvikvm(  539): Trying to load lib /data/data/com.MtLua.motiontek/files/../lib/libsdl-1.2.so 0x413594e0
D/dalvikvm(  539): Added shared lib /data/data/com.MtLua.motiontek/files/../lib/libsdl-1.2.so 0x413594e0
I/System.out(  539): libSDL: loading lib /data/data/com.MtLua.motiontek/files/../lib/libcurl.so
D/dalvikvm(  539): Trying to load lib /data/data/com.MtLua.motiontek/files/../lib/libcurl.so 0x413594e0
D/dalvikvm(  539): Added shared lib /data/data/com.MtLua.motiontek/files/../lib/libcurl.so 0x413594e0
D/dalvikvm(  539): No JNI_OnLoad found in /data/data/com.MtLua.motiontek/files/../lib/libcurl.so 0x413594e0, skipping init
I/System.out(  539): libSDL: loading lib /data/data/com.MtLua.motiontek/files/../lib/libzlib.so
D/dalvikvm(  539): Trying to load lib /data/data/com.MtLua.motiontek/files/../lib/libzlib.so 0x413594e0
D/dalvikvm(  539): Added shared lib /data/data/com.MtLua.motiontek/files/../lib/libzlib.so 0x413594e0
D/dalvikvm(  539): No JNI_OnLoad found in /data/data/com.MtLua.motiontek/files/../lib/libzlib.so 0x413594e0, skipping init
I/System.out(  539): libSDL: loading lib /data/data/com.MtLua.motiontek/files/../lib/liblua.so
D/dalvikvm(  539): Trying to load lib /data/data/com.MtLua.motiontek/files/../lib/liblua.so 0x413594e0
D/dalvikvm(  539): Added shared lib /data/data/com.MtLua.motiontek/files/../lib/liblua.so 0x413594e0
D/dalvikvm(  539): No JNI_OnLoad found in /data/data/com.MtLua.motiontek/files/../lib/liblua.so 0x413594e0, skipping init
I/System.out(  539): libSDL: loading lib /data/data/com.MtLua.motiontek/files/../lib/libsdl_image.so
D/dalvikvm(  539): Trying to load lib /data/data/com.MtLua.motiontek/files/../lib/libsdl_image.so 0x413594e0
D/dalvikvm(  539): Added shared lib /data/data/com.MtLua.motiontek/files/../lib/libsdl_image.so 0x413594e0
D/dalvikvm(  539): No JNI_OnLoad found in /data/data/com.MtLua.motiontek/files/../lib/libsdl_image.so 0x413594e0, skipping init
I/System.out(  539): libSDL: Loading settings
I/System.out(  539): libSDL: Settings.Load(): enter
I/System.out(  539): libSDL: Settings.Load(): loading settings failed, running config dialog
I/System.out(  539): libSDL: stdout-test passed, your libc seems to be good
D/gralloc_goldfish(  539): Emulator without GPU emulation detected.
I/ActivityManager(   84): Displayed com.MtLua.motiontek/.MainActivity: +2s707ms
V/PhoneStatusBar(  138): setLightsOn(true)
W/NetworkManagementSocketTagger(   84): setKernelCountSet(10004, 0) failed with errno -2
D/dalvikvm(   84): GC_EXPLICIT freed 126K, 7% free 12789K/13639K, paused 5ms+35ms
I/System.out(  539): libSDL: Starting data downloader
I/System.out(  539): libSDL: Starting downloader
V/PhoneStatusBar(  138): setLightsOn(true)
W/InputManagerService(   84): Starting input on non-focused client com.android.internal.view.IInputMethodClient$Stub$Proxy@414f69b8 (uid=10004 pid=174)
W/IInputConnectionWrapper(  174): showStatusIcon on inactive InputConnection
D/dalvikvm(  539): GC_CONCURRENT freed 791K, 8% free 11175K/12103K, paused 5ms+4ms
I/System.out(  539): libSDL: Initializing video and SDL application
V/SDL     (  539): GLSurfaceView_SDL::EglHelper::start(): creating GL context
D/libEGL  (  539): Emulator without GPU support detected. Fallback to software renderer.
D/libEGL  (  539): loaded /system/lib/egl/libGLES_android.so
V/SDL     (  539): GL config 0: R5G6B5A0 depth 0 stencil 0 type 1 (GLES) caveat SLOW nr 1 pos 5
V/SDL     (  539): GL config 1: R5G6B5A0 depth 16 stencil 0 type 1 (GLES) caveat SLOW nr 1 pos 10
V/SDL     (  539): GL config 2: R8G8B8A0 depth 0 stencil 0 type 1 (GLES) caveat SLOW nr 1 pos 13
V/SDL     (  539): GL config 3: R8G8B8A0 depth 16 stencil 0 type 1 (GLES) caveat SLOW nr 1 pos 18
V/SDL     (  539): GL config 4: R8G8B8A8 depth 0 stencil 0 type 1 (GLES) caveat SLOW nr 1 pos 21
V/SDL     (  539): GL config 5: R8G8B8A8 depth 16 stencil 0 type 1 (GLES) caveat SLOW nr 1 pos 26
V/SDL     (  539): GL config 6: R0G0B0A8 depth 0 stencil 0 type 1 (GLES) caveat SLOW nr 1 pos 29
V/SDL     (  539): GL config 7: R0G0B0A8 depth 16 stencil 0 type 1 (GLES) caveat SLOW nr 1 pos 34
V/SDL     (  539): GLSurfaceView_SDL::EGLConfigChooser::chooseConfig(): selected 0: R5G6B5A0 depth 0 stencil 0 type 1 (GLES) caveat SLOW nr 1 pos 5
V/SDL     (  539): GLSurfaceView_SDL::EglHelper::createSurface(): creating GL context
I/System.out(  539): libSDL: DemoRenderer.onSurfaceCreated(): paused false mFirstTimeStart true
I/libSDL  (  539): Physical screen resolution is 800x480, virtual screen 800x480
D/dalvikvm(  539): GC_FOR_ALLOC freed 140K, 9% free 11107K/12103K, paused 32ms
D/dalvikvm(  539): GC_CONCURRENT freed 14K, 5% free 11569K/12103K, paused 4ms+3ms
D/dalvikvm(  539): GC_FOR_ALLOC freed <1K, 5% free 11569K/12103K, paused 29ms
I/dalvikvm-heap(  539): Grow heap (frag case) to 11.856MB for 486264-byte allocation
D/dalvikvm(  539): GC_FOR_ALLOC freed <1K, 5% free 12044K/12615K, paused 29ms
I/ARMAssembler(  539): generated scanline__00000177:03010104_00009001_00000000 [119 ipp] (144 ins) at [0x47d451e8:0x47d45428] in 6386001 ns
D/dalvikvm(  539): Trying to load lib /mnt/asec/com.MtLua.motiontek-1/lib/libapplication.so 0x413594e0
D/dalvikvm(  539): Added shared lib /mnt/asec/com.MtLua.motiontek-1/lib/libapplication.so 0x413594e0
D/dalvikvm(  539): No JNI_OnLoad found in /mnt/asec/com.MtLua.motiontek-1/lib/libapplication.so 0x413594e0, skipping init
D/dalvikvm(  539): Trying to load lib /mnt/asec/com.MtLua.motiontek-1/lib/libsdl_main.so 0x413594e0
I/System.out(  539): libSDL: error loading lib: java.lang.UnsatisfiedLinkError: Cannot load library: get_lib_extents[777]:    35 - No loadable segments found in /mnt/asec/com.MtLua.motiontek-1/lib/libsdl_main.so.
I/System.out(  539): libSDL: loading lib /data/data/com.MtLua.motiontek/cache/libapplication.so
D/dalvikvm(  539): Trying to load lib /data/data/com.MtLua.motiontek/cache/libapplication.so 0x413594e0
D/dalvikvm(  539): Added shared lib /data/data/com.MtLua.motiontek/cache/libapplication.so 0x413594e0
D/dalvikvm(  539): No JNI_OnLoad found in /data/data/com.MtLua.motiontek/cache/libapplication.so 0x413594e0, skipping init
I/System.out(  539): libSDL: loading lib /data/data/com.MtLua.motiontek/cache/libsdl_main.so
D/dalvikvm(  539): Trying to load lib /data/data/com.MtLua.motiontek/cache/libsdl_main.so 0x413594e0
I/System.out(  539): libSDL: error loading lib: java.lang.UnsatisfiedLinkError: Cannot load library: load_library[1091]: Library '/data/data/com.MtLua.motiontek/cache/libsdl_main.so' not found
D/dalvikvm(  539): GC_FOR_ALLOC freed 1130K, 13% free 11273K/12871K, paused 30ms
D/dalvikvm(  539): GC_CONCURRENT freed 427K, 13% free 11301K/12871K, paused 4ms+4ms
D/dalvikvm(  539): GC_FOR_ALLOC freed 440K, 12% free 11331K/12871K, paused 37ms
D/dalvikvm(  539): GC_CONCURRENT freed 439K, 12% free 11345K/12871K, paused 4ms+3ms
D/dalvikvm(  539): GC_FOR_ALLOC freed 374K, 12% free 11362K/12871K, paused 31ms
D/dalvikvm(  539): GC_CONCURRENT freed 423K, 12% free 11376K/12871K, paused 4ms+4ms
D/dalvikvm(  539): GC_FOR_ALLOC freed 461K, 12% free 11388K/12871K, paused 30ms
D/dalvikvm(  539): GC_FOR_ALLOC freed 329K, 12% free 11399K/12871K, paused 31ms
D/dalvikvm(  539): GC_FOR_ALLOC freed 357K, 12% free 11412K/12871K, paused 31ms
D/dalvikvm(  539): GC_CONCURRENT freed 381K, 12% free 11423K/12871K, paused 5ms+3ms
D/dalvikvm(  539): GC_FOR_ALLOC freed 397K, 12% free 11429K/12871K, paused 31ms
D/dalvikvm(  539): GC_CONCURRENT freed 412K, 12% free 11436K/12871K, paused 4ms+3ms
D/dalvikvm(  539): GC_FOR_ALLOC freed 427K, 12% free 11446K/12871K, paused 36ms
D/dalvikvm(  539): GC_CONCURRENT freed 444K, 11% free 11459K/12871K, paused 3ms+4ms
D/dalvikvm(  539): GC_FOR_ALLOC freed 233K, 11% free 11468K/12871K, paused 31ms
D/dalvikvm(  539): GC_FOR_ALLOC freed 242K, 11% free 11476K/12871K, paused 29ms
D/dalvikvm(  539): GC_FOR_ALLOC freed 250K, 11% free 11479K/12871K, paused 31ms
D/dalvikvm(  539): GC_FOR_ALLOC freed 253K, 11% free 11483K/12871K, paused 33ms
I/System.out(  539): libSDL: setting envvar LANGUAGE to 'en_US'
I/System.out(  539): libSDL: accelerometer start required: false
W/dalvikvm(  539): No implementation found for native Lcom/MtLua/motiontek/DemoRenderer;.nativeInit (Ljava/lang/String;Ljava/lang/String;I)V
W/dalvikvm(  539): threadid=12: thread exiting with uncaught exception (group=0x409951f8)
E/AndroidRuntime(  539): FATAL EXCEPTION: GLThread
E/AndroidRuntime(  539): java.lang.UnsatisfiedLinkError: nativeInit
E/AndroidRuntime(  539):    at com.MtLua.motiontek.DemoRenderer.nativeInit(Native Method)
E/AndroidRuntime(  539):    at com.MtLua.motiontek.DemoRenderer.onDrawFrame(Video.java:322)
E/AndroidRuntime(  539):    at com.MtLua.motiontek.GLSurfaceView_SDL$GLThread.run(GLSurfaceView_SDL.java:1000)
W/ActivityManager(   84):   Force finishing activity com.MtLua.motiontek/.MainActivity
W/WindowManager(   84): Failure taking screenshot for (180x300) to layer 21015
I/System.out(  539): libSDL: stopping accelerometer
V/SDL     (  539): GLSurfaceView_SDL::onPause()
I/InputReader(   84): Reconfiguring input devices.  changes=0x00000004
I/InputReader(   84): Device reconfigured: id=0, name='qwerty2', surface size is now 480x800, mode is 1
I/ActivityManager(   84): Config changed: {1.0 310mcc260mnc en_US layoutdir=0 sw320dp w320dp h533dp nrml long port finger qwerty/v/v tball/v s.5}
W/NetworkManagementSocketTagger(   84): setKernelCountSet(10004, 1) failed with errno -2
W/NetworkManagementSocketTagger(   84): setKernelCountSet(10042, 0) failed with errno -2
I/dalvikvm(   84): Jit: resizing JitTable from 4096 to 8192
I/ARMAssembler(   34): generated scanline__00000177:03515104_00008001_00000000 [134 ipp] (158 ins) at [0x412f14b0:0x412f1728] in 4985000 ns
D/dalvikvm(  138): GC_CONCURRENT freed 5637K, 36% free 10727K/16519K, paused 5ms+33ms
I/libSDL  (  539): quitting...
I/libSDL  (  539): quit OK
E/JavaBinder(  539): Unknown binder error code. 0xfffffff7
I/Process (  539): Sending signal. PID: 539 SIG: 9
I/WindowManager(   84): WIN DEATH: Window{415c12e8 SurfaceView paused=false}
I/ActivityManager(   84): Process com.MtLua.motiontek (pid 539) has died.
W/InputDispatcher(   84): channel '41698af8 com.MtLua.motiontek/com.MtLua.motiontek.MainActivity (server)' ~ Consumer closed input channel or an error occurred.  events=0x8
E/InputDispatcher(   84): channel '41698af8 com.MtLua.motiontek/com.MtLua.motiontek.MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
I/WindowManager(   84): WIN DEATH: Window{41698af8 com.MtLua.motiontek/com.MtLua.motiontek.MainActivity paused=false}
W/InputDispatcher(   84): Attempted to unregister already unregistered input channel '41698af8 com.MtLua.motiontek/com.MtLua.motiontek.MainActivity (server)'
I/WindowManager(   84): WINDOW DIED Window{41698af8 com.MtLua.motiontek/com.MtLua.motiontek.MainActivity paused=false}
W/InputManagerService(   84): Got RemoteException sending setActive(false) notification to pid 539 uid 10042
D/dalvikvm(   84): GC_EXPLICIT freed 112K, 6% free 12858K/13639K, paused 5ms+9ms
W/ActivityManager(   84): Activity destroy timeout for ActivityRecord{41518db8 com.MtLua.motiontek/.MainActivity}
W/ThrottleService(   84): unable to find stats for iface rmnet0
F/NetworkStats(   84): problem reading network stats
george.guo
Freshman
Freshman
 
Posts: 5
Joined: Mon Dec 12, 2011 2:44 pm

Re: SDL port for Android SDK/NDK 1.6

Postby pelya » Tue Dec 13, 2011 11:17 am

Could you please check that the main() function in your sources actually called SDL_main() ? It happens automatically if you do "#include <SDL.h>" in the file where you're defining main() (it's done like "#define main SDL_main"), you can always do that by hand though.
pelya
Master Developer
Master Developer
 
Posts: 323
Joined: Mon Nov 23, 2009 11:31 am

Re: SDL port for Android SDK/NDK 1.6

Postby george.guo » Tue Dec 13, 2011 2:52 pm

I've included ""#include <SDL.h>"", I also tried direclty to change "main" to "SDL_main". But the result is the same. Though we found if make some change, e.g. add or remove some __android_log_print(), sometimes it could build successfully and run correctly on emulator. Is this SDL.h able to include in other .c file without main function? I ever included it in another .c file, I remove it just now and compile again, the new generated apk can run on emulator. But there is new error like the log below. PS: I build using android-ndk-r7.

Code: Select all
W/InputManagerService(   73): Starting input on non-focused client com.android.internal.view.IInputMethodClient$Stub$Proxy@41614a48 (uid=10004 pid=182)
I/System.out(  581): libSDL: Initializing video and SDL application
D/dalvikvm(  581): GC_CONCURRENT freed 793K, 8% free 11176K/12103K, paused 4ms+54ms
V/SDL     (  581): GLSurfaceView_SDL::EglHelper::start(): creating GL context
D/libEGL  (  581): Emulator without GPU support detected. Fallback to software renderer.
D/libEGL  (  581): loaded /system/lib/egl/libGLES_android.so
V/SDL     (  581): GL config 0: R5G6B5A0 depth 0 stencil 0 type 1 (GLES) caveat SLOW nr 1 pos 5
V/SDL     (  581): GL config 1: R5G6B5A0 depth 16 stencil 0 type 1 (GLES) caveat SLOW nr 1 pos 10
V/SDL     (  581): GL config 2: R8G8B8A0 depth 0 stencil 0 type 1 (GLES) caveat SLOW nr 1 pos 13
V/SDL     (  581): GL config 3: R8G8B8A0 depth 16 stencil 0 type 1 (GLES) caveat SLOW nr 1 pos 18
V/SDL     (  581): GL config 4: R8G8B8A8 depth 0 stencil 0 type 1 (GLES) caveat SLOW nr 1 pos 21
V/SDL     (  581): GL config 5: R8G8B8A8 depth 16 stencil 0 type 1 (GLES) caveat SLOW nr 1 pos 26
V/SDL     (  581): GL config 6: R0G0B0A8 depth 0 stencil 0 type 1 (GLES) caveat SLOW nr 1 pos 29
V/SDL     (  581): GL config 7: R0G0B0A8 depth 16 stencil 0 type 1 (GLES) caveat SLOW nr 1 pos 34
V/SDL     (  581): GLSurfaceView_SDL::EGLConfigChooser::chooseConfig(): selected 0: R5G6B5A0 depth 0 stencil 0 type 1 (GLES) caveat SLOW nr 1 pos 5
V/SDL     (  581): GLSurfaceView_SDL::EglHelper::createSurface(): creating GL context
I/System.out(  581): libSDL: DemoRenderer.onSurfaceCreated(): paused false mFirstTimeStart true
I/libSDL  (  581): Physical screen resolution is 800x480, virtual screen 800x480
W/InputMethodManager(  581): Ignoring onBind: cur seq=11, given seq=10
D/dalvikvm(  581): GC_FOR_ALLOC freed 137K, 9% free 11106K/12103K, paused 37ms
D/dalvikvm(  581): GC_CONCURRENT freed 12K, 5% free 11568K/12103K, paused 5ms+16ms
D/dalvikvm(  581): GC_FOR_ALLOC freed <1K, 5% free 11568K/12103K, paused 29ms
I/dalvikvm-heap(  581): Grow heap (frag case) to 11.855MB for 486264-byte allocation
D/dalvikvm(  581): GC_CONCURRENT freed <1K, 5% free 12043K/12615K, paused 4ms+4ms
I/ARMAssembler(  581): generated scanline__00000177:03010104_00009001_00000000 [119 ipp] (144 ins) at [0x47c8a1e8:0x47c8a428] in 6254000 ns
D/dalvikvm(  581): Trying to load lib /mnt/asec/com.MtLua.motiontek-1/lib/libapplication.so 0x4135afe0
D/dalvikvm(  581): Added shared lib /mnt/asec/com.MtLua.motiontek-1/lib/libapplication.so 0x4135afe0
D/dalvikvm(  581): No JNI_OnLoad found in /mnt/asec/com.MtLua.motiontek-1/lib/libapplication.so 0x4135afe0, skipping init
D/dalvikvm(  581): Trying to load lib /mnt/asec/com.MtLua.motiontek-1/lib/libsdl_main.so 0x4135afe0
D/dalvikvm(  581): Added shared lib /mnt/asec/com.MtLua.motiontek-1/lib/libsdl_main.so 0x4135afe0
D/dalvikvm(  581): No JNI_OnLoad found in /mnt/asec/com.MtLua.motiontek-1/lib/libsdl_main.so 0x4135afe0, skipping init
D/dalvikvm(  581): GC_FOR_ALLOC freed 1125K, 13% free 11270K/12871K, paused 30ms
D/dalvikvm(  581): GC_CONCURRENT freed 427K, 13% free 11298K/12871K, paused 4ms+3ms
D/dalvikvm(  581): GC_FOR_ALLOC freed 440K, 12% free 11328K/12871K, paused 34ms
D/dalvikvm(  581): GC_CONCURRENT freed 439K, 12% free 11342K/12871K, paused 4ms+3ms
D/dalvikvm(  581): GC_FOR_ALLOC freed 374K, 12% free 11359K/12871K, paused 31ms
D/dalvikvm(  581): GC_CONCURRENT freed 423K, 12% free 11373K/12871K, paused 4ms+5ms
D/dalvikvm(  581): GC_FOR_ALLOC freed 461K, 12% free 11385K/12871K, paused 30ms
D/dalvikvm(  581): GC_FOR_ALLOC freed 329K, 12% free 11396K/12871K, paused 30ms
D/dalvikvm(  581): GC_FOR_ALLOC freed 357K, 12% free 11409K/12871K, paused 32ms
D/dalvikvm(  581): GC_CONCURRENT freed 381K, 12% free 11420K/12871K, paused 4ms+4ms
D/dalvikvm(  581): GC_FOR_ALLOC freed 397K, 12% free 11426K/12871K, paused 32ms
D/dalvikvm(  581): GC_CONCURRENT freed 412K, 12% free 11433K/12871K, paused 4ms+3ms
D/dalvikvm(  581): GC_FOR_ALLOC freed 427K, 12% free 11443K/12871K, paused 30ms
D/dalvikvm(  581): GC_CONCURRENT freed 444K, 11% free 11456K/12871K, paused 3ms+4ms
D/dalvikvm(  581): GC_FOR_ALLOC freed 233K, 11% free 11465K/12871K, paused 31ms
D/dalvikvm(  581): GC_FOR_ALLOC freed 242K, 11% free 11473K/12871K, paused 32ms
D/dalvikvm(  581): GC_FOR_ALLOC freed 250K, 11% free 11476K/12871K, paused 32ms
D/dalvikvm(  581): GC_FOR_ALLOC freed 253K, 11% free 11480K/12871K, paused 35ms
I/System.out(  581): libSDL: setting envvar LANGUAGE to 'en_US'
I/System.out(  581): libSDL: accelerometer start required: false
I/libSDL  (  581): Changing curdir to "/mnt/sdcard/app-data/com.MtLua.motiontek"
I/libSDL  (  581): Calling SDL_main("/mnt/sdcard/app-data/com.MtLua.motiontek/main.lua")
I/libSDL  (  581): param 0 = "/mnt/sdcard/app-data/com.MtLua.motiontek/main.lua"
I/MtLua   (  581): main() 0
I/MtLua   (  581): main() 1
I/MtLua   (  581): main() 2
I/MtLua   (  581): main() 3
I/MtLua   (  581): main() 4
F/libc    (  581): Fatal signal 11 (SIGSEGV) at 0xffffffff (code=1)
I/DEBUG   (   32): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
I/DEBUG   (   32): Build fingerprint: 'generic/sdk/generic:4.0.1/ICS_MR0/202595:eng/test-keys'
I/DEBUG   (   32): pid: 581, tid: 598  >>> com.MtLua.motiontek <<<
I/DEBUG   (   32): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr ffffffff
I/DEBUG   (   32):  r0 ffffffff  r1 47acbb00  r2 00000003  r3 00000000
I/DEBUG   (   32):  r4 47acbafc  r5 00000002  r6 00000000  r7 47acb028
I/DEBUG   (   32):  r8 47acb66c  r9 ffffffff  10 00000073  fp 47acb0d0
I/DEBUG   (   32):  ip ffffffff  sp 47acaf60  lr 4002116f  pc 4001a740  cpsr 20000010
I/DEBUG   (   32):  d0  3f8000003f800000  d1  0000000000000000
I/DEBUG   (   32):  d2  0000000000000000  d3  0000000000000000
I/DEBUG   (   32):  d4  437000003f800000  d5  4370000043c80000
I/DEBUG   (   32):  d6  00c91fe03f800000  d7  0000001400000000
I/DEBUG   (   32):  d8  0000000000000000  d9  0000000000000000
I/DEBUG   (   32):  d10 0000000000000000  d11 0000000000000000
I/DEBUG   (   32):  d12 0000000000000000  d13 0000000000000000
I/DEBUG   (   32):  d14 0000000000000000  d15 0000000000000000
I/DEBUG   (   32):  scr 60000012
I/DEBUG   (   32):
I/DEBUG   (   32):          #00  pc 00016740  /system/lib/libc.so (strlen)
I/DEBUG   (   32):          #01  pc 0001d16c  /system/lib/libc.so (__vfprintf)
I/DEBUG   (   32):
I/DEBUG   (   32): code around pc:
I/DEBUG   (   32): 4001a720 bf00bd10 ffff0ff0 e24dd008 e2102003
I/DEBUG   (   32): 4001a730 f5d0f000 f5d0f020 e58d0004 0a00000f
I/DEBUG   (   32): 4001a740 e5d02000 e3520000 12803001 13a02000
george.guo
Freshman
Freshman
 
Posts: 5
Joined: Mon Dec 12, 2011 2:44 pm

Re: SDL port for Android SDK/NDK 1.6

Postby pelya » Tue Dec 13, 2011 4:10 pm

That seems to be some error in your code, stack trace is too short to say where. The most common errors are unaligned pointer or access, such code will run okay on PC but will crash on Android.
pelya
Master Developer
Master Developer
 
Posts: 323
Joined: Mon Nov 23, 2009 11:31 am

Re: SDL port for Android SDK/NDK 1.6

Postby hagabaka » Wed Dec 21, 2011 2:00 am

I cloned the repository, and tried to compile ufoai and glxgears, and both run into the error that GLES/gl.h cannot be found. I'm using crystax NDK 6.2 on Arch Linux. I notice that the output commands say -I/opt/android-ndk-crystax/platforms/android-3/arch-arm/usr/include , but there's only GLES in android-4 or above in my crystax installation. I can't figure out where this 3 is coming from...project/project.properties says target=android-12 (and crystax platform directory has only android-3,4,5,8,9). Some files in the git clone contain PLATFORMVER=android-8. But I guess neither of these numbers is getting used?
hagabaka
Freshman
Freshman
 
Posts: 5
Joined: Wed Dec 21, 2011 1:50 am

Top
PreviousNext

Return to Code Snippets for Android

Who is online

Users browsing this forum: No registered users and 8 guests