rust-windowing/glutin

Android example crash

fr-an-k opened this issue · 18 comments

When using the latest release version on Android 8.1:

cargo apk r -p glutin_examples --example android

I get:

03-27 08:10:45.476  4018  4018 I zygote64: Late-enabling -Xcheck:jni
03-27 08:10:45.619  4018  4018 W System  : ClassLoader referenced unknown path:
03-27 08:10:45.704  4018  4023 I zygote64: Do partial code cache collection, code=30KB, data=22KB
03-27 08:10:45.705  4018  4023 I zygote64: After code cache collection, code=30KB, data=22KB
03-27 08:10:45.705  4018  4023 I zygote64: Increasing code cache capacity to 128KB
03-27 08:10:45.812  4018  4018 W Thread-2: type=1400 audit(0.0:83): avc: denied { search } for name="clients" dev="debugfs" ino=6282 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:debugfs_ion:s0 tclass=dir permissive=0
03-27 08:10:45.822  4018  4035 I zygote64: android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0      
03-27 08:10:45.824  4018  4034 I RustStdoutStderr: Picked a config with 4 samples
03-27 08:10:45.842  4018  4018 I SurfaceFactory: [static] sSurfaceFactory = com.mediatek.view.impl.SurfaceFactoryImpl@ddb8066
03-27 08:10:45.849  4018  4018 D WindowClient: Add to mViews: DecorView@74ed7fd[NativeActivity], this = android.view.WindowManagerGlobal@d0f3cf2
03-27 08:10:45.857  4018  4018 V PhoneWindow: DecorView setVisiblity: visibility = 0, Parent = ViewRoot{93adf43 rust.example.android/android.app.NativeActivity,ident = 0}, this = DecorView@74ed7fd[NativeActivity]
03-27 08:10:45.896  4018  4034 I RustStdoutStderr: Android window available
--------- beginning of crash
03-27 08:10:45.897  4018  4035 F libc    : Fatal signal 11 (SIGSEGV), code 1, fault addr 0xc05f776ef4 in tid 4035 (Thread-2), pid 4018 (example.android)
03-27 08:10:45.976  4018  4035 I libc    : orig_dumpable: 1

What could this be? WebGL works on this device.

(When running eframe there is an error with string "OpenGL ES-CM 1.1", I guess that's the ES version, but ES 3.1 should be supported on Android 8.1)

(OpenGL ES 2 example from the official Android NDK examples works)

@fr-an-k if you try previous versions of glutin, could you get it to work?

cc @MarijnS95

I tried 0.29.1, renamed examples/window.rs to lib.rs, then (in glutin_examples):

cargo apk run --lib

It builds, installs, reports success, but it crashes without error message as well.

I would suggest to try different patch versions of the glutin 0.30. Trying 0.29.1 is pointless.

0.30.6 appears to have the same issue
0.30.3 doesn't compile
0.30.0 outputs:

Surface : Surface::connect(this=0x7708f6f000,api=1)
03-27 11:42:20.925 31757 31777 I RustStdoutStderr: Running on PowerVR Rogue GE8320
03-27 11:42:20.926 31757 31777 I RustStdoutStderr: OpenGL Version OpenGL ES-CM 1.1
03-27 11:42:20.926 31757 31778 E IMGSRV  : :0: glGetString: Unknown name
03-27 11:42:20.926 31757 31778 E libEGL  : called unimplemented OpenGL ES API
03-27 11:42:20.926 31757 31778 E libEGL  : called unimplemented OpenGL ES API
03-27 11:42:20.926 31757 31778 E libEGL  : called unimplemented OpenGL ES API
...

I didn't try the other ones.

Looks like there is a GL version check somewhere that does not know how to interpret "OpenGL ES-CM 1.1".
I would be nice if I could just tell it to request GL ES 2.0 rather than 3.2 which may be the default.
I suspect I may need to use the glutin_gles2_sys (now only used for macos).

But I can't spend much more time on this, so I guess I'll just have to wait until bevy/glow/winit/glutin receives better cross-platform support.

Looks like there is a GL version check somewhere that does not know how to interpret "OpenGL ES-CM 1.1".

glutin example doesn't have GL version checks. We use #version 100 shaders, and we ask the context to be either ES 3.1.

I would be nice if I could just tell it to request GL ES 2.0 rather than 3.2 which may be the default.

Instead of guessing you could read the code of the example. It requests 3 different versions of the context, and your system builds the context just fine from the logs.

I suspect I may need to use the glutin_gles2_sys (now only used for macos).

No, you don't need that, Android is using EGL, not the GLES bindings, the GLES bindings is an ios legacy thing.

But I can't spend much more time on this, so I guess I'll just have to wait until bevy/glow/winit/glutin receives better cross-platform support.

Yeah, it'll certainly get better without any trouble shooting.

The issue with the glutin example is not in the version check but either during window creation or EGLSurface creation.

What could help is if you could tell what exactly crashes(provide a simple stack trace) for you or if you could link to the working android example with open source software stack, so I could at least look how EGL is managed inside of it, if the issue is EGL.

I'd suggest to apply this:

diff --git a/glutin_examples/src/lib.rs b/glutin_examples/src/lib.rs
index 08e0e68..a83adee 100644
--- a/glutin_examples/src/lib.rs
+++ b/glutin_examples/src/lib.rs
@@ -8,7 +8,7 @@ use winit::window::WindowBuilder;
 use raw_window_handle::HasRawWindowHandle;

 use glutin::config::ConfigTemplateBuilder;
-use glutin::context::{ContextApi, ContextAttributesBuilder, Version};
+use glutin::context::{ContextApi, ContextAttributesBuilder, GlContext, Version};
 use glutin::display::GetGlDisplay;
 use glutin::prelude::*;
 use glutin::surface::SwapInterval;
@@ -63,7 +63,7 @@ pub fn main(event_loop: winit::event_loop::EventLoop<()>) {
         })
         .unwrap();

