Bug 8643 - OpenGL sample app with Target Framework API 17 throws EglSwapBuffer errors
Summary: OpenGL sample app with Target Framework API 17 throws EglSwapBuffer errors
Status: RESOLVED NORESPONSE
Alias: None
Product: Android
Classification: Xamarin
Component: General ()
Version: 4.4.x
Hardware: PC Mac OS
: Normal major
Target Milestone: ---
Assignee: Radek Doulik
URL:
Depends on:
Blocks:
 
Reported: 2012-11-28 16:59 UTC by PJ
Modified: 2013-12-05 18:34 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 NORESPONSE

Description PJ 2012-11-28 16:59:02 UTC
Steps to reproduce:
1) Start a new OpenGL app
2) --> Set the target framework to API17 <--
3) Deploy the app to a JellyBean 4.2 device.

Expected behavior:

Awesome rotating cube

Actual behavior:

https://gist.github.com/gists/4163429


Note: I experienced the same behavior on a Jellybean 4.1 device with the minimum android SDK version set to include API16, however it only occurs with the Target Framework set to Jellybean 4.2 (API17)



MonoDevelop 3.0.6
Installation UUID: b5aed0d2-0f63-4725-91ca-eb558d43bdf2
Runtime:
	Mono 2.10.9 (tarball)
	GTK 2.24.10
	GTK# (2.12.0.0)
	Package version: 210090011
Apple Developer Tools:
	 Xcode 4.5 (1839)
	 Build 4G182
Monotouch: 6.0.7
Mono for Android: 4.4.37
Android SDK: /Users/xamarinqa/Library/Developer/Xamarin/android-sdk-mac_x86
	Supported Android versions:
		2.1 (API level 7)
		2.2 (API level 8)
		2.3 (API level 10)
		3.1 (API level 12)
		4.0 (API level 14)
		4.2 (API level 17)
Java SDK: /usr
Build information:
	Release ID: 30006000
	Git revision: 90a53d1938aa812828adda89fb92d27a716c1218
	Build date: 2012-11-28 16:52:33+0000
	Xamarin addins: cc24f8812681fe7bb1b25780dc04d93dca0ecc03
Operating System:
	Mac OS X 10.7.4
	Darwin dynamic-052.bos.xamarin.com 11.4.0 Darwin Kernel Version 11.4.0
	    Mon Apr  9 19:32:15 PDT 2012
	    root:xnu-1699.26.8~1/RELEASE_X86_64 x86_64
Comment 1 PJ 2012-11-28 17:42:03 UTC
This is fixed by the same addition described in https://bugzilla.xamarin.com/show_bug.cgi?id=6684 . It is another manifestation of bug 5715.

Essentially, 

#if __ANDROID_11__
	           HardwareAccelerated=false,
#endif

Needs to be added to:

[Activity (Label = "OpenGLApp",
				ConfigurationChanges=ConfigChanges.Orientation | ConfigChanges.KeyboardHidden,
				MainLauncher = true)]

In the default Activity1.cs that is generated.
Comment 2 zelyony 2013-08-13 15:13:45 UTC
and
default OpenGL project doesnt contains MakeCurrent() call at begining OnRenderFrame(..)
project always crushes without it in my GalaxyS4(I9505) with any API level at SwapBuffers()
Comment 3 Peter Collins 2013-08-16 17:00:40 UTC
@zelyony - I was unable to reproduce the failure you described in Comment 2 on a Galaxy S4 (v4.2.2). Adding the ifdef for hardware acceleration fixes the crash for me in an Android OpenGL Application template with the target framework set to v4.1.

Could you please attach logcat output for the error you are seeing, or a small sample project that produces this issue?
Comment 4 zelyony 2013-08-17 02:39:37 UTC
oops!
I dont use #ifdef and attributes

I created default OpenGL project in VS12, run it and got next log for any API level:

