Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable crash mitigation when running OpenGL in the Android emulator #2858

Merged
merged 2 commits into from
Sep 20, 2024

Conversation

mwilsnd
Copy link
Collaborator

@mwilsnd mwilsnd commented Sep 20, 2024

In the Android Open Source Project, there exists a translation layer that sits between an OpenGL client application and the driver, called Goldfish. For whatever reason, MapLibre's OpenGL backend crashes Goldfish inside GL2Encoder::s_glDrawElements. The following mitigation addresses this crash by first detecting if we're in an emulated environment and then deleting all drawables every frame. The crash appears to be related to buffer re-use, but I've yet to locate a minimum reproduction sample that triggers this crash.

Just deleting all drawables every frame and rebuilding them works around the reuse problem, at the cost of emulator performance. It sure beats crashing though.

Closes #2791

@mwilsnd mwilsnd added bug Something isn't working android labels Sep 20, 2024
@mwilsnd mwilsnd self-assigned this Sep 20, 2024
Copy link

Bloaty Results 🐋

Compared to main

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.0%    +864  +0.0%    +376    TOTAL

Full report: https://maplibre-native.s3.eu-central-1.amazonaws.com/bloaty-results/pr-2858-compared-to-main.txt

Compared to d387090 (legacy)

    FILE SIZE        VM SIZE    
 --------------  -------------- 
   +27% +31.8Mi  +423% +25.3Mi    TOTAL

Full report: https://maplibre-native.s3.eu-central-1.amazonaws.com/bloaty-results/pr-2858-compared-to-legacy.txt

Copy link

Benchmark Results ⚡

Benchmark                                                     Time             CPU      Time Old      Time New       CPU Old       CPU New
------------------------------------------------------------------------------------------------------------------------------------------
OVERALL_GEOMEAN                                            -0.0061         -0.0059             0             0             0             0

Full report: https://maplibre-native.s3.eu-central-1.amazonaws.com/benchmark-results/pr-2858-compared-to-main.txt

Copy link

Bloaty Results (iOS) 🐋

Compared to main

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  [ = ]       0  [ = ]       0    TOTAL

Full report: https://maplibre-native.s3.eu-central-1.amazonaws.com/bloaty-results-ios/pr-2858-compared-to-main.txt

Copy link
Collaborator

@louwers louwers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tried it out, and it seems to resolve the simulator crashing!

@louwers louwers merged commit 58dd529 into maplibre:main Sep 20, 2024
40 of 42 checks passed
@louwers louwers deleted the android-emu-mitigation branch September 20, 2024 20:35
mwilsnd added a commit to mwilsnd/maplibre-gl-native that referenced this pull request Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
android bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Android x86_64 emulator crashes (11.2.0)
3 participants