glutin_window icon indicating copy to clipboard operation
glutin_window copied to clipboard

`eglCreateWindowSurface` fails after updating to android 10

Open OptimisticPeach opened this issue 5 years ago • 1 comments

If I run the following code when running on android using cargo apk:

let window: GlutinWindow = WindowSettings::new(
                "rust app", (200.0, 200.0)
            )
            .fullscreen(true)
            .graphics_api(OpenGL::V2_1)
            .build()
            .unwrap();

Logcat shows the following errors:

BufferQueueProducer: [com.optimistic_peach.trees/android.app.NativeActivity#0] connect: already connected (cur=1 req=1)
libEGL  : eglCreateWindowSurface: native_window_api_connect (win=0x762d44c010) failed (0xffffffea) (already connected to another API?)
libEGL  : eglCreateWindowSurfaceTmpl:729 error 3003 (EGL_BAD_ALLOC)
RustAndroidGlueStdouterr: thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: OsError("eglCreateWindowSurface failed")', src/libcore/result.rs:1084:5
Full logcat output around this:
threaded_app: WindowFocusChanged: 0x76c432bd00 -- 1
Adreno  : QUALCOMM build                   : bc00834, I609ab310b2
Adreno  : Build Date                       : 04/11/19
Adreno  : OpenGL ES Shader Compiler Version: EV031.26.07.00
Adreno  : Local Branch                     :
Adreno  : Remote Branch                    :
Adreno  : Remote Branch                    :
Adreno  : Reconstruct Branch               :
Adreno  : Build Config                     : S L 8.0.6 AArch64
ActivityTaskManager: Displayed com.optimistic_peach.trees/android.app.NativeActivity: +107ms
Adreno  : PFP: 0x005ff110, ME: 0x005ff066
BufferQueueProducer: [com.optimistic_peach.trees/android.app.NativeActivity#0] connect: already connected (cur=1 req=1)
libEGL  : eglCreateWindowSurface: native_window_api_connect (win=0x762d44c010) failed (0xffffffea) (already connected to another API?)
libEGL  : eglCreateWindowSurfaceTmpl:729 error 3003 (EGL_BAD_ALLOC)
RustAndroidGlueStdouterr: thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: OsError("eglCreateWindowSurface failed")', src/libcore/result.rs:1084:5
RustAndroidGlueStdouterr: stack backtrace:
libc    : Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 6339 (tic_peach.trees), pid 6314 (tic_peach.trees)
[email protected]: LAUNCH: 0
crash_dump64: obtaining output fd from tombstoned, type: kDebuggerdTombstone
/system/bin/tombstoned: received crash request for pid 6339
crash_dump64: performing dump of process 6314 (target tid = 6339)
DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
DEBUG   : Build fingerprint: 'google/walleye/walleye:10/QP1A.190711.019/5790879:user/release-keys'
DEBUG   : Revision: 'MP1'
DEBUG   : ABI: 'arm64'
DEBUG   : Timestamp: 2019-10-05 13:24:00-0400
DEBUG   : pid: 6314, tid: 6339, name: tic_peach.trees  >>> com.optimistic_peach.trees <<<
DEBUG   : uid: 10002
DEBUG   : signal 6 (SIGABRT), code -1 (SI_QUEUE), fault addr --------
DEBUG   :     x0  0000000000000000  x1  00000000000018c3  x2  0000000000000006  x3  00000075d8769ff0
DEBUG   :     x4  000000762ed91238  x5  000000762ed91238  x6  000000762ed91238  x7  000000762ed91000
DEBUG   :     x8  00000000000000f0  x9  00000076c399a4e0  x10 0000000000000000  x11 0000000000000001
DEBUG   :     x12 0000000000000000  x13 0000000000000000  x14 ffffffffffffffff  x15 0000000000000045
DEBUG   :     x16 00000076c3a668c0  x17 00000076c3a44060  x18 00000075d855a000  x19 00000000000000ac
DEBUG   :     x20 00000000000018aa  x21 00000000000000b2  x22 00000000000018c3  x23 00000000ffffffff
DEBUG   :     x24 00000075d876b260  x25 0000000000000005  x26 0000000000000001  x27 00000000000fd000
DEBUG   :     x28 0000007fff11f440  x29 00000075d876a0a0
DEBUG   :     sp  00000075d8769fd0  lr  00000076c39f8170  pc  00000076c39f81a0
DEBUG   :
DEBUG   : backtrace:
DEBUG   :       #00 pc 00000000000821a0  /apex/com.android.runtime/lib64/bionic/libc.so (abort+176) (BuildId: b58d049709674405423a8d8de1a37f56)
DEBUG   :       #01 pc 00000000000bc844  /data/app/com.optimistic_peach.trees-tKVaZx-PR2FlzJuAoEYdjQ==/lib/arm64/libtrees.so
DEBUG   :       #02 pc 00000000000bd08c  /data/app/com.optimistic_peach.trees-tKVaZx-PR2FlzJuAoEYdjQ==/lib/arm64/libtrees.so
DEBUG   :       #03 pc 00000000000a5c6c  /data/app/com.optimistic_peach.trees-tKVaZx-PR2FlzJuAoEYdjQ==/lib/arm64/libtrees.so
ActivityTaskManager:   Force finishing activity com.optimistic_peach.trees/android.app.NativeActivity
/system/bin/tombstoned: Tombstone written to: /data/tombstones/tombstone_03
DropBoxManagerService: add tag=data_app_native_crash isTagEnabled=true flags=0x2
threaded_app: Pause: 0x76c432bd00
threaded_app: activityState=13
BootReceiver: Copying /data/tombstones/tombstone_03 to DropBox (SYSTEM_TOMBSTONE)
ActivityManager: Showing crash dialog for package com.optimistic_peach.trees u0
DropBoxManagerService: add tag=SYSTEM_TOMBSTONE isTagEnabled=true flags=0x2
BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.DROPBOX_ENTRY_ADDED flg=0x10 (has extras) } to com.google.android.gms/.stats.service.DropBoxEntryAddedReceiver
BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.DROPBOX_ENTRY_ADDED flg=0x10 (has extras) } to com.google.android.gms/.chimera.GmsIntentOperationService$PersistentTrustedReceiver
threaded_app: WindowFocusChanged: 0x76c432bd00 -- 0

