Skip to content

Conversation

@tonnyavery
Copy link
Contributor

Fixes #1041
Switch to flutter 3 and new dart
Remove hybrid compositio

@tonnyavery tonnyavery temporarily deployed to ANDROID_CI_DOWNLOADS_TOKEN May 23, 2022 14:50 Inactive
@tonnyavery tonnyavery temporarily deployed to ANDROID_CI_DOWNLOADS_TOKEN May 23, 2022 14:50 Inactive
@tonnyavery tonnyavery requested a review from felix-ht May 23, 2022 14:50
@tonnyavery tonnyavery temporarily deployed to ANDROID_CI_DOWNLOADS_TOKEN May 23, 2022 14:53 Inactive
@tonnyavery tonnyavery temporarily deployed to ANDROID_CI_DOWNLOADS_TOKEN May 23, 2022 14:53 Inactive
Copy link
Collaborator

@felix-ht felix-ht left a comment

Choose a reason for hiding this comment

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

I would not merge this until flutter released a new version with the required hotfix.

@tonnyavery
Copy link
Contributor Author

Testing with controller.create() removed onStyleLoaded callback is no longer called twice. And the distortion is resolved.
There is another general problem that on < Android 9 performance will likely be an issue. It will probably take Flutter team some time to work and resolve while apps need to have maps working somehow.

@tonnyavery tonnyavery temporarily deployed to ANDROID_CI_DOWNLOADS_TOKEN May 23, 2022 15:04 Inactive
@tonnyavery tonnyavery temporarily deployed to ANDROID_CI_DOWNLOADS_TOKEN May 23, 2022 15:04 Inactive
@tonnyavery
Copy link
Contributor Author

This PR will work on Flutter master. We should wait until the fix from master is in Flutter stable.

Remove hybrid composition
@tonnyavery tonnyavery temporarily deployed to ANDROID_CI_DOWNLOADS_TOKEN May 23, 2022 15:10 Inactive
@tonnyavery tonnyavery temporarily deployed to ANDROID_CI_DOWNLOADS_TOKEN May 23, 2022 15:10 Inactive
@sawcce
Copy link

sawcce commented May 23, 2022

This PR will work on Flutter master. We should wait until the fix from master is in Flutter stable.

mapbox_gl: 
    git:
      url: https://github.com/flutter-mapbox-gl/maps.git
      ref: fix-flutter-3

@AAverin I did this and I still have the overlapping problem, I'm using flutter on the master channel. Am I doing things wrong?

@ivan-ljubicic
Copy link

Testing with controller.create() removed onStyleLoaded callback is no longer called twice. And the distortion is resolved. There is another general problem that on < Android 9 performance will likely be an issue. It will probably take Flutter team some time to work and resolve while apps need to have maps working somehow.

Android 9 map performance is so much better with this (Xperia XZ Premium) but on the other side, app performance in general is very poor. So much that the app is unusable (10-20 fps). Same with hybrid composition enabled in the previous versions.

@felix-ht
Copy link
Collaborator

felix-ht commented May 23, 2022

@LjubiTech-Maxko So the map is smooth but the rest of the flutter app is lagging?

@tonnyavery
Copy link
Contributor Author

I can also confirm overlap issue when navigating to another screen in Flutter

@felix-ht
Copy link
Collaborator

@AAverin can you add a screenshot and reference this branch to the flutter/flutter ticket?

@sawcce
Copy link

sawcce commented May 23, 2022

I can also confirm overlap issue when navigating to another screen in Flutter

I was too tired with the issue so I downgraded to flutter 2, I didn't care about Material 3 support, though it's nice so yeah...
Until there's a working fix I will keep on using flutter 2

@tonnyavery
Copy link
Contributor Author

tonnyavery commented May 23, 2022

ScreenRecord-2022-05-23-18-14-06.mp4

Couldn't reproduce with a sample app yet.
Also getting some random crashes often, even with a sample app.

@tonnyavery
Copy link
Contributor Author

A random native NPE:

LineageOS Version: '16.0-20211218-UNOFFICIAL-herolte'
Build fingerprint: 'samsung/heroltexx/herolte:8.0.0/R16NW/G930FXXU2ERD5:user/release-keys'
Revision: '0'
ABI: 'arm64'
pid: 20160, tid: 20397, name: GLThread 12357  >>> com.mapbox.mapboxglexample <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0
Cause: null pointer dereference
    x0  0000000000000000  x1  0000000000000000  x2  0000000000000001  x3  000000705db2f528
    x4  000000702076de78  x5  0000800000000080  x6  4900ff55284901ff  x7  7f7f7f7f7f7f7f7f
    x8  0000000000000000  x9  0000000000000001  x10 0000000000000001  x11 0000000000000000
    x12 0000000000000000  x13 00000000628bb3c4  x14 0015bb46d295a9ae  x15 0000e35b46736cf2
    x16 0000007004497f70  x17 00000070de70edc0  x18 0000000000000015  x19 000000702076df98
    x20 0000000000000000  x21 0000000000000001  x22 0000000012f40750  x23 0000000013405e58
    x24 0003d77ec08a3a9b  x25 000000702076f588  x26 00000070347858a0  x27 0000000000000002
    x28 000000702076e010  x29 000000702076df30
    sp  000000702076df20  lr  000000700408281c  pc  0000007004082948
