feat: add disable_dirty_region_management option to fix flickering on iMX8MP (#334)#448
Closed
aki1770-del wants to merge 26 commits intosony:masterfrom
Closed
feat: add disable_dirty_region_management option to fix flickering on iMX8MP (#334)#448aki1770-del wants to merge 26 commits intosony:masterfrom
aki1770-del wants to merge 26 commits intosony:masterfrom
Conversation
The DRM backend failed to translate between view property dimensions (specified in scaled pixels) and Flutter window mentrics (specified in physical pixels). This patch fixes two issues: first, given the DRM backend (questionably) overrides the dimensions specified by the application with the native window dimensions but neglects to compensate for the current scaling factor. Secondly, cursor and touch events are not correctly mapped from physical pixels to scaled pixels. Signed-off-by: Luke Howard <lukeh@padl.com>
These scripts are heavily based on what sony provided in [1], with the container environment / cross compilation and some details fixed up to allow rebuilding an older version more easily. If these scripts live in the source repo further improvements can be made to avoid cloning flutter-embedded-linux twice more, but they are good enough for now, so let's start with what we have. Link: sony/flutter-elinux#289 (comment) [1]
Build broke with gcc-15 due to `error: unknown type name 'uint8_t'` Adding cstdint fixes that.
issues do not exist in flutter-elinux repo, so original sony links were kept Also give thanks to sony for creating the fork
fix: add missing cstdint header
Fix DRM backend dimension scaling
flutter-elinux fork: update most URLs to github.com/flutter-elinux
publish release scripts
When building with mesa 20 (debian bullseye) this define is missing, so backport it.
Building with trixie requires a recent glibc/stdc++ environment (GLIBC_2.38 / GLIBCXX_3.4.32), which might not be available on the target environment. Conversely, as far as libc/stdlib are concerned we are guarnateed to be able to run an old binary on a newer system, so building on a system as old as possible should address this particular issue. Unfortunately libflutter*so also link against system libraries (GL, X, wayland, fontconfig and many others), so if there is any so bump or imcompatible ABI then this is still far from perfect: future improvement should rebuild flutter-embedded-linux on demand for the required target, from flutter-elinux's CMake configuration The elinux embedded itself is not hard to build but libflutter_engine.so will be more work, so settle with "back to the old state" level for now.
required if mutiple platforms are available, otherwise egl may call into x11 and crash even if gbm is desired. tested on rk3588
Handle zwp_text_input_v1 and zwp_text_input_v3 purpose and hints based on flutter's TextInputType settings. This allows on-screen keyboards to adapt and e.g. display a number keypad on number input.
release build got much bigger since flutter 3.32 (for debug it went from 83MB to 385MB) This is apparently just because the lib is no longer stripped since [1] This looks like a bug since we don't target android (tentative fix in [2]), but until that lands just set --stripped manually. Even if there is no C symbol dart stacktraces are available so most people don't need these. Link: flutter/flutter#161546 [1] Link: flutter/flutter#181984 [2]
This allows compiling each individual file manually, so should fix any problem with external projects using our includes in different orders. Reported-by: Frede Hoey Braendstrup <frede@vokalo.io>
This was rebased manually but the code itself is verbatim. Tested with squeekboard/niri using the text input v3 protocol.
includes: Add missing dependent headers
release: use old bullseye container for release build
release: strip flutter engine .so again
Previous commit typo'd the ifdef, which made it have no effect. Since the define is identical the build didn't break for newer versions and CI didn't complain, but bullseye wasn't fixed as it should have, so address this. Fixes: 3ac3f1a ("drm: add DRM_MODE_CONNECTOR_USB define for old releases")
Prevents crashes by clearing cursor_info_.pointer when the pointer device (e.g., a mouse) disconnects and adding null check in UpdateFlutterCursor. Changes: - Clear cursor_info_.pointer when WL_SEAT_CAPABILITY_POINTER is removed - Add null check in UpdateFlutterCursor before accessing pointer Fixes: 434d509 ("Multiple seats (sony#417)")
…e-dangling-ref Fix cursor_info_.pointer dangling pointer on device disconnect (wayland)
Early fail if we are unable to create a render surface to avoid nullptr dereference crashes further down the track. Fixes: sony#14 Signed-off-by: Luke Howard <lukeh@padl.com>
Check CreateRenderSurface() return value
… iMX8MP (sony#334) Some GPU drivers (e.g. iMX8MP / NXP Vivante GC7000L) mishandle EGL_KHR_partial_update, causing display flickering when dirty region management is active. The Flutter engine's embedder_surface_gl.cc also hardcodes supports_partial_repaint=true (issue #119601), making the build-time USE_OPENGL_DIRTY_REGION_MANAGEMENT=OFF insufficient. Add disable_dirty_region_management to FlutterDesktopViewProperties. When set to true: - EGL damage extensions (EGL_KHR_partial_update, EGL_EXT/KHR_swap_buffers_with_damage) are not loaded at ELinuxEGLSurface construction time, so eglSwapBuffers always performs a full swap. - PopulateExistingDamage returns full-screen damage immediately, so the Flutter engine schedules a full repaint every frame. - Frame damage history is not accumulated (no-op when disabled). Existing behavior is fully preserved for all users who do not set this flag (zero-initialised = false = management enabled). Signed-off-by: Akihiko Komada <aki1770@gmail.com>
0919589 to
131c52f
Compare
Author
|
Repo has migrated to flutter-elinux/flutter-embedded-linux. Re-opening at https://github.com/flutter-elinux/flutter-embedded-linux. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Issue #334 reported display flickering at 1920×1080 on iMX8MP + Weston since flutter-elinux 3.7.6. Two converging causes:
EGL_KHR_partial_update— partial damage rects cause incorrect compositor behaviour, leaving stale regions unredrawn.embedder_surface_gl.cchardcodessupports_partial_repaint = true, so the build-timeUSE_OPENGL_DIRTY_REGION_MANAGEMENT=OFFflag is overridden by the engine — partial repaints remain active regardless.The reporter confirmed in #334 (comment) that returning full-screen damage from
PopulateExistingDamageeliminates the flickering. @HidenoriMatsubayashi suggested in #334 (comment) that a runtime option to disable dirty region management was the right approach.Solution
Add
disable_dirty_region_managementtoFlutterDesktopViewProperties. Whentrue:EGL_KHR_partial_update,EGL_EXT/KHR_swap_buffers_with_damage) are not loaded atELinuxEGLSurfaceconstruction —eglSwapBuffersalways performs a full swap.PopulateExistingDamagereturns full-screen damage immediately, so the Flutter engine schedules a full repaint every frame.Default is
false(zero-initialised) — existing behaviour is fully preserved for all users who do not set this field.Usage
FlutterDesktopViewProperties props = {}; props.width = 1920; props.height = 1080; // ... props.disable_dirty_region_management = true; // iMX8MP workaroundFiles changed
public/flutter_elinux.hdisable_dirty_region_managementfield toFlutterDesktopViewPropertieswindow/native_window.hIsDirtyRegionManagementDisabled()accessor + protected fieldwindow/native_window_wayland.h/.ccwindow/elinux_window_wayland.ccview_properties_.disable_dirty_region_managementtoNativeWindowWaylandsurface/context_egl.ccELinuxEGLSurfacein both surface creation pathssurface/elinux_egl_surface.h/.ccPopulateExistingDamageFixes #334