Bug 6386 - Issues with OpenGL Sample on Motorola Defy
Summary: Issues with OpenGL Sample on Motorola Defy
Status: RESOLVED INVALID
Alias: None
Product: Android
Classification: Xamarin
Component: General ()
Version: 4.2.x
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2012-08-03 20:34 UTC by Vaughan Hilts
Modified: 2012-08-17 15:10 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED INVALID

Description Vaughan Hilts 2012-08-03 20:34:48 UTC
Here is a stack trace from the logcat; the device should support OpenGL 2.0 ES. It's running Froyo.

-------------------------------------------------------------------------------------------------------


D/dalvikvm( 2903): GC_CONCURRENT freed 101K, 46% free 3049K/5639K, external 577K/587K, paused 2ms+3ms
I/ActivityManager( 2278): No longer want com.skype.raider (pid 2709): hidden #16
I/ActivityManager( 2278): Starting: Intent { act=com.android.launcher.action.launcheraction flg=0x10000000 cmp=com.android.launcher/.CustomShirtcutActivity bnds=[192,770][288,854] (has extras) } from pid 2409
W/InputManagerService( 2278): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@4090d338
I/ActivityManager( 2278): Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=SampleGame.SampleGame/samplegame.Activity1 } from pid 2409
I/ActivityManager( 2278): Start proc SampleGame.SampleGame for activity SampleGame.SampleGame/samplegame.Activity1: pid=2916 uid=10077 gids={3003, 1015}
D/szipinf ( 2916): Initializing inflate state
I/ActivityThread( 2916): Pub SampleGame.SampleGame.mono.MonoRuntimeProvider.__mono_init__: mono.MonoRuntimeProvider
D/dalvikvm( 2916): Trying to load lib /data/data/SampleGame.SampleGame/lib/libmonodroid.so 0x40513ea8
D/dalvikvm( 2916): Added shared lib /data/data/SampleGame.SampleGame/lib/libmonodroid.so 0x40513ea8
E/mono    ( 2916): WARNING: The runtime version supported by this application is unavailable.
E/mono    ( 2916): Using default runtime: v2.0.50727
W/monodroid-gc( 2916): GREF GC Threshold: 46800
D/dalvikvm( 2916): GC_EXTERNAL_ALLOC freed 54K, 50% free 2698K/5379K, external 0K/0K, paused 25ms
D/libEGL  ( 2916): loaded /system/lib/egl/libEGL_POWERVR_SGX530_125.so
D/libEGL  ( 2916): loaded /system/lib/egl/libGLESv1_CM_POWERVR_SGX530_125.so
D/libEGL  ( 2916): loaded /system/lib/egl/libGLESv2_POWERVR_SGX530_125.so
I/MonoDroid( 2916): UNHANDLED EXCEPTION: OpenTK.Platform.Android.EglException: EglCreateWindowSurface failed with error 12297 (0x3009)
I/MonoDroid( 2916): at OpenTK.Platform.Android.AndroidWindow.CreateSurface (Javax.Microedition.Khronos.Egl.EGLConfig) <0x0015c>
I/MonoDroid( 2916): at OpenTK.Platform.Android.AndroidGraphicsContext.Init (OpenTK.Graphics.GraphicsMode,OpenTK.Platform.IWindowInfo,OpenTK.Graphics.IGraphicsContext,int,OpenTK.Graphics.GraphicsContextFlags) <0x0044f>
I/MonoDroid( 2916): at OpenTK.Platform.Android.AndroidGraphicsContext..ctor (OpenTK.Graphics.GraphicsMode,OpenTK.Platform.IWindowInfo,OpenTK.Graphics.IGraphicsContext,OpenTK.Graphics.GLContextVersion,OpenTK.Graphics.GraphicsContextFlags) <0x00053>
I/MonoDroid( 2916): at OpenTK.Platform.Android.AndroidGraphicsContext.CreateGraphicsContext (OpenTK.Graphics.GraphicsMode,OpenTK.Platform.IWindowInfo,OpenTK.Graphics.IGraphicsContext,OpenTK.Graphics.GLContextVersion,OpenTK.Graphics.GraphicsContextFlags) <0x00053>
I/MonoDroid( 2916): at OpenTK.Platform.Android.AndroidGameView.CreateContext () <0x00057>
I/MonoDroid( 2916): at OpenTK.Platform.Android.AndroidGameView.CreateFrameBuffer () <0x00013>
I/MonoDroid( 2916): at OpenTK.Platform.Android.AndroidGameView.LoadInternal (System.EventArgs) <0x0001f>
I/MonoDroid( 2916): at OpenTK.Platform.Android.AndroidGameView.SurfaceCreated (Android.Views.ISurfaceHolder) <0x0014b>
I/MonoDroid( 2916): at Android.Views.ISurfaceHolderCallbackInvoker.n_SurfaceCreated_Landroid_view_SurfaceHolder_ (intptr,intptr,intptr) <0x0005b>
I/MonoDroid( 2916): at (wrapper dynamic-method) object.578829a1-f308-40a2-a73c-310d05d3e23f (intptr,intptr,intptr) <0x00033>
E/mono    ( 2916): 
E/mono    ( 2916): Unhandled Exception: OpenTK.Platform.Android.EglException: EglCreateWindowSurface failed with error 12297 (0x3009)
E/mono    ( 2916):   at OpenTK.Platform.Android.AndroidWindow.CreateSurface (Javax.Microedition.Khronos.Egl.EGLConfig config) [0x00000] in <filename unknown>:0 
E/mono    ( 2916):   at OpenTK.Platform.Android.AndroidGraphicsContext.Init (OpenTK.Graphics.GraphicsMode mode, IWindowInfo win, IGraphicsContext sharedContext, Int32 major, GraphicsContextFlags flags) [0x00000] in <filename unknown>:0 
E/mono    ( 2916):   at OpenTK.Platform.Android.AndroidGraphicsContext..ctor (OpenTK.Graphics.GraphicsMode mode, IWindowInfo window, IGraphicsContext sharedContext, GLContextVersion glesVersion, GraphicsContextFlags flags) [0x00000] in <filename unknown>:0 
E/mono    ( 2916):   at OpenTK.Platform.Android.AndroidGraphicsContext.CreateGraphicsContext (OpenTK.Graphics.GraphicsMode mode, IWindowInfo window, IGraphicsContext sharedContext, GLContextVersion glVersion, GraphicsContextFlags flags) [0x00000] in <filename unknown>:0 
E/mono    ( 2916):   at OpenTK.Platform.Android.AndroidGameView.CreateCont
I/WindowManager( 2278): WIN DEATH: Window{4091c3c8 SampleGame.SampleGame/samplegame.Activity1 paused=false}
I/ActivityManager( 2278): Process SampleGame.SampleGame (pid 2916) has died.
D/Zygote  ( 2133): Process 2916 exited cleanly (1)
I/WindowManager( 2278): WIN DEATH: Window{4091d330 SurfaceView paused=false}
W/InputManagerService( 2278): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@4091ead8
I/ActivityManager( 2278): Starting: Intent { act=com.android.launcher.action.launcheraction flg=0x10000000 cmp=com.android.launcher/.CustomShirtcutActivity bnds=[192,770][288,854] (has extras) } from pid 2409
W/InputManagerService( 2278): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@40923ab0
I/ActivityManager( 2278): Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=org.jtb.alogcat/.LogActivity } from pid 2409
D/ViewConsistency( 2903): AbsListView android.widget.ListView@405aa2f0 enabled= false
D/ViewConsistency( 2903): AbsListView android.widget.ListView@405aa2f0 enabled= false
D/dalvikvm( 2903): GC_CONCURRENT freed 238K, 45% free 3355K/6087K, external 577K/587K, paused 2ms+4ms
I/ActivityManager( 2278): Displayed org.jtb.alogcat/.LogActivity: +639ms (total +6s966ms)
D/dalvikvm( 2903): GC_EXTERNAL_ALLOC freed 188K, 45% free 3430K/6151K, external 577K/587K, paused 50ms
I/wpa_supplicant( 2339): CTRL-EVENT-STATE-CHANGE id=0 state=6 BSSID=00:00:00:00:00:00
V/WifiMonitor( 2278): Event [CTRL-EVENT-STATE-CHANGE id=0 state=6 BSSID=00:00:00:00:00:00]
V/WifiStateTracker( 2278): Changing supplicant state: COMPLETED ==> GROUP_HANDSHAKE
I/wpa_supplicant( 2339): WPA: Group rekeying completed with 00:26:75:69:2e:51 [GTK=TKIP]
I/wpa_supplicant( 2339): CTRL-EVENT-STATE-CHANGE id=0 state=7 BSSID=00:00:00:00:00:00
V/WifiMonitor( 2278): Event [WPA: Group rekeying completed with 00:26:75:69:2e:51 [GTK=TKIP]]
V/WifiMonitor( 2278): Event [CTRL-EVENT-STATE-CHANGE id=0 state=7 BSSID=00:00:00:00:00:00]
V/WifiStateTracker( 2278): Changing supplicant state: GROUP_HANDSHAKE ==> COMPLETED
D/WifiStateChangeListener( 2355): received broadcast intent with action: android.net.wifi.supplicant.STATE_CHANGE
D/WifiStateChangeListener( 2355): isConnected: true
D/WifiStateChangeListener( 2355): use_wifi_sync is: false
D/WifiStateChangeListener( 2355): received broadcast intent with action: android.net.wifi.supplicant.STATE_CHANGE
D/WifiStateChangeListener( 2355): isConnected: true
D/WifiStateChangeListener( 2355): use_wifi_sync is: false
Comment 1 Jonathan Pryor 2012-08-17 11:30:39 UTC
Error 0x3009 is in <EGL/egl.h>