backtrace:
    #00 pc 000000000011d948  /data/app/com.mapbox.mapboxglexample-WlZXiBlGsafcmyfdu3q0jQ==/lib/arm64/libmapbox-gl.so
    #01 pc 000000000011d818  /data/app/com.mapbox.mapboxglexample-WlZXiBlGsafcmyfdu3q0jQ==/lib/arm64/libmapbox-gl.so
    #02 pc 00000000000adc2c  /data/app/com.mapbox.mapboxglexample-WlZXiBlGsafcmyfdu3q0jQ==/lib/arm64/libmapbox-gl.so
    #03 pc 00000000005801e0  /system/lib64/libart.so (art_quick_generic_jni_trampoline+144)
    #04 pc 0000000000048900  /dev/ashmem/dalvik-jit-code-cache (deleted) (com.mapbox.mapboxsdk.maps.renderer.MapRenderer.onDrawFrame+96)
    #05 pc 0000000000577188  /system/lib64/libart.so (art_quick_invoke_stub+584)
    #06 pc 00000000000cf6a8  /system/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+200)
    #07 pc 000000000028c278  /system/lib64/libart.so (art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, art::ShadowFrame*, unsigned short, art::JValue*)+344)
    #08 pc 0000000000285d04  /system/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+1076)
    #09 pc 0000000000545980  /system/lib64/libart.so (MterpInvokeSuper+1408)
    #10 pc 0000000000569814  /system/lib64/libart.so (ExecuteMterpImpl+14356)
    #11 pc 000000000042b72c  /dev/ashmem/dalvik-classes2.dex extracted in memory from /data/app/com.mapbox.mapboxglexample-WlZXiBlGsafcmyfdu3q0jQ==/base.apk!classes2.dex (deleted) (com.mapbox.mapboxsdk.maps.renderer.glsurfaceview.GLSurfaceViewMapRenderer.onDrawFrame)
    #12 pc 000000000025eb68  /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEb.llvm.1315485517+488)
    #13 pc 000000000053583c  /system/lib64/libart.so (artQuickToInterpreterBridge+940)
    #14 pc 00000000005802fc  /system/lib64/libart.so (art_quick_to_interpreter_bridge+92)
    #15 pc 0000000000045bd0  /dev/ashmem/dalvik-jit-code-cache (deleted) (com.mapbox.mapboxsdk.maps.renderer.glsurfaceview.MapboxGLSurfaceView$GLThread.guardedRun+2912)
    #16 pc 0000000000577188  /system/lib64/libart.so (art_quick_invoke_stub+584)
    #17 pc 00000000000cf6a8  /system/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+200)
    #18 pc 000000000028c278  /system/lib64/libart.so (art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, art::ShadowFrame*, unsigned short, art::JValue*)+344)
    #19 pc 0000000000285d04  /system/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+1076)
    #20 pc 000000000054663c  /system/lib64/libart.so (MterpInvokeDirect+300)
    #21 pc 0000000000569894  /system/lib64/libart.so (ExecuteMterpImpl+14484)
    #22 pc 000000000042c738  /dev/ashmem/dalvik-classes2.dex extracted in memory from /data/app/com.mapbox.mapboxglexample-WlZXiBlGsafcmyfdu3q0jQ==/base.apk!classes2.dex (deleted) (com.mapbox.mapboxsdk.maps.renderer.glsurfaceview.MapboxGLSurfaceView$GLThread.run+48)
    #23 pc 000000000025eb68  /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEb.llvm.1315485517+488)
    #24 pc 000000000053583c  /system/lib64/libart.so (artQuickToInterpreterBridge+940)
    #25 pc 00000000005802fc  /system/lib64/libart.so (art_quick_to_interpreter_bridge+92)
    #26 pc 0000000000577188  /system/lib64/libart.so (art_quick_invoke_stub+584)
    #27 pc 00000000000cf6a8  /system/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+200)
    #28 pc 0000000000475d38  /system/lib64/libart.so (art::(anonymous namespace)::InvokeWithArgArray(art::ScopedObjectAccessAlreadyRunnable const&, art::ArtMethod*, art::(anonymous namespace)::ArgArray*, art::JValue*, char const*)+104)
    #29 pc 0000000000476ec8  /system/lib64/libart.so (art::InvokeVirtualOrInterfaceWithJValues(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jmethodID*, jvalue*)+424)
    #30 pc 00000000004a33a4  /system/lib64/libart.so (art::Thread::CreateCallback(void*)+1124)
    #31 pc 000000000008b574  /system/lib64/libc.so (__pthread_start(void*)+36)
    #32 pc 0000000000023c64  /system/lib64/libc.so (__start_thread+68)