-    println!("Picked a config with {} samples", gl_config.num_samples());
+    println!("Config supports API: {:?}", gl_config.api());

     let raw_window_handle = window.as_ref().map(|window| window.raw_window_handle());

@@ -100,6 +100,8 @@ pub fn main(event_loop: winit::event_loop::EventLoop<()>) {
         })
     });

+    println!("The context is using: {:?}", not_current_gl_context.as_ref().unwrap().context_api());
+
     let mut state = None;
     let mut renderer = None;
     event_loop.run(move |event, window_target, control_flow| {
@@ -115,11 +117,15 @@ pub fn main(event_loop: winit::event_loop::EventLoop<()>) {
                         .unwrap()
                 });

+                println!("About to create surface for the window");
+
                 let attrs = window.build_surface_attributes(<_>::default());
                 let gl_surface = unsafe {
                     gl_config.display().create_window_surface(&gl_config, &attrs).unwrap()
                 };

+                println!("Making context current");
+
                 // Make it current.
                 let gl_context =
                     not_current_gl_context.take().unwrap().make_current(&gl_surface).unwrap();

To the latest master and retest.

Also, be aware that winit has both native and game activity, and by default we're using native one. So you might try to use game instead (change the feature in glutin_examples). The feature is https://github.com/rust-windowing/winit/blob/fbea75d31f4025825e9bf88b99d7c92e4eb79273/Cargo.toml#L46

In the 0.30.7 android example, the crash appears to originate in:

let attrs = window.build_surface_attributes(<_>::default());

gl_config.num_samples() is 4
Config supports API: GLES1
The context is using: Gles(None)

Patching the master results in the same.

Edit: also when I change to this in glutin_examples/Cargo.toml:

winit = { version = "0.28.1", default-features = false, features = ["game"] }

let attrs = window.build_surface_attributes(<_>::default());

This can't crash.

I don't see the println!("About to create surface for the window"); output, so it seems
like window creation crashes, not the glutin stuff.

You originally posted a log showing prints like RustStdoutStderr: Android window available, so if you can post the same with my patch that would be nice.

Config supports API: GLES1

So your system is GLES 1, not GLES 2 even, though, we provide a way to build the context for it.

Indeed I was wrong; sorry, I'm just beginner.
It appears to crash in:

gl_config.display().create_window_surface(&gl_config, &attrs).unwrap()

The log:

03-27 22:15:04.820  1995  2243 D WindowManager: Input focus has changed to Window{3aea1cf u0 rust.example.android/android.app.NativeActivity}
03-27 22:15:04.823  1995  2067 I WindowManager: Focus moving from null to Window{3aea1cf u0 rust.example.android/android.app.NativeActivity}
03-27 22:15:04.828   403   403 W Layer   : [Splash Screen rust.example.android#0] opaque layer with plane alpha:0.76 cannot be handled by hwcomposer
03-27 22:15:04.829 23984 24006 I RustStdoutStderr: Android window available
03-27 22:15:04.829 23984 24006 I RustStdoutStderr: About to create surface for the window
03-27 22:15:04.830 23984 24006 I RustStdoutStderr: after
03-27 22:15:04.830 23984 24006 I RustStdoutStderr: after2
03-27 22:15:04.830 23984 24007 F libc    : Fatal signal 11 (SIGSEGV), code 1, fault addr 0xc05f776ef4 in tid 24007 (Thread-2), pid 23984 (example.android)

for this code ("after4" does not appear in the log):

                println!("About to create surface for the window");
                let attrs = window.build_surface_attributes(<_>::default());
                println!("after");
                let gl_surface = unsafe {
                    println!("after2");
                    gl_config.display().create_window_surface(&gl_config, &attrs).unwrap()
                };
                println!("after4");

hello-gl2 from the NDK samples does work and actually reports creating an OpenGL ES 3.2 context:

    private static class ContextFactory implements GLSurfaceView.EGLContextFactory {
        private static int EGL_CONTEXT_CLIENT_VERSION = 0x3098;
        public EGLContext createContext(EGL10 egl, EGLDisplay display, EGLConfig eglConfig) {
            Log.w(TAG, "creating OpenGL ES 2.0 context");
            checkEglError("Before eglCreateContext", egl);
            int[] attrib_list = {EGL_CONTEXT_CLIENT_VERSION, 2, EGL10.EGL_NONE };
            EGLContext context = egl.eglCreateContext(display, eglConfig, EGL10.EGL_NO_CONTEXT, attrib_list);
            checkEglError("After eglCreateContext", egl);
            return context;
        }

Its log:

D/Surface: Surface::connect(this=0x7708f2e000,api=1)
W/GL2JNIView: creating OpenGL ES 2.0 context
D/Surface: Surface::connect(this=0x7708f2f000,api=1)
I/libgl2jni: GL Version = OpenGL ES 3.2 build 1.9@4971894
I/libgl2jni: GL Vendor = Imagination Technologies
I/libgl2jni: GL Renderer = PowerVR Rogue GE8320
I/libgl2jni: GL Extensions = GL_EXT_debug_marker GL_ANDROID_extension_pack_es31a GL_EXT_blend_minmax GL_EXT_buffer_storage GL_EXT_clear_texture GL_EXT_color_buffer_float GL_EXT_conservative_depth GL_EXT_copy_image GL_EXT_discard_framebuffer GL_EXT_draw_buffers GL_EXT_draw_buffers_indexed GL_EXT_draw_elements_base_vertex GL_EXT_float_blend GL_EXT_geometry_point_size GL_EXT_geometry_shader GL_EXT_gpu_shader5 GL_EXT_multi_draw_arrays GL_EXT_multisampled_render_to_texture GL_EXT_occlusion_query_boolean GL_EXT_polygon_offset_clamp GL_EXT_primitive_bounding_box GL_EXT_pvrtc_sRGB GL_EXT_read_format_bgra GL_EXT_robustness GL_EXT_separate_shader_objects GL_EXT_shader_framebuffer_fetch GL_EXT_shader_group_vote GL_EXT_shader_io_blocks GL_EXT_shader_non_constant_global_initializers GL_EXT_shader_pixel_local_storage GL_EXT_shader_pixel_local_storage2 GL_EXT_shader_texture_lod GL_EXT_sparse_texture GL_EXT_sRGB_write_control GL_EXT_tessellation_point_size GL_EXT_tessellation_shader GL_EXT_texture_border_clamp GL_EXT_texture_buffer GL_E
I/libgl2jni: setupGraphics(800, 1198)
I/libgl2jni: glGetAttribLocation("vPosition") = 0

No crash and a nice gradient triangle on an Android 13 device with Qualcomm SM8450, Adreno 740, running latest master of glutin at e2ba7f1:

$ cargo apk r -p glutin_examples --example android
...
04-01 16:13:57.850 14167 14167 I example.android: Late-enabling -Xcheck:jni
04-01 16:13:57.917 14167 14167 D CompatibilityChangeReporter: Compat change id reported: 171979766; UID 10492; state: DISABLED
04-01 16:13:57.920 14167 14167 W System  : ClassLoader referenced unknown path: 
04-01 16:13:57.921 14167 14167 D nativeloader: Configuring classloader-namespace for other apk . target_sdk_version=30, uses_libraries=, library_path=/data/app/~~ndxN6plSLJUbetbUJwnGiw==/rust.example.android-JDFGoLLcr2u9s_wsWUUkiQ==/lib/arm64:/data/app/~~ndxN6plSLJUbetbUJwnGiw==/rust.example.android-JDFGoLLcr2u9s_wsWUUkiQ==/base.apk!/lib/arm64-v8a, permitted_path=/data:/mnt/expand:/data/user/0/rust.example.android
04-01 16:13:57.921 14167 14167 D nativeloader: Extending system_exposed_libraries: libbinauralrenderer_wrapper.qti.so:libhoaeffects.qti.so:libQOC.qti.so:libupdateprof.qti.so:libthermalclient.qti.so:libQOC.qti.so:libdiag_system.qti.so:libqape.qti.so:libqesdk_ndk_platform.qti.so:liblistenjni.qti.so:libMiscTAApi.sony.so:libifaateeclientjni.sony.so
04-01 16:13:57.925 14167 14167 I Perf    : Connecting to perf service.
04-01 16:13:57.932 14167 14167 V GraphicsEnvironment: ANGLE Developer option for 'rust.example.android' set to: 'default'
04-01 16:13:57.932 14167 14167 V GraphicsEnvironment: ANGLE GameManagerService for rust.example.android: false
04-01 16:13:57.932 14167 14167 V GraphicsEnvironment: Updatable production driver is not supported on the device.
04-01 16:13:57.937 14167 14167 D NetworkSecurityConfig: No Network Security Config specified, using platform default
04-01 16:13:57.937 14167 14167 D NetworkSecurityConfig: No Network Security Config specified, using platform default
04-01 16:13:57.966 14167 14228 I AdrenoGLES-0: QUALCOMM build                   : e1451a8f4d, I6ed72f5526
04-01 16:13:57.966 14167 14228 I AdrenoGLES-0: Build Date                       : 08/02/22
04-01 16:13:57.966 14167 14228 I AdrenoGLES-0: OpenGL ES Shader Compiler Version: EV031.36.08.11
04-01 16:13:57.966 14167 14228 I AdrenoGLES-0: Local Branch                     : 
04-01 16:13:57.966 14167 14228 I AdrenoGLES-0: Remote Branch                    : 
04-01 16:13:57.966 14167 14228 I AdrenoGLES-0: Remote Branch                    : 
04-01 16:13:57.966 14167 14228 I AdrenoGLES-0: Reconstruct Branch               : 
04-01 16:13:57.966 14167 14228 I AdrenoGLES-0: Build Config                     : S P 12.1.1 AArch64
04-01 16:13:57.966 14167 14228 I AdrenoGLES-0: Driver Path                      : /vendor/lib64/egl/libGLESv2_adreno.so
04-01 16:13:57.966 14167 14228 I AdrenoGLES-0: Driver Version                   : 0615.37
04-01 16:13:57.975 14167 14228 I AdrenoGLES-0: PFP: 0x01730155, ME: 0x00000000
04-01 16:13:57.997 14167 14227 I RustStdoutStderr: Picked a config with 4 samples
04-01 16:13:58.000 14167 14167 D CompatibilityChangeReporter: Compat change id reported: 210923482; UID 10492; state: DISABLED
04-01 16:13:58.000 14167 14167 D CompatibilityChangeReporter: Compat change id reported: 37756858; UID 10492; state: ENABLED
04-01 16:13:58.022 14167 14227 I RustStdoutStderr: Android window available
04-01 16:13:58.028 14167 14227 I RustStdoutStderr: Running on Adreno (TM) 730
04-01 16:13:58.028 14167 14227 I RustStdoutStderr: OpenGL Version OpenGL ES 3.2 V@0615.37 (GIT@e1451a8f4d, I6ed72f5526, 1659435083) (Date:08/02/22)
04-01 16:13:58.028 14167 14227 I RustStdoutStderr: Shaders version on OpenGL ES GLSL ES 3.20

The only native code inside create_window_surface() is CreatePlatformWindowSurface() (Android must always use the KHR variant via EGL_KHR_platform_android). Maybe an attribute is passed that this PowerVR Rogue driver doesn't like?

@fr-an-k do the next lines include a backtrace? Android typically prints this.

I think we should print the extensions we've loaded in the examples actually. It's really hard to tell what could be the case without any traces.

The only concern I have wrt the crash is that the error is in the extension coming from the EGL wrt native window. It would be nice to verify that at least.

In glutin android has KHR and normal display paths, so I think the normal path was took instead here.

@kchibisov Yes that would be useful. I was about to write that but then realized that the ext codepath doesn't handle Android, so it must be KHR in this case (or error because there's no display)... only to find the extension-less display handling now:

Yeah, android doesn't have the EXT extension, only KHR one. So it's not like it doesn't handle, it's not existent in the specification.

@kchibisov please, forgive me for not writing three more words on that.


When forcing the "legacy" extension-less display without extension, I get the exact same crash at the same address (perhaps because Android locks their EGL pointers in the same place)?

*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'Sony/XQ-CT54_EEA/XQ-CT54:13/64.1.A.0.882/064001A000088202290367144:user/release-keys'
Revision: '0'
ABI: 'arm64'
Timestamp: 2023-04-01 16:41:55.165721704+0200
Process uptime: 1s
Cmdline: rust.example.android
pid: 18866, tid: 18891, name: Thread-2  >>> rust.example.android <<<
uid: 10492
tagged_addr_ctrl: 0000000000000001 (PR_TAGGED_ADDR_ENABLE)
pac_enabled_keys: 000000000000000f (PR_PAC_APIAKEY, PR_PAC_APIBKEY, PR_PAC_APDAKEY, PR_PAC_APDBKEY)
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x000000c05f776ef4
    x0  b4000071e0affc90  x1  0000007443476b88  x2  b400007140b12b40  x3  000000c05f776e64
    x4  b400007130adc310  x5  00000070e7160a30  x6  0000000000000007  x7  71fefefefefefefe
    x8  9d0c9c0c519d9d1c  x9  0000000000000000  x10 0000000000000000  x11 0000000000000000
    x12 0000000000003117  x13 6e7d636468546e7d  x14 0000000000000000  x15 0000000000000057
    x16 0000000000000001  x17 0000007456fb6a58  x18 0000007098320000  x19 b400007130adc310
    x20 0000007443476b88  x21 b400007140b12b40  x22 b4000071e0affc90  x23 00000000000049b2
    x24 0000007098da1cb0  x25 0000007098da1cb0  x26 0000007098da1ff8  x27 0000007098da2000
    x28 0000000000206000  x29 0000007098d99a30
    lr  001dcb74434633ac  sp  0000007098d99a00  pc  0000007443463418  pst 0000000080001000
backtrace:
      #00 pc 000000000001e418  /system/lib64/libEGL.so (void* android::eglCreateWindowSurfaceTmpl<int, void* (*)(void*, void*, ANativeWindow*, int const*)>(android::egl_display_t*, android::egl_connection_t*, void*, ANativeWindow*, int const*, void* (*)(void*, void*, ANativeWindow*, int const*))+64) (BuildId: 6dffc9305adaa0f34256e343b040f2f3)
      #01 pc 000000000001e3a8  /system/lib64/libEGL.so (android::eglCreateWindowSurfaceImpl(void*, void*, ANativeWindow*, int const*)+84) (BuildId: 6dffc9305adaa0f34256e343b040f2f3)
      #02 pc 000000000001c3dc  /system/lib64/libEGL.so (eglCreateWindowSurface+68) (BuildId: 6dffc9305adaa0f34256e343b040f2f3)
      #03 pc 000000000005ec48  /data/app/~~WnxuBtW-BJUoa4P1f1v0iw==/rust.example.android-n1zhafw_fnoMldIHjYOFAg==/lib/arm64/libandroid.so (glutin_egl_sys::egl::Egl::CreateWindowSurface::hf9b565fee69eb87a+80)
      #04 pc 0000000000076768  /data/app/~~WnxuBtW-BJUoa4P1f1v0iw==/rust.example.android-n1zhafw_fnoMldIHjYOFAg==/lib/arm64/libandroid.so (glutin::api::egl::surface::_$LT$impl$u20$glutin..api..egl..display..Display$GT$::create_window_surface::hbae22f042aa5f226+1424)
      #05 pc 000000000006f2e0  /data/app/~~WnxuBtW-BJUoa4P1f1v0iw==/rust.example.android-n1zhafw_fnoMldIHjYOFAg==/lib/arm64/libandroid.so (_$LT$glutin..display..Display$u20$as$u20$glutin..display..GlDisplay$GT$::create_window_surface::ha1ccae378b2474af+68)
      #06 pc 0000000000045f8c  /data/app/~~WnxuBtW-BJUoa4P1f1v0iw==/rust.example.android-n1zhafw_fnoMldIHjYOFAg==/lib/arm64/libandroid.so (glutin_examples::main::_$u7b$$u7b$closure$u7d$$u7d$::h1b9a56a32ef350f6+916)
      #07 pc 000000000004b198  /data/app/~~WnxuBtW-BJUoa4P1f1v0iw==/rust.example.android-n1zhafw_fnoMldIHjYOFAg==/lib/arm64/libandroid.so (winit::platform_impl::platform::sticky_exit_callback::h976021c984902ffe+316)
      #08 pc 000000000004a1ec  /data/app/~~WnxuBtW-BJUoa4P1f1v0iw==/rust.example.android-n1zhafw_fnoMldIHjYOFAg==/lib/arm64/libandroid.so (winit::platform_impl::platform::EventLoop$LT$T$GT$::single_iteration::h7dcb2509549190cc+4012)
      #09 pc 0000000000049178  /data/app/~~WnxuBtW-BJUoa4P1f1v0iw==/rust.example.android-n1zhafw_fnoMldIHjYOFAg==/lib/arm64/libandroid.so (winit::platform_impl::platform::EventLoop$LT$T$GT$::run_return::_$u7b$$u7b$closure$u7d$$u7d$::h4381a344b3e892e5+428)
      #10 pc 000000000004c628  /data/app/~~WnxuBtW-BJUoa4P1f1v0iw==/rust.example.android-n1zhafw_fnoMldIHjYOFAg==/lib/arm64/libandroid.so (android_activity::native_activity::AndroidAppInner::poll_events::hd74cb9025211f45c+3564)
      #11 pc 000000000004b6fc  /data/app/~~WnxuBtW-BJUoa4P1f1v0iw==/rust.example.android-n1zhafw_fnoMldIHjYOFAg==/lib/arm64/libandroid.so (android_activity::AndroidApp::poll_events::h44561a1e0c088dd7+236)
      #12 pc 0000000000048f28  /data/app/~~WnxuBtW-BJUoa4P1f1v0iw==/rust.example.android-n1zhafw_fnoMldIHjYOFAg==/lib/arm64/libandroid.so (winit::platform_impl::platform::EventLoop$LT$T$GT$::run_return::hba6075732d5fce9b+564)
      #13 pc 000000000004b00c  /data/app/~~WnxuBtW-BJUoa4P1f1v0iw==/rust.example.android-n1zhafw_fnoMldIHjYOFAg==/lib/arm64/libandroid.so (winit::platform_impl::platform::EventLoop$LT$T$GT$::run::hd46d6e20da4efc14+44)
      #14 pc 0000000000053170  /data/app/~~WnxuBtW-BJUoa4P1f1v0iw==/rust.example.android-n1zhafw_fnoMldIHjYOFAg==/lib/arm64/libandroid.so (winit::event_loop::EventLoop$LT$T$GT$::run::hcc8dcb74cc03eba7+80)
      #15 pc 00000000000549bc  /data/app/~~WnxuBtW-BJUoa4P1f1v0iw==/rust.example.android-n1zhafw_fnoMldIHjYOFAg==/lib/arm64/libandroid.so (glutin_examples::main::h2efda4c3ec0d3280+1640)
      #16 pc 0000000000043d14  /data/app/~~WnxuBtW-BJUoa4P1f1v0iw==/rust.example.android-n1zhafw_fnoMldIHjYOFAg==/lib/arm64/libandroid.so (android_main+232)
      #17 pc 00000000000910a0  /data/app/~~WnxuBtW-BJUoa4P1f1v0iw==/rust.example.android-n1zhafw_fnoMldIHjYOFAg==/lib/arm64/libandroid.so (android_activity::native_activity::glue::ANativeActivity_onCreate::_$u7b$$u7b$closure$u7d$$u7d$::h6e7fcbe92f64bfcc+436)
      #18 pc 000000000009f4ec  /data/app/~~WnxuBtW-BJUoa4P1f1v0iw==/rust.example.android-n1zhafw_fnoMldIHjYOFAg==/lib/arm64/libandroid.so (std::sys_common::backtrace::__rust_begin_short_backtrace::hc2fcbfd37d31ecf1+20)
      #19 pc 0000000000098958  /data/app/~~WnxuBtW-BJUoa4P1f1v0iw==/rust.example.android-n1zhafw_fnoMldIHjYOFAg==/lib/arm64/libandroid.so (std::thread::Builder::spawn_unchecked_::_$u7b$$u7b$closure$u7d$$u7d$::_$u7b$$u7b$closure$u7d$$u7d$::h927b2d3c9bfb66c9+20)
      #20 pc 000000000009b310  /data/app/~~WnxuBtW-BJUoa4P1f1v0iw==/rust.example.android-n1zhafw_fnoMldIHjYOFAg==/lib/arm64/libandroid.so (_$LT$core..panic..unwind_safe..AssertUnwindSafe$LT$F$GT$$u20$as$u20$core..ops..function..FnOnce$LT$$LP$$RP$$GT$$GT$::call_once::hd8b27a908120eb3e+20)
      #21 pc 0000000000093890  /data/app/~~WnxuBtW-BJUoa4P1f1v0iw==/rust.example.android-n1zhafw_fnoMldIHjYOFAg==/lib/arm64/libandroid.so (std::panicking::try::do_call::h6d1869a8527a9746+96)
      #22 pc 000000000009413c  /data/app/~~WnxuBtW-BJUoa4P1f1v0iw==/rust.example.android-n1zhafw_fnoMldIHjYOFAg==/lib/arm64/libandroid.so (__rust_try+24)
      #23 pc 0000000000093630  /data/app/~~WnxuBtW-BJUoa4P1f1v0iw==/rust.example.android-n1zhafw_fnoMldIHjYOFAg==/lib/arm64/libandroid.so (std::panicking::try::h181bd5f3765f530f+84)
      #24 pc 000000000009f514  /data/app/~~WnxuBtW-BJUoa4P1f1v0iw==/rust.example.android-n1zhafw_fnoMldIHjYOFAg==/lib/arm64/libandroid.so (std::panic::catch_unwind::h123f84697f7d0a65+20)
      #25 pc 000000000009842c  /data/app/~~WnxuBtW-BJUoa4P1f1v0iw==/rust.example.android-n1zhafw_fnoMldIHjYOFAg==/lib/arm64/libandroid.so (std::thread::Builder::spawn_unchecked_::_$u7b$$u7b$closure$u7d$$u7d$::h1c4bc63efaf1f254+372)
      #26 pc 000000000009d8dc  /data/app/~~WnxuBtW-BJUoa4P1f1v0iw==/rust.example.android-n1zhafw_fnoMldIHjYOFAg==/lib/arm64/libandroid.so (core::ops::function::FnOnce::call_once$u7b$$u7b$vtable.shim$u7d$$u7d$::he505fec8d3cce0ae+16)
      #27 pc 00000000000c595c  /data/app/~~WnxuBtW-BJUoa4P1f1v0iw==/rust.example.android-n1zhafw_fnoMldIHjYOFAg==/lib/arm64/libandroid.so (std::sys::unix::thread::Thread::new::thread_start::h36eaef44f4bb1148+24)
      #28 pc 00000000000ba598  /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+208) (BuildId: 2938f6235116cbc48464ee0f7622625e)
      #29 pc 0000000000053f3c  /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+68) (BuildId: 2938f6235116cbc48464ee0f7622625e)

Found it, PR incoming.

I bet on wrong glutin_egl_sys definitions for this platform, given that original path needs a de-referenced window or such.

@kchibisov something like that, but not really. The API doesn't call for a dereferenced window at all, they just happen to use EGLNativeWindowType which is defined to a *const c_void and supposed to be interpreted as the value of Android's native window, just like all the other display creation code.