> #define EGL_BAD_MATCH			0x3009

http://www.khronos.org/opengles/sdk/1.1/docs/man/eglCreateWindowSurface.xml

> EGL_BAD_MATCH is generated if the attributes of native_window do not correspond
> to config or if config does not support rendering to windows (the EGL_SURFACE_TYPE
> attribute does not contain EGL_WINDOW_BIT).

What's that mean? It means that the default OpenGLES configuration that we're
trying to use is incompatible with your device. The solution is (unfortunately)
for your code to detect this situation and use a different configuration,
because (doubly unfortunately) Android hardware has been known to "lie" about
the "valid" configurations, in which an OpenGLES configuration that the device
says is valid results in an error when trying to use it.

The fix? Support multiple configurations and try them in turn:

https://github.com/xamarin/monodroid-samples/blob/master/GLCube/PaintingView.cs#L40
https://github.com/xamarin/monodroid-samples/blob/master/GLTriangle20/PaintingView.cs#L40
https://github.com/xamarin/monodroid-samples/blob/master/TexturedCube/PaintingView.cs#L54

As a further sanity check, please ensure that the GLDiagnostics sample runs
without crashing on your device. GLDiagnostics goes through every configuration
that Android reports and attempts to use it, reporting which configurations are
valid/invalid to `adb logcat`.

See also: http://lists.ximian.com/pipermail/monodroid/2012-May/010540.html
Comment 2 Vaughan Hilts 2012-08-17 14:56:01 UTC
You say the samples are supposed to work,t he GLTriangle as it enumerates the possible combinations.. but this is not true. It crashes with the above logcat.  Error code: 0x3009

So if the samples don't run, then what?
Comment 3 Jonathan Pryor 2012-08-17 15:08:04 UTC
If GLTriangle doesn't run, then run GLDiagnostics and see which configurations do run, then use those in GLTriangle/your app.
Comment 4 Vaughan Hilts 2012-08-17 15:10:06 UTC
Will do; although it says in GLTriangle use 'bare minimum'? What does that mean?