@ivan-ljubicic
Copy link

ivan-ljubicic commented May 23, 2022

flutter-2.10.5_hybridCompositionEnabled.mp4
flutter-master.mp4
flutter-2.10.5_hybridCompositionDisabled.mp4

@felix-ht
This is tested on Android 9 (Xperia XZ Premium) in profile mode.
On flutter master channel with ExpensiveAndroidView and flutter 2.10.5 with hybrid composition enabled, app performance in general is bad (30fps avg), but map performance is great.
On flutter 2.10.5 and hybrid composition disabled app performance in general is great but map performance is bad. Although, only on screens which were dynamically built at the later point of app execution (not material routes). Screen with map built on the startup has better performance that the other even though this map has around 5000 points displayed.
Notice the clipping only works on this setting.

On flutter-master video app performance looks better that the other 2 but with Flutter Performance best was with hybrid composition disabled (55-60 fps)

@felix-ht
Copy link
Collaborator

@LjubiTech-Maxko please add this information to the flutter/flutter ticket or create a new one there - this feels more like a flutter issue than a maps issue.

@penhorwood
Copy link

This ticket on Flutter seems related: flutter/engine#33599

@felix-ht felix-ht self-assigned this May 30, 2022
@Shiba-Kar
Copy link

image

The widget tree Scaffold -> body -> Stack - > [ Map() ,Dropdown()] the Map() is above Appbar.

[√] Flutter (Channel stable, 3.0.1, on Microsoft Windows [Version 10.0.22621.1], locale en-US)
[√] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
[√] Chrome - develop for the web
[√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.1.0)
[√] Android Studio (version 2021.2)
[√] VS Code, 64-bit edition (version 1.67.2)
[√] Connected device (4 available)
[√] HTTP Host Availability

@tonnyavery
Copy link
Contributor Author

PR is blocked by flutter/flutter#103630 and flutter/engine#33599.
As soon as those are done and available in Flutter Stable, I will merge it.

@flutter-mapbox-gl flutter-mapbox-gl locked as spam and limited conversation to collaborators Jun 2, 2022
@felix-ht
Copy link
Collaborator

felix-ht commented Jun 2, 2022

i looked discussions for this pr to members with write access - if you want ask questions please do so in #1041

@felix-ht
Copy link
Collaborator

@AAverin seems like the fixes have landed on flutter master 3 days ago - can you check with that?

@tonnyavery
Copy link
Contributor Author

@felix-ht Because it was a rollback, no changes should be necessary anymore.
Running with latest Flutter master against latest mapbox master I don't get any issues anymore.

@tonnyavery
Copy link
Contributor Author

This is the only thing that I keep getting no on latest Flutter. We would need another PR to fix that somehow:

*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
LineageOS Version: '16.0-20211218-UNOFFICIAL-herolte'
Build fingerprint: 'samsung/heroltexx/herolte:8.0.0/R16NW/G930FXXU2ERD5:user/release-keys'
Revision: '0'
ABI: 'arm64'
pid: 13775, tid: 21373, name: GLThread 8752  >>> co.photohound <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0
Cause: null pointer dereference
    x0  0000000000000000  x1  0000000000000000  x2  0000000000000001  x3  0000007b0b2f2528
    x4  0000007aab3fe5a8  x5  8000000080000000  x6  ff284900ff302349  x7  7f7f7f7f7f7f7f7f
    x8  0000000000000000  x9  0000000000000001  x10 0000000000000001  x11 0000000000000000
    x12 0000000000000018  x13 0000000062bdfe88  x14 002adb0fed6ca400  x15 00005d4a362643e0
    x16 0000007ac8fb7f70  x17 0000007b8f78cdc0  x18 0000000000000015  x19 0000007aab3fe6c8
    x20 0000000000000000  x21 0000000000000001  x22 00000000136c0758  x23 0000000013d55fc8
    x24 00008296e2c3a84f  x25 0000000000000001  x26 0000000000000000  x27 0000000000000000
    x28 0000000000000000  x29 0000007aab3fe660
    sp  0000007aab3fe650  lr  0000007ac8ba281c  pc  0000007ac8ba2948
