Bug 646

Summary: JOGL 2.0-rc11 doesn't work on the android emulator
Product: [JogAmp] Jogl Reporter: Brice Figureau <brice.figureau>
Component: embeddedAssignee: Sven Gothel <sgothel>
Status: RESOLVED INVALID    
Severity: major    
Priority: ---    
Version: 2   
Hardware: embedded_arm   
OS: other   
Type: --- SCM Refs:
Workaround: ---
Attachments: Full logcat in the emulator exhibiting EGL init failure

Description Brice Figureau 2012-11-30 16:31:42 CET
Created attachment 391 [details]
Full logcat in the emulator exhibiting EGL init failure

Either with our application or by using the JOGL tests provided apk, on the android emulator for 4.0.3 (kindle or any other profile), the result is the same no GLES profile can be finally found.

The application works on the target platform (a kindle hd in our case).

The problem happens on both linux and macosx as host of the emulator.

I tested the following variations:
* latest android system (4.2) - same result
* latest sdk (r21)
* emulated device with gpu on and hw.lcd.depth=32 or 16
* emulated device with gpu off and hw.lcd.depth=32 or 16

I'm including the whole log of our application (that just does GLProfile.getProfile(GLES2)).

You'll notice during initialization there are several errors from the emulator's EGL emulation layer (I don't know if that's important or not).


And it fails with this extracted stack trace:
11-30 15:33:15.256: W/System.err(875): Catched Exception:
11-30 15:33:15.267: W/System.err(875): javax.media.opengl.GLException: Refreshing native EGLConfig handle failed with error 0x3000: EGLGraphicsDevice[type EGL, connection decon, unitID 0, handle 0x1, nativeDisplayID 0x0, eglLifecycleCallback true], GLCaps[egl cfg 0x1, vid 0x4: rgba 0x5/6/5/0, opaque, accum-rgba 0/0/0/0, dp/st/ms: 24/0/0, dbl, mono  , hw, GLProfile[GLES2/GLES2.sw], offscr[pbuffer [r2t 0, r2tr 0, float 0]], [0x5: GLES1, GLES2, VG]] of EGLGraphicsConfiguration[DefaultGraphicsScreen[EGLGraphicsDevice[type EGL, connection decon, unitID 0, handle 0x1, nativeDisplayID 0x0, eglLifecycleCallback true], idx 0],
11-30 15:33:15.267: W/System.err(875): 	eglConfigHandle 0x0, eglConfigID 0x1,
11-30 15:33:15.267: W/System.err(875): 	requested GLCaps[rgba 0x5/5/5/0, opaque, accum-rgba 0/0/0/0, dp/st/ms: 16/0/0, one, mono  , hw, GLProfile[GLES2/GLES2.sw], offscr[pbuffer [r2t 0, r2tr 0, float 0]]],
11-30 15:33:15.267: W/System.err(875): 	chosen    GLCaps[egl cfg 0x1, vid 0x4: rgba 0x5/6/5/0, opaque, accum-rgba 0/0/0/0, dp/st/ms: 24/0/0, dbl, mono  , hw, GLProfile[GLES2/GLES2.sw], offscr[pbuffer [r2t 0, r2tr 0, float 0]], [0x5: GLES1, GLES2, VG]]]
11-30 15:33:15.286: W/System.err(875): 	at jogamp.opengl.egl.EGLUpstreamSurfaceHook.evalUpstreamSurface(EGLUpstreamSurfaceHook.java:108)
11-30 15:33:15.296: W/System.err(875): 	at jogamp.opengl.egl.EGLUpstreamSurfaceHook.create(EGLUpstreamSurfaceHook.java:66)
11-30 15:33:15.306: W/System.err(875): 	at jogamp.nativewindow.ProxySurfaceImpl.createNotify(ProxySurfaceImpl.java:97)
11-30 15:33:15.306: W/System.err(875): 	at jogamp.opengl.GLDrawableImpl.setRealized(GLDrawableImpl.java:172)
11-30 15:33:15.318: W/System.err(875): 	at jogamp.opengl.egl.EGLDrawableFactory.mapAvailableEGLESConfig(EGLDrawableFactory.java:425)
11-30 15:33:15.326: W/System.err(875): 	at jogamp.opengl.egl.EGLDrawableFactory.createEGLSharedResourceImpl(EGLDrawableFactory.java:562)
11-30 15:33:15.336: W/System.err(875): 	at jogamp.opengl.egl.EGLDrawableFactory.getOrCreateEGLSharedResource(EGLDrawableFactory.java:520)
11-30 15:33:15.356: W/System.err(875): 	at jogamp.opengl.egl.EGLDrawableFactory.createSharedResource(EGLDrawableFactory.java:595)
11-30 15:33:15.356: W/System.err(875): 	at javax.media.opengl.GLProfile.initProfilesForDeviceCritical(GLProfile.java:1588)
11-30 15:33:15.366: W/System.err(875): 	at javax.media.opengl.GLProfile.initProfilesForDevice(GLProfile.java:1521)
11-30 15:33:15.376: W/System.err(875): 	at javax.media.opengl.GLProfile.initProfilesForDefaultDevices(GLProfile.java:1489)
11-30 15:33:15.386: W/System.err(875): 	at javax.media.opengl.GLProfile.access$100(GLProfile.java:76)
11-30 15:33:15.396: W/System.err(875): 	at javax.media.opengl.GLProfile$1.run(GLProfile.java:157)
11-30 15:33:15.406: W/System.err(875): 	at java.security.AccessController.doPrivileged(AccessController.java:45)
11-30 15:33:15.416: W/System.err(875): 	at javax.media.opengl.GLProfile.initSingleton(GLProfile.java:123)
11-30 15:33:15.416: W/System.err(875): 	at javax.media.opengl.GLProfile.getProfileMap(GLProfile.java:1857)
11-30 15:33:15.426: W/System.err(875): 	at javax.media.opengl.GLProfile.get(GLProfile.java:768)
11-30 15:33:15.436: W/System.err(875): 	at javax.media.opengl.GLProfile.get(GLProfile.java:784)
11-30 15:33:15.446: W/System.err(875): 	at com.daysofwonder.android.testapp.GearsActivity.onCreate(GearsActivity.java:29)
11-30 15:33:15.456: W/System.err(875): 	at android.app.Activity.performCreate(Activity.java:4628)
11-30 15:33:15.456: W/System.err(875): 	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
11-30 15:33:15.476: W/System.err(875): 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1963)
11-30 15:33:15.476: W/System.err(875): 	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2024)
11-30 15:33:15.488: W/System.err(875): 	at android.app.ActivityThread.access$600(ActivityThread.java:126)
11-30 15:33:15.496: W/System.err(875): 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1159)
11-30 15:33:15.506: W/System.err(875): 	at android.os.Handler.dispatchMessage(Handler.java:99)
11-30 15:33:15.516: W/System.err(875): 	at android.os.Looper.loop(Looper.java:137)
11-30 15:33:15.526: W/System.err(875): 	at android.app.ActivityThread.main(ActivityThread.java:4479)
11-30 15:33:15.526: W/System.err(875): 	at java.lang.reflect.Method.invokeNative(Native Method)
11-30 15:33:15.536: W/System.err(875): 	at java.lang.reflect.Method.invoke(Method.java:511)
11-30 15:33:15.546: W/System.err(875): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
11-30 15:33:15.556: W/System.err(875): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
11-30 15:33:15.566: W/System.err(875): 	at dalvik.system.NativeStart.main(Native Method)
11-30 15:33:15.576: W/System.err(875): main: createContextARB: SET mappedVersionsAvailableSet .egl_decon_0


