flutter-pi: getting vblank timestamps sometimes fails or results in invalid timestamps

I am having the same issue as in https://github.com/ardera/flutter-pi/issues/16

That is, flutter-pi shows a blank screen when I try to start the app when the Pi is connected to this display: https://www.waveshare.com/10.1inch-HDMI-LCD-B-with-case.htm

Connecting the Raspberry Pi to an hp 1080p monitor, everything works fine, including the touch screen panel from the above Waveshare display, so I can control the app fine by touching the display when I pipe the image to the HP monitor.

I’m running flutter-pi on Raspberry Pi 4 with the latest version of Raspbian Buster Desktop. I’ve modified it to boot to command line and then running flutter-pi there. The Waveshare display works otherwise fine, I’m able to for example boot to chromium in kiosk-mode and run a Flutter for Web app on it fine.

Any ideas how to get the display to work on flutter-pi? My expertise on such hardware issues is limited so it’s a bit challenging to troubleshoot this one.

Here’s the log when starting the app from SSH:

pi@raspberrypi:~/flutter-pi/out $ ./flutter-pi /home/pi/uikit/flutter_assets
engine_argv[0] = ./flutter-pi
initializing display...
Finding a suitable DRM device, since none is given...
looking for a suitable DRM device from 2 available DRM devices...
  devices[0]:
    available nodes: DRM_NODE_PRIMARY,
    nodes[DRM_NODE_PRIMARY] = "/dev/dri/card1"
    bustype: DRM_BUS_PLATFORM
    businfo.fullname: /soc/gpu
    opening DRM device candidate at "/dev/dri/card1"...
    getting resources of DRM device candidate at "/dev/dri/card1"...
    flutter-pi chose "/dev/dri/card1" as its DRM device.
  devices[1]:
    available nodes: DRM_NODE_PRIMARY, DRM_NODE_RENDER
    nodes[DRM_NODE_PRIMARY] = "/dev/dri/card0"
    nodes[DRM_NODE_RENDER] = "/dev/dri/renderD128"
    bustype: DRM_BUS_PLATFORM
    businfo.fullname: /v3dbus/v3d@7ec04000
Finding a connected connector from 1 available connectors...
  connectors[0]: connected? yes, type: 0x0B (HDMI-A), 150mm x 100mm
Choosing DRM mode from 2 available modes...
  modes[0]: name: "1280x800", 1280x800p, 63Hz, type: 72, flags: 10
    this mode is preferred by DRM. (DRM_MODE_TYPE_PREFERRED)
  modes[1]: name: "1280x800", 1280x800p, 60Hz, type: 32, flags: 6
Display properties:
  1280 x 800, 63Hz
  150mm x 100mm
  pixel_ratio = 2.245614
Finding DRM encoder...
Creating GBM device
Querying EGL client extensions...
Getting EGL display for GBM device...
Initializing EGL...
Querying EGL display extensions...
Using display 0x5cc538 with EGL version 1.4
===================================
EGL information:
  version: 1.4
  vendor: "Mesa Project"
  client extensions: "EGL_EXT_device_base EGL_EXT_device_enumeration EGL_EXT_device_query EGL_EXT_platform_base EGL_KHR_client_get_all_proc_addresses EGL_EXT_client_extensions EGL_KHR_debug EGL_EXT_platform_wayland EGL_EXT_platform_x11 EGL_MESA_platform_gbm EGL_MESA_platform_surfaceless EGL_EXT_platform_device"
  display extensions: "EGL_ANDROID_blob_cache EGL_EXT_buffer_age EGL_EXT_image_dma_buf_import EGL_EXT_image_dma_buf_import_modifiers EGL_KHR_cl_event2 EGL_KHR_config_attribs EGL_KHR_create_context EGL_KHR_create_context_no_error 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 EGL_KHR_image_base EGL_KHR_image_pixmap EGL_KHR_no_config_context EGL_KHR_reusable_sync EGL_KHR_surfaceless_context EGL_EXT_pixel_format_float EGL_KHR_wait_sync EGL_MESA_configless_context EGL_MESA_drm_image EGL_MESA_image_dma_buf_export EGL_MESA_query_driver EGL_WL_bind_wayland_display "