Loaded assembly: GL1.dll
Loaded assembly: Mono.Android.dll [External]
Loaded assembly: System.Core.dll [External]
Loaded assembly: MonoDroidConstructors [External]
Loaded assembly: OpenTK.dll [External]
Loaded assembly: System.dll [External]
Thread started: <Thread Pool> #2
Thread started: <Thread Pool> #3
08-17 10:30:34.532 D/SELinux ( 4808): selinux_knoxprecontexthook:  Calling  selinux_knoxprecontexthook for uid: 10200 isSystemServer: 0 seinfo: default pkgname com.test
08-17 10:30:34.532 D/dalvikvm( 4808): Late-enabling CheckJNI
08-17 10:30:34.622 D/dalvikvm( 4808): Trying to load lib /data/app-lib/com.test-1/libmonodroid.so 0x4271fcf8
08-17 10:30:34.622 D/dalvikvm( 4808): Added shared lib /data/app-lib/com.test-1/libmonodroid.so 0x4271fcf8
08-17 10:30:34.622 W/MonoDroid-Debugger( 4808): Trying to initialize the debugger with options: --debugger-agent=transport=dt_socket,loglevel=0,address=127.0.0.1:8881,server=y,embedding=1
08-17 10:30:34.742 W/MonoDroid-Debugger( 4808): Accepted stdout connection: 49
08-17 10:30:35.503 W/libc    ( 4808): WARNING: generic atexit() called from legacy shared library
08-17 10:30:35.933 W/monodroid-gc( 4808): GREF GC Threshold: 46800
08-17 10:30:36.794 E/MoreInfoHPW_ViewGroup( 4808): Parent view is not a TextView
08-17 10:30:36.814 D/dalvikvm( 4808): GC_FOR_ALLOC freed 78K, 9% free 17331K/19016K, paused 16ms, total 17ms
08-17 10:30:36.824 I/dalvikvm-heap( 4808): Grow heap (frag case) to 20.739MB for 2359312-byte allocation
08-17 10:30:36.834 D/dalvikvm( 4808): GC_FOR_ALLOC freed 3K, 8% free 19632K/21324K, paused 13ms, total 13ms
08-17 10:30:36.864 D/dalvikvm( 4808): GC_CONCURRENT freed <1K, 8% free 19632K/21324K, paused 3ms+1ms, total 20ms
08-17 10:30:36.914 D/libEGL  ( 4808): loaded /system/lib/egl/libEGL_adreno200.so
08-17 10:30:36.914 D/libEGL  ( 4808): loaded /system/lib/egl/libGLESv1_CM_adreno200.so
08-17 10:30:36.914 D/libEGL  ( 4808): loaded /system/lib/egl/libGLESv2_adreno200.so
08-17 10:30:36.924 I/Adreno200-EGL( 4808): <qeglDrvAPI_eglInitialize:265>: EGL 1.4 QUALCOMM build:  (CL3544079)
08-17 10:30:36.924 I/Adreno200-EGL( 4808): Build Date: 03/28/13 Thu
08-17 10:30:36.924 I/Adreno200-EGL( 4808): Local Branch: adreno_20130328
08-17 10:30:36.924 I/Adreno200-EGL( 4808): Remote Branch: 
08-17 10:30:36.924 I/Adreno200-EGL( 4808): Local Patches: 
08-17 10:30:36.924 I/Adreno200-EGL( 4808): Reconstruct Branch: 
08-17 10:30:36.964 D/OpenGLRenderer( 4808): Enabling debug mode 0
08-17 10:30:37.465 E/libEGL  ( 4808): called unimplemented OpenGL ES API
08-17 10:30:37.465 E/libEGL  ( 4808): called unimplemented OpenGL ES API
08-17 10:30:37.465 E/libEGL  ( 4808): called unimplemented OpenGL ES API
08-17 10:30:37.465 E/libEGL  ( 4808): called unimplemented OpenGL ES API
08-17 10:30:37.465 E/libEGL  ( 4808): called unimplemented OpenGL ES API
08-17 10:30:37.475 E/libEGL  ( 4808): called unimplemented OpenGL ES API
08-17 10:30:37.475 E/libEGL  ( 4808): called unimplemented OpenGL ES API
08-17 10:30:37.475 E/libEGL  ( 4808): called unimplemented OpenGL ES API
08-17 10:30:37.475 E/libEGL  ( 4808): called unimplemented OpenGL ES API
08-17 10:30:37.475 W/Adreno200-EGL( 4808): <qeglDrvAPI_eglSwapBuffers:3453>: EGL_BAD_SURFACE
An unhandled exception occured.
08-17 10:30:41.989 I/MonoDroid( 4808): UNHANDLED EXCEPTION: OpenTK.Platform.Android.EglException: EglSwapBuffers failed with error 12301 (0x300d)
08-17 10:30:41.989 I/MonoDroid( 4808): at OpenTK.Platform.Android.AndroidGraphicsContext.Swap () <IL 0x00061, 0x0026c>
08-17 10:30:41.989 I/MonoDroid( 4808): at OpenTK.Platform.Android.AndroidGameView.SwapBuffers () <IL 0x0001f, 0x000ef>
08-17 10:30:41.989 I/MonoDroid( 4808): at GL1.GLView1.OnRenderFrame (OpenTK.FrameEventArgs) [0x000cd] in c:\temp\android\GL1\GLView1.cs:53
08-17 10:30:41.989 I/MonoDroid( 4808): at OpenTK.Platform.Android.AndroidGameView.RenderFrameInternal (OpenTK.FrameEventArgs) <IL 0x00013, 0x000b3>
08-17 10:30:41.989 I/MonoDroid( 4808): at OpenTK.Platform.Android.AndroidGameView.RunIteration (System.Threading.CancellationToken) <IL 0x0011b, 0x006bf>
08-17 10:30:41.989 I/MonoDroid( 4808): at OpenTK.Platform.Android.AndroidGameView/<StartThread>c__AnonStorey0.<>m__3 (object) <IL 0x0000d, 0x00077>
08-17 10:30:41.989 I/MonoDroid( 4808): at Android.App.SyncContext/<Send>c__AnonStorey2F.<>m__20 () <IL 0x0000c, 0x0005b>
08-17 10:30:41.989 I/MonoDroid( 4808): at Java.Lang.Thread/RunnableImplementor.Run () <IL 0x00011, 0x00097>
08-17 10:30:41.989 I/MonoDroid( 4808): at Java.Lang.IRunnableInvoker.n_Run (intptr,intptr) <IL 0x00009, 0x0009f>
08-17 10:30:41.989 I/MonoDroid( 4808): at (wrapper dynamic-method) object.26479eab-97bc-4a4a-a4cf-d165c99a1157 (intptr,intptr) <IL 0x00011, 0x0003b>
08-17 10:30:42.079 E/mono-rt ( 4808): Stacktrace:
08-17 10:30:42.079 E/mono-rt ( 4808): 
08-17 10:30:42.079 E/mono-rt ( 4808):   at <unknown> <0xffffffff>
08-17 10:30:42.079 E/mono-rt ( 4808):   at (wrapper native-to-managed) object.26479eab-97bc-4a4a-a4cf-d165c99a1157 (intptr,intptr) <IL 0x00022, 0xffffffff>
08-17 10:30:42.079 E/mono-rt ( 4808): 
08-17 10:30:42.079 E/mono-rt ( 4808): =================================================================
08-17 10:30:42.079 E/mono-rt ( 4808): Got a SIGSEGV while executing native code. This usually indicates
08-17 10:30:42.079 E/mono-rt ( 4808): a fatal error in the mono runtime or one of the native libraries 
08-17 10:30:42.079 E/mono-rt ( 4808): used by your application.
08-17 10:30:42.079 E/mono-rt ( 4808): =================================================================
08-17 10:30:42.079 E/mono-rt ( 4808): 
Unhandled Exception:

OpenTK.Platform.Android.EglException: Loading...
The program 'Mono' has exited with code 0 (0x0).


but when I insert MakeCurrent() at beginning OnRenderFrame(..) it works fine: rect is rotating, no crushes on rotate phone(portrait or landscape) or any touches
Comment 5 Peter Collins 2013-08-20 12:55:49 UTC
It looks like the MakeCurrent () call also resolves this crash. We will likely want to update our OpenTK Templates with one of these fixes.
Comment 6 PJ 2013-11-19 17:04:01 UTC
This bug has been in the NEEDINFO state with no changes for the last 90 days. Can we put this back into the NEW or CONFIRMED state, or are we still awaiting response?

If there is no change in the status of this bug over the next two weeks, this bug will be marked as NORESPONSE.
Comment 7 PJ 2013-12-05 18:34:02 UTC
This bug has not been changed from the NEEDINFO state since my previous comment, marking as RESOLVED NORESPONSE.

Please feel free to REOPEN this bug at any time if you are still experiencing the issue. Please add the requested information and set the bug back to the NEW (or CONFIRMED) state.