Of course, we can still use the real device for the development but having the emulator working would be a really good help :)
Comment 1 Brice Figureau 2012-11-30 16:35:15 CET
Note: using the emulator with gpu=off, there is only a GLES1 profile available (ie software rendering), which doesn't really fit our current development.
Comment 2 Sven Gothel 2012-12-27 08:40:59 CET
Test: w/ gluegen_617-joal_382-jogl_877-jocl_719
   <http://jogamp.org/deployment/archive/master/gluegen_617-joal_382-jogl_877-jocl_719/archive/jogamp-all-platforms.7z>

   Regarding Android, this build contains bug fixes:
    - Allow running NewtBaseActivity within one big APK 
      containing all (gluegen, jogl and user-app),
      instead of running it w/ launcher.
    - JogAmpLauncher JNI lib location fix

   Otherwise it is equals to v2.0-rc11 (in regards to Android).

Maven: 
   <version>2.0-rc11post03</version>(Avail @ Thu Dec 27 08:32:19 GMT 2012)

   Server: <url>http://www.jogamp.org/deployment/maven/</url>
   See: <http://jogamp.org/wiki/index.php/Setting_up_a_JogAmp_project_in_your_favorite_IDE#The_jogamp.org_test_repository_.28optional.29>

   Test: jogl-demo's maven sub-projects (change 2.0-rc11 -> 2.0-rc11post03)

Android x86 32bit Stuff:
  SDK 21.0.1
  Tools 16.0.1

AVDs: 
  Notes: 
    - On Linux, emulation (w/ GPU) doesn't work at all below API 15 & armeabi-v7a !
    - On Linux, emulation (w/ GPU) works best w/ API 17 & armeabi-v7a !
  
- Android 4.0.3 - API 15 - armeabi-v7a (*)
  - SD 512 MiB
  - WSVGA
  - LCD Color Depth 32
  - Ram 512MB
  - GPU emulation: yes 

- Android 4.2 - API 17 - armeabi-v7a (no bugs)
  - SD 512 MiB
  - WXGA 1280x720
  - LCD Color Depth 32
  - Ram 512MB
  - GPU emulation: yes 

- Galaxy Nexus (4.2 - API 17 - armeabi-v7a) (no bugs)
  - SD 512MB, internal 200 MiB
  - 720x1280 xhdpi
  - GPU emulation: yes 
    
Host Linux x86_64 64bit w/ NV GPU, Debian wheezy/sid

+++

Result: All works

(*) - Android 4.0.3 - API 15 - armeabi-v7a
  Minor bugs: 
    ES1/ES2 gl.glClear(GL.GL_COLOR_BUFFER_BIT);
    doesn't seem to actually clear the background
    This can be observed in Gears and RedSquare demos.
    However, the GearsES2T (translucent demo) works well.

+++

Since this report didn't reflect one of the 2 bugfixes mentioned above,
this bug is marked INVALID and closed.

Nevertheless - thx to this bug report I revalidated the Android emulation 
and the 2 fixes above were made plus we found a valid working emulation
configuration (API 17  armeabi-v7a).