Repository navigation
Flutter app crashes on AndroidThings / RaspberryPi 3 with hardware rendering enabled #12010
Description
According to the Android Things 0.5.0 devpreview release notes, hardware rendering is now enabled.
https://developer.android.com/things/preview/releases.html
New in Preview 5
OpenGL 2.0 Support
With the update to Android O, OpenGL ES 2.0 is now supported. Platforms with a GPU (such as Raspberry Pi 3) also now support hardware acceleration.
Steps to Reproduce
Download the AndroidThings Raspberry Pi 3 devpreview version 0.5.0 or 0.5.1, install on SD card, boot up RPi3. With ethernet connected run adb connect IP_ADDRESS. Then run the Flutter demo app using:
flutter run -d iot
Running with software rendering enabled using the command line flag works, e.g.
flutter run --enable-software-rendering -d iot
Logs
Flutter error message:
[ +314 ms] Starting: Intent { act=android.intent.action.RUN flg=0x20000000 cmp=com.yourcompany.hello_test/.MainActivity (has extras) }
[ ] Waiting for observatory port to be available...
[+1671 ms] Diagnostic server URL on device: http://127.0.0.1:37594/
[ +7 ms] /Users/raju/Library/Android/sdk/platform-tools/adb -s 192.168.0.15:5555 forward tcp:8103 tcp:37594
[ +12 ms] Forwarded host port 8103 to device port 37594 for Diagnostic server
[ +159 ms] Observatory URL on device: http://127.0.0.1:37928/
[ +1 ms] /Users/raju/Library/Android/sdk/platform-tools/adb -s 192.168.0.15:5555 forward tcp:8102 tcp:37928
[ +39 ms] Forwarded host port 8102 to device port 37928 for Observatory
[ +56 ms] Connected to service protocol: http://127.0.0.1:8102/
[ +3 ms] getVM: {}
[ +124 ms] E/flutter ( 1442): [ERROR:flutter/shell/gpu/gpu_surface_gl.cc(176)] Could not wrap onscreen surface.
Debug output from adb shell dumpsys SurfaceFlinger:
[raju@MacBook-Pro-2:~]$ adb shell dumpsys SurfaceFlinger
Build configuration: [sf HAS_CONTEXT_PRIORITY=0 DISABLE_TRIPLE_BUFFERING PRESENT_TIME_OFFSET=0 FORCE_HWC_FOR_RBG_TO_YUV=0 MAX_VIRT_DISPLAY_DIM=0 RUNNING_WITHOUT_SYNC_FRAMEWORK=0 NUM_FRAMEBUFFER_SURFACE_BUFFERS=2] [libui] [libgui]
Wide-Color information:
hasWideColorDisplay: 0
Display 0 color modes:
HAL_COLOR_MODE_NATIVE (0)
Current color mode: HAL_COLOR_MODE_NATIVE (0)
Sync configuration: [using: EGL_KHR_fence_sync EGL_KHR_wait_sync]
DispSync configuration: app phase 1000000 ns, sf phase 1000000 ns, present offset 0 ns (refresh 16666667 ns)
Static screen stats:
< 1 frames: 0.098 s (0.0%)
< 2 frames: 0.522 s (0.1%)
< 3 frames: 0.962 s (0.1%)
< 4 frames: 0.182 s (0.0%)
< 5 frames: 0.211 s (0.0%)
< 6 frames: 0.193 s (0.0%)
< 7 frames: 0.325 s (0.0%)
7+ frames: 658.271 s (99.6%)
Buffering stats:
[Layer name] <Active time> <Two buffer> <Double buffered> <Triple buffered>
Visible layers (count = 4)
+ LayerDim 0xa5942000 (animation background stackId=0#0)
Region transparentRegion (this=0xa5942278, count=1)
[ 0, 0, 0, 0]
Region visibleRegion (this=0xa5942008, count=1)
[ 0, 0, 0, 0]
Region surfaceDamageRegion (this=0xa5942044, count=1)
[ 0, 0, 0, 0]
layerStack= 0, z= 20999, pos=(-480,-300), size=(2880,1800), crop=( 0, 0, -1, -1), finalCrop=( 0, 0, -1, -1), isOpaque=0, invalidate=0, alpha=0.000, flags=0x00000001, tr=[1.00, 0.00][0.00, 1.00]
client=0xa76950a0
format= 0, activeBuffer=[ 0x 0: 0, 0], queued-frames=0, mRefreshPending=0
mTexName=7 mCurrentTexture=-1
mCurrentCrop=[0,0,0,0] mCurrentTransform=0
mAbandoned=0
-BufferQueue mMaxAcquiredBufferCount=1, mMaxDequeuedBufferCount=2, mDequeueBufferCannotBlock=0 mAsyncMode=0, default-size=[2880x1800], default-format=1, transform-hint=00, FIFO(0)={}
[00:0x0] state=FREE
[01:0x0] state=FREE
[02:0x0] state=FREE
+ LayerDim 0xa5944000 (Background for - SurfaceView - com.yourcompany.hello_test/com.yourcompany.hello_test.MainActivity#0)
Region transparentRegion (this=0xa5944278, count=1)
[ 0, 0, 0, 0]
Region visibleRegion (this=0xa5944008, count=1)
[ 0, 0, 1920, 1200]
Region surfaceDamageRegion (this=0xa5944044, count=1)
[ 0, 0, 0, 0]
layerStack= 0, z= -3, pos=(0,0), size=(1920,1200), crop=( 0, 0, -1, -1), finalCrop=( 0, 0, -1, -1), isOpaque=0, invalidate=0, alpha=1.000, flags=0x00000002, tr=[1.00, 0.00][0.00, 1.00]
client=0xa59035a0
format= 0, activeBuffer=[ 0x 0: 0, 0], queued-frames=0, mRefreshPending=0
mTexName=16 mCurrentTexture=-1
mCurrentCrop=[0,0,0,0] mCurrentTransform=0
mAbandoned=0
-BufferQueue mMaxAcquiredBufferCount=1, mMaxDequeuedBufferCount=2, mDequeueBufferCannotBlock=0 mAsyncMode=0, default-size=[1x1], default-format=1, transform-hint=00, FIFO(0)={}
[00:0x0] state=FREE
[01:0x0] state=FREE
[02:0x0] state=FREE
+ Layer 0xa5946000 (SurfaceView - com.yourcompany.hello_test/com.yourcompany.hello_test.MainActivity#0)
Region transparentRegion (this=0xa5946278, count=1)
[ 0, 0, 0, 0]
Region visibleRegion (this=0xa5946008, count=1)
[ 0, 0, 0, 0]
Region surfaceDamageRegion (this=0xa5946044, count=1)
[ 0, 0, 0, 0]
layerStack= 0, z= -2, pos=(0,0), size=(1920,1200), crop=( 0, 0, -1, -1), finalCrop=( 0, 0, -1, -1), isOpaque=0, invalidate=0, alpha=1.000, flags=0x00000002, tr=[1.00, 0.00][0.00, 1.00]
client=0xa59035a0
format= 4, activeBuffer=[ 0x 0: 0, 0], queued-frames=0, mRefreshPending=0
mTexName=15 mCurrentTexture=-1
mCurrentCrop=[0,0,0,0] mCurrentTransform=0
mAbandoned=0
-BufferQueue mMaxAcquiredBufferCount=1, mMaxDequeuedBufferCount=2, mDequeueBufferCannotBlock=0 mAsyncMode=0, default-size=[1920x1200], default-format=4, transform-hint=00, FIFO(0)={}
[00:0xa768c780] state=DEQUEUED, 0xa768c960 [1920x1200:1920, 1]
[01:0x0] state=FREE
[02:0x0] state=FREE
+ Layer 0xa5948000 (com.yourcompany.hello_test/com.yourcompany.hello_test.MainActivity#1)
Region transparentRegion (this=0xa5948278, count=1)
[ 0, 0, 1920, 1200]
Region visibleRegion (this=0xa5948008, count=1)
[ 0, 0, 0, 0]
Region surfaceDamageRegion (this=0xa5948044, count=1)
[ 0, 0, 0, 0]
layerStack= 0, z= 21005, pos=(0,0), size=(1920,1200), crop=( 0, 0,1920,1200), finalCrop=( 0, 0, 0, 0), isOpaque=0, invalidate=0, alpha=1.000, flags=0x00000000, tr=[1.00, 0.00][0.00, 1.00]
client=0xa5903870
format= 1, activeBuffer=[1920x1200:1920, 1], queued-frames=0, mRefreshPending=0
mTexName=17 mCurrentTexture=0
mCurrentCrop=[0,0,0,0] mCurrentTransform=0
mAbandoned=0
-BufferQueue mMaxAcquiredBufferCount=1, mMaxDequeuedBufferCount=2, mDequeueBufferCannotBlock=0 mAsyncMode=0, default-size=[1920x1200], default-format=1, transform-hint=00, FIFO(0)={}
>[00:0xa768cc80] state=ACQUIRED, 0xa768ce60 [1920x1200:1920, 1]
[01:0x0] state=FREE
[02:0x0] state=FREE
Displays (1 entries)
+ DisplayDevice: Built-in Screen
type=0, hwcId=0, layerStack=0, (1920x1200), ANativeWindow=0xa6b9e008, orient= 0 (type=00000000), flips=130, isSecure=1, powerMode=2, activeConfig=0, numLayers=1
v:[0,0,1920,1200], f:[0,0,1920,1200], s:[0,0,1920,1200],transform:[[1.000,0.000,-0.000][0.000,1.000,-0.000][0.000,0.000,1.000]]
mAbandoned=0
-BufferQueue mMaxAcquiredBufferCount=1, mMaxDequeuedBufferCount=1, mDequeueBufferCannotBlock=0 mAsyncMode=0, default-size=[1920x1200], default-format=1, transform-hint=00, FIFO(0)={}
>[01:0xa59edb60] state=ACQUIRED, 0xa595f2c0 [1920x1200:1920, 1]
[00:0xa7cccdc0] state=FREE , 0xa5b9ecc0 [1920x1200:1920, 1]
SurfaceFlinger global state:
EGL implementation : 1.4 (DRI2)
EGL_ANDROID_framebuffer_target EGL_ANDROID_image_native_buffer EGL_ANDROID_recordable EGL_EXT_image_dma_buf_import EGL_KHR_cl_event2 EGL_KHR_config_attribs EGL_KHR_create_context EGL_KHR_fence_sync EGL_KHR_get_all_proc_addresses EGL_KHR_gl_colorspace EGL_KHR_gl_renderbuffer_image EGL_KHR_gl_texture_2D_image EGL_KHR_gl_texture_3D_image EGL_KHR_gl_texture_cubemap_image EGL_KHR_image_base EGL_KHR_no_config_context EGL_KHR_reusable_sync EGL_KHR_surfaceless_context EGL_KHR_wait_sync EGL_MESA_configless_context EGL_MESA_drm_image EGL_MESA_image_dma_buf_export
GLES: Broadcom, Gallium 0.4 on VC4 V3D 2.1, OpenGL ES 2.0 Mesa 17.0.4
GL_EXT_debug_marker GL_EXT_blend_minmax GL_EXT_multi_draw_arrays GL_EXT_texture_format_BGRA8888 GL_OES_compressed_ETC1_RGB8_texture GL_OES_depth24 GL_OES_element_index_uint GL_OES_fbo_render_mipmap GL_OES_mapbuffer GL_OES_rgb8_rgba8 GL_OES_stencil8 GL_OES_texture_3D GL_OES_texture_npot GL_OES_vertex_half_float GL_OES_EGL_image GL_OES_depth_texture GL_OES_packed_depth_stencil GL_EXT_texture_type_2_10_10_10_REV GL_OES_get_program_binary GL_APPLE_texture_max_level GL_EXT_discard_framebuffer GL_EXT_read_format_bgra GL_NV_fbo_color_attachments GL_OES_EGL_image_external GL_OES_EGL_sync GL_OES_vertex_array_object GL_EXT_unpack_subimage GL_NV_draw_buffers GL_NV_read_buffer GL_NV_read_depth GL_NV_read_depth_stencil GL_NV_read_stencil GL_EXT_draw_buffers GL_EXT_map_buffer_range GL_KHR_debug GL_OES_surfaceless_context GL_EXT_separate_shader_objects GL_EXT_draw_elements_base_vertex GL_EXT_texture_border_clamp GL_KHR_context_flush_control GL_OES_draw_elements_base_vertex GL_OES_texture_border_clamp
Wide-color: Off
Region undefinedRegion (this=0xa7cc77ac, count=1)
[ 0, 0, 1920, 1200]
orientation=0, isDisplayOn=1
last eglSwapBuffers() time: 1276.302000 us
last transaction time : 263.386000 us
transaction-flags : 00000000
refresh-rate : 59.999999 fps
x-dpi : 93.783997
y-dpi : 92.362999
gpu_to_cpu_unsupported : 0
eglSwapBuffers time: 0.000000 us
transaction time: 0.000000 us
VSYNC state: disabled
soft-vsync: disabled
numListeners=14,
events-delivered: 160
0xa5798860: count=-1
0xa59dfb30: count=-1
0xa59e0070: count=-1
0xa7688030: count=-1
0xa7688060: count=-1
0xa7688090: count=-1
0xa7688120: count=-1
0xa7688180: count=-1
0xa76881b0: count=-1
0xa76881e0: count=-1
0xa7688240: count=-1
0xa7688270: count=-1
0xa7688330: count=-1
0xa7688360: count=-1
Display 0 HWC layers:
-------------------------------------------------------------------------------
Layer name
Z | Comp Type | Disp Frame (LTRB) | Source Crop (LTRB)
-------------------------------------------------------------------------------
Background for - SurfaceView - com.y[...]ourcompany.hello_test.MainActivity#0
4294967293 | Client | 0 0 1920 1200 | 0.0 0.0 -1.0 -1.0
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
h/w composer state:
h/w composer enabled
Allocated buffers:
0xa595efa0: 9000.00 KiB | 1920 (1920) x 1200 | 1 | 1 | 0x1a00 | <Unknown>
0xa595f2c0: 9000.00 KiB | 1920 (1920) x 1200 | 1 | 1 | 0x1a00 | FramebufferSurface
0xa59ee920: 9000.00 KiB | 1920 (1920) x 1200 | 1 | 1 | 0x1a00 | <Unknown>
0xa5b9ecc0: 9000.00 KiB | 1920 (1920) x 1200 | 1 | 1 | 0x1a00 | FramebufferSurface
0xa768c960: 9000.00 KiB | 1920 (1920) x 1200 | 1 | 1 | 0x900 | SurfaceView - com.yourcompany.hello_test/com.yourcompany.hello_test.MainActivity#0
0xa768ce60: 9000.00 KiB | 1920 (1920) x 1200 | 1 | 1 | 0x933 | com.yourcompany.hello_test/com.yourcompany.hello_test.MainActivity#1
0xa7ccf2a0: 9000.00 KiB | 1920 (1920) x 1200 | 1 | 1 | 0x1a00 | <Unknown>
Total allocated (estimate): 63000.00 KB
Analyzing /Users/raju/coding/flutter/flutterdemo...
No issues found!
Ran in 5.6s
Flutter Doctor
[✓] Flutter (on Mac OS X 10.12.6 16G29, locale en-DK, channel alpha)
• Flutter at /Users/raju/dev/flutter
• Framework revision 1c372c6803 (7 days ago), 2017-08-31 15:54:45 -0700
• Engine revision f9e00a7c72
• Tools Dart version 1.25.0-dev.11.0
[✓] Android toolchain - develop for Android devices (Android SDK 25.0.3)
• Android SDK at /Users/raju/Library/Android/sdk
• Platform android-25, build-tools 25.0.3
• ANDROID_HOME = /Users/raju/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_112-release-b06)
[✓] iOS toolchain - develop for iOS devices (Xcode 8.3.3)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 8.3.3, Build version 8E3004b
• ios-deploy 1.9.1
• CocoaPods version 1.2.1
[✓] Android Studio (version 2.3)
• Android Studio at /Applications/Android Studio.app/Contents
• Java version OpenJDK Runtime Environment (build 1.8.0_112-release-b06)
[✓] IntelliJ IDEA Community Edition (version 2017.2.3)
• Flutter plugin version 17.0
• Dart plugin version 172.3968.27
[✓] Connected devices
• iot rpi3 • 192.168.0.15:5555 • android-arm • Android 8.0.0 (API 26)
• MacBook Pro • BDF0C637-F4E9-587E-B340-8D5210C61F72 • ios • iOS 2
Activity
Hixie commentedon Sep 12, 2017
This is fascinating. We would totally support you and review any fixes you found were needed to make this work. We don't plan on supporting non-phone devices in the near future ourselves.
blundell commentedon Oct 3, 2017
not sure I see the benefit of writing Flutter to control AndroidThings? It's like expecting flutter to create server-side swift or java programs .. just because it's the same language
Takhion commentedon Oct 3, 2017
@blundell some AndroidThings devices have a screen, I'm assuming that's why @raju-bitter is trying to use Flutter...?
blundell commentedon Oct 3, 2017
raju-bitter commentedon Oct 9, 2017
Right, AndroidThings can be run with touch screens connected, e.g. NXP i.MX7D Development Board with Pimoroni Rainbow HAT for Android Things and camera, touch screen.
I'll do some more testing over the next 2 weeks and report results back here.
MahMoos commentedon Jun 26, 2018
Any results @raju-bitter ?
zoechi commentedon Jan 30, 2019
See also #7099 (comment)
13 remaining items
darshankawar commentedon Jun 12, 2024
Considering AndroidThings has been shut down and age of this issue, I'll close this as obsolete.
github-actions commentedon Jun 26, 2024
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.