===================================
Binding OpenGL ES API...
Choosing EGL config...
Finding EGL configs with appropriate attributes...
Creating EGL context...
Creating EGL window surface...
===================================
OpenGL ES information:
  version: "OpenGL ES 3.0 Mesa 19.2.0-rc1"
  shading language version: "OpenGL ES GLSL ES 3.00"
  vendor: "Broadcom"
  renderer: "V3D 4.2"
  extensions: "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_standard_derivatives GL_OES_stencil8 GL_OES_texture_3D GL_OES_texture_float GL_OES_texture_half_float GL_OES_texture_half_float_linear GL_OES_texture_npot GL_OES_vertex_half_float GL_EXT_texture_sRGB_decode 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_EXT_frag_depth GL_NV_fbo_color_attachments GL_OES_EGL_image_external GL_OES_EGL_sync GL_OES_vertex_array_object GL_EXT_occlusion_query_boolean GL_EXT_texture_rg 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_KHR_texture_compression_astc_ldr GL_OES_depth_texture_cube_map GL_OES_required_internalformat GL_OES_surfaceless_context GL_EXT_color_buffer_float GL_EXT_sRGB_write_control GL_EXT_separate_shader_objects GL_EXT_shader_integer_mix GL_EXT_base_instance GL_EXT_compressed_ETC1_RGB8_sub_texture 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 GL_OES_texture_stencil8 GL_EXT_float_blend GL_KHR_no_error GL_KHR_texture_compression_astc_sliced_3d GL_OES_EGL_image_external_essl3 GL_MESA_shader_integer_functions GL_KHR_parallel_shader_compile GL_EXT_texture_query_lod "
===================================
Swapping buffers...
Locking front buffer...
getting new framebuffer for BO...
Setting CRTC...
Clearing current context...
finished display setup!
Initializing Application...
Initializing Plugin Registry...
[services-plugin] init.
[text_input] init.
[raw_keyboard] init.
[test-plugin] init.
[elm327plugin] elm_open: process doesn't have access to serial device "/dev/rfcomm0": No such file or directory
[elm327plugin] ELM327Plugin_init: ELM327 communication was not initialized successfully. elm327plugin won't supply any OBDII data. error code: No such file or directory
[elm327plugin] running pid query queue processor
[ERROR:engine/src/flutter/shell/platform/embedder/embedder_surface_gl.cc(107)] Could not create a resource context for async texture uploads. Expect degraded performance. Set a valid make_resource_current callback on FlutterOpenGLRendererConfig.
flutter: Observatory listening on http://127.0.0.1:35431/U7qsOz2kkTw=/
[ERROR:engine/src/flutter/shell/platform/embedder/embedder_surface_gl.cc(107)] Could not create a resource context for async texture uploads. Expect degraded performance. Set a valid make_resource_current callback on FlutterOpenGLRendererConfig.
flutter engine successfully started up.
Initializing Input devices...
  input device 0: path="/dev/input/event0"
      WaveShare WS170120, connected via USB. vendor: 0x0EEF, product: 0x0005, version: 0x0110
Running IO thread...
Running message loop...

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 21 (9 by maintainers)

Commits related to this issue

Most upvoted comments

Though eventually would be useful to be able to squeeze that extra performance out.

I agree.

So, decided to go with flutter-pi for embedded so I can live that code (and animate) once deploy everywhere dream for real … (if they hopefully get flutter for web production ready this year)

Nice! I’ve got to say though that flutter-pi is not really production ready. Could be that there are bugs or security risks, I don’t provide any guarantees for that, it’s more like an experiment right now. I’m not sure flutter-pi is the best way to solve the underlying problem either (flutter on linux without X or wayland), but I haven’t found a better solution yet.

Can confirm that it works now, no crashes. Your work is super impressive.

Thank you!

Sorry to go a bit off-topic, but since we’re discussing displays and as I’ve banged my head against this all day, quick question: is there a way to flip the HDMI screen 90 degrees somehow for flutter-pi?

This is actually integrated into flutter, just use SystemChrome.setPreferredOrientations.

The default DeviceOrientation is landscapeLeft. If you want to rotate 90 degrees clockwise, you need to set the orientation to portraitUp. Just call

await SystemChrome.setPreferredOrientations(const {DeviceOrientation.portraitUp});

somewhere in your code.

The screen works now, but there’s a nasty side effect. I get this crash pretty soon after scrolling views in flutter:

my bad, some parts of the vsync mechanism mistakenly weren’t disabled by the workaround. Should work now.

When I tried the latest commit, a error Could not get last VBlank timestamp. drmCrtcGetSequence came up.

Wow drmCrtcGetSequence seems to be really buggy. I changed the behaviour so that flutter-pi will not exit when drmCrtcGetSequence returns an error. In your case, it should now print something like:

WARNING: Could not get last vblank timestamp. <error code>
         VSync will be disabled.
         . . .

Can you tell me what error code it prints in your case? So whats the text after Could not get last vblank timestamp.?

EDIT: Would be even better if you could include the a log of the full output of flutter-pi, so I also can look at the modesetting stuff