This happens on similar apps which try to initialize a window using glutin.

Note that this is happening on an android 10 device, where it used to work on android pie. (IE the update broke it 😞 )

OptimisticPeach avatar Oct 05 '19 17:10 OptimisticPeach

Alright! Some more information:

  • According to this page, and this entry, android has changed its egl specification to 1.5
  • Changing the following items in cargo.toml do not change the result(These are part of cargo apk):
    [package.metadata.android]
    # The target Android API level.
    # It defaults to 18 because this is the minimum supported by rustc.
    # (target_sdk_version and min_sdk_version default to the value of "android_version")
    android_version = 29
    target_sdk_version = 26
    min_sdk_version = 25
    
    # The maximum supported OpenGL ES version , as claimed by the manifest. Defaults to 2.0.
    # See https://developer.android.com/guide/topics/graphics/opengl.html#manifest
    opengles_version_major = 2
    opengles_version_minor = 1
    
  • Changing the opengl version when creating the window produces no change:
    let window: GlutinWindow = WindowSettings::new(
                    "rust app", (200.0, 200.0)
                )
                .fullscreen(true)
                .graphics_api(OpenGL::V2_1) //This currently matches my Cargo.toml
                .build()
                .unwrap();
    
  • I am 100% sure the error occurs during this call, I've isolated it to here.
  • My dependencies are as follows:
    [dependencies]
    android_glue = {git = "https://github.com/rust-windowing/android-rs-glue"}
    piston = "0.49.0"
    piston2d-graphics = "0.35.0"
    pistoncore-glutin_window = "0.63.0"
    piston2d-opengl_graphics = "0.69.0"
    
    [patch.crates-io] # Winit uses an old version which is incompatible with the new cargo apk
    android_glue = {git = "https://github.com/rust-windowing/android-rs-glue"}
    

New questions for when someone answers:

  • Does the change to egl1.5 make glutin incompatible with android 10?
    • If so, could I opt to not use this newer version until some kind of compatibility is reached?
  • Should I really be posting this in glutin's repo, given that it's the surface provider and where the errors occur?

OptimisticPeach avatar Oct 05 '19 20:10 OptimisticPeach