backtrace:
    #00 pc 000000000011d948  /data/app/co.photohound-WTSmiILG6Aq_UYc2zgE6oQ==/lib/arm64/libmapbox-gl.so
    #01 pc 000000000011d818  /data/app/co.photohound-WTSmiILG6Aq_UYc2zgE6oQ==/lib/arm64/libmapbox-gl.so
    #02 pc 00000000000adc2c  /data/app/co.photohound-WTSmiILG6Aq_UYc2zgE6oQ==/lib/arm64/libmapbox-gl.so
    #03 pc 00000000000aab9c  /dev/ashmem/dalvik-jit-code-cache (deleted) (com.mapbox.mapboxsdk.maps.renderer.MapRendererRunnable.run+124)
    #04 pc 0000000000047b90  /dev/ashmem/dalvik-jit-code-cache (deleted) (com.mapbox.mapboxsdk.maps.renderer.MapRenderer.onDrawFrame+96)
    #05 pc 000000000009857c  /dev/ashmem/dalvik-jit-code-cache (deleted) (com.mapbox.mapboxsdk.maps.renderer.glsurfaceview.GLSurfaceViewMapRenderer.onDrawFrame+44)
    #06 pc 00000000000afa80  /dev/ashmem/dalvik-jit-code-cache (deleted) (com.mapbox.mapboxsdk.maps.renderer.glsurfaceview.MapboxGLSurfaceView$GLThread.guardedRun+2912)
    #07 pc 0000000000577188  /system/lib64/libart.so (art_quick_invoke_stub+584)
    #08 pc 00000000000cf6a8  /system/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+200)
    #09 pc 000000000028c278  /system/lib64/libart.so (art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, art::ShadowFrame*, unsigned short, art::JValue*)+344)
    #10 pc 0000000000285d04  /system/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+1076)
    #11 pc 000000000054663c  /system/lib64/libart.so (MterpInvokeDirect+300)
    #12 pc 0000000000569894  /system/lib64/libart.so (ExecuteMterpImpl+14484)
    #13 pc 000000000028ec5c  /dev/ashmem/dalvik-classes3.dex extracted in memory from /data/app/co.photohound-WTSmiILG6Aq_UYc2zgE6oQ==/base.apk!classes3.dex (deleted) (com.mapbox.mapboxsdk.maps.renderer.glsurfaceview.MapboxGLSurfaceView$GLThread.run+48)
    #14 pc 000000000025eb68  /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEb.llvm.1315485517+488)
    #15 pc 000000000053583c  /system/lib64/libart.so (artQuickToInterpreterBridge+940)
    #16 pc 00000000005802fc  /system/lib64/libart.so (art_quick_to_interpreter_bridge+92)
    #17 pc 0000000000577188  /system/lib64/libart.so (art_quick_invoke_stub+584)
    #18 pc 00000000000cf6a8  /system/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+200)
    #19 pc 0000000000475d38  /system/lib64/libart.so (art::(anonymous namespace)::InvokeWithArgArray(art::ScopedObjectAccessAlreadyRunnable const&, art::ArtMethod*, art::(anonymous namespace)::ArgArray*, art::JValue*, char const*)+104)
    #20 pc 0000000000476ec8  /system/lib64/libart.so (art::InvokeVirtualOrInterfaceWithJValues(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jmethodID*, jvalue*)+424)
    #21 pc 00000000004a33a4  /system/lib64/libart.so (art::Thread::CreateCallback(void*)+1124)
    #22 pc 000000000008b574  /system/lib64/libc.so (__pthread_start(void*)+36)
    #23 pc 0000000000023c64  /system/lib64/libc.so (__start_thread+68)

@felix-ht
Copy link
Collaborator

felix-ht commented Jul 1, 2022

@AAverin can you post the error in the flutter git repo? (with steps for reproduction)

@tonnyavery
Copy link
Contributor Author

@felix-ht I think this will need more investigation. Next 2 weeks I am on vacation and will most likely don't have enough time to investigate myself.

The exception issue shouldn't be related to VirtualDisplay that was rolled back. Still, it looks to be another issue with Flutter 3 because I start getting it as soon as use Flutter 3. Exception comes from the native library that is out of our control, but it seems to be caused by some changes in Flutter 3.

I would say that this exception will be a blocker for this library to be fully migrated to Flutter 3.

You can reproduce exception by running examples we have.

@tonnyavery
Copy link
Contributor Author

I am closing this PR as no changes are required.
Flutter 3 updates for dart/flutter versions can be done separately to avoid any more confusions with this issue.

@tonnyavery tonnyavery closed this Jul 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Map totally distorted with Flutter 3.x.x

7 participants