Embedded Flutter runtime targeting Embedded Linux with Wayland

Overview

ivi-homescreen

Build Status Total alerts Language grade: C/C++ Coverity Scan Build Status

IVI Homescreen for Wayland

  • Strongly Typed (C++)
  • Lightweight
    • Clang 11 Release Stripped = 151k
    • GCC 9.3 Release Stripped = 168k
  • Source runs on Desktop and Yocto Linux
    • Ubuntu 18+
    • Fedora 33+
    • Yocto Dunfell+
  • Platform Channels enabled/disabled via CMake
  • OpenGL Texture Framework

x86_64 Desktop development notes

Ubuntu 16-18

Logging in

Log out if logged in Login screen Click on username field Right-click on the gear icon below username field, and select "Ubuntu on Wayland" Enter password and login

Ubuntu 20+ / Fedora 33+

Defaults to Wayland, no need to do anything special

Build steps

Required Packages

sudo add-apt-repository ppa:kisak/kisak-mesa
sudo apt-get update -y
sudo apt-get -y install libwayland-dev wayland-protocols \
mesa-common-dev libegl1-mesa-dev libgles2-mesa-dev mesa-utils \
libxkbcommon-dev

GCC/libstdc++ Build

git clone https://github.com/toyota-connected-na/ivi-homescreen.git
mkdir build && cd build
cmake .. -DCMAKE_STAGING_PREFIX=`pwd`/out/usr/local
make install -j

Clang/libc++ Build

git clone https://github.com/toyota-connected-na/ivi-homescreen.git
mkdir build && cd build
CC=/usr/lib/llvm-12/bin/clang CXX=/usr/lib/llvm-12/clang++ cmake .. -DCMAKE_STAGING_PREFIX=`pwd`/out/usr/local
make install -j

Clang Toolchain Setup

wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 12
sudo apt-get install -y libc++-12-dev libc++abi-12-dev libunwind-dev

CI Example

https://github.com/toyota-connected-na/ivi-homescreen/blob/main/.github/workflows/ivi-homescreen-linux.yml

Debian Package

make package -j
sudo apt install ./ivi-homescreen-1.0.0-Release-beta-Linux-x86_64.deb

Flutter Application

Build

Confirm flutter/bin is in the path using: flutter doctor -v

cd ~/development/my_flutter_app
flutter channel beta
flutter upgrade
flutter config --enable-linux-desktop
flutter create .
flutter build bundle

Install

loading path for application is: /usr/local/share/homescreen/bundle

This is used to leverage symlinks. Such as:

cd /usr/local/share/homescreen
sudo rm -rf bundle
sudo ln -sf ~/development/my_flutter_app/build/ bundle

Or

sudo mkdir -p /usr/local/share/homescreen/my_flutter_app/
sudo cp -r build/* /usr/local/share/homescreen/my_flutter_app/
sudo ln -sf /usr/local/share/homescreen/my_flutter_app/ bundle

Running on desktop

Copy a current icudtl.dat to /usr/local/share/flutter Copy libflutter_engine.so to /usr/local/lib or use LD_LIBRARY_PATH to point downloaded engine for build:

cd <homescreen build>
export LD_LIBRARY_PATH=`pwd`:$LD_LIBRARY_PATH
homescreen

Debug

cd to flutter app folder

flutter config --enable-linux-desktop
flutter create .
flutter attach --debug-port 41795 --host-vmservice-port 41795

CMAKE dependency paths

Path prefix used to determine required files is determined at build.

For desktop CMAKE_INSTALL_PREFIX defaults to /usr/local For target Yocto builds CMAKE_INSTALL_PREFIX defaults to /usr

Yocto recipe

https://github.com/jwinarske/meta-flutter/blob/dunfell/recipes-graphics/toyota/ivi-homescreen_git.bb
Comments
  • Rename embedder to something more suitable (running multiple instances of the embedder)

    Rename embedder to something more suitable (running multiple instances of the embedder)

    Presumably this change is a bit controversial, I'm merely suggesting a name change, not really sure the one that I picked is really good or not.

    Naming this homescreen doesn't really make sense in platforms where there are multiple instances of the embedder running so I suggested (re)naming it flutter-ed (flutter-embedder).

    Obviously the meta-flutter recipes also need changing, but I said to get the ball rolling and see how people feel about this.

    opened by mv0 12
  • Running on Desktop Ubuntu

    Running on Desktop Ubuntu

    I can build desktop ubuntu 20 just fine but when it comes to running Copy libflutter_engine.so to /usr/local/lib or use LD_LIBRARY_PATH to point downloaded engine for build:

    Question where do i get libflutter_engine.so from ? Do I try and build a copy using https://github.com/meta-flutter/flutter_embedded
    or Can i use one of my local copies created during flutter snap install maybe the release copy

    parallels > find /home/parallels/snap/flutter -type f -name "libflutter*.so" -print /home/parallels/snap/flutter/common/flutter/bin/cache/artifacts/engine/android-x86/libflutter.so /home/parallels/snap/flutter/common/flutter/bin/cache/artifacts/engine/android-x64/libflutter.so /home/parallels/snap/flutter/common/flutter/bin/cache/artifacts/engine/linux-x64/libflutter_linux_gtk.so /home/parallels/snap/flutter/common/flutter/bin/cache/artifacts/engine/linux-x64-release/libflutter_linux_gtk.so /home/parallels/snap/flutter/common/flutter/bin/cache/artifacts/engine/linux-x64-profile/libflutter_linux_gtk.so

    please advise regards

    opened by bernardcraddock 8
  • Redo the EGL window creation

    Redo the EGL window creation

    This patch series includes the ability start up correctly as maximized/fullscreen from the beginning on the AGL platform.

    Specifically this patch series:

    • groups together agl-shell protocol requests in the EglWindow constructor
    • makes part of the initial commit the set_toplevel request and the frame callback
    • redoes the EGL window/surface creation to allow starting up as maximized/fullscreen
    • paves the way to have regular applications starting up in various scenarios (compositor sending 0 values and apps need to chose a default value).

    With these changes I get the gallery application running on both swrast (llvmpipe) and HW accelerated drivers.

    LE: I've verified/tested this patch series on x86_64:

    • Debian testing with gnome-shell/mutter 4.20
    • Debian testing with weston main (post weston 10)
    • Debian testing with AGL compositor master
    • AGL platform (qemu x86_64) w/ a master from a few days ago (6 of May 2022). Together with https://gerrit.automotivelinux.org/gerrit/c/AGL/meta-agl/+/27460 (an unrelated change to this patch series) we get a boot-up to flutter gallery application.
    opened by mv0 7
  • xdg_shell, multi-output, remove sprawl, cleanup

    xdg_shell, multi-output, remove sprawl, cleanup

    xdg_shell -replaces wl_shell for xdg_shell

    Multiple outputs -Adds support for saving state on multiple outputs -Enables deriving the buffer scaling factor

    Cleanup -Remove unused methods/variables -Remove unused headers -Initialize uninitialize variables -rename m_engine to m_flutter_engine in App class

    Remove sprawl option -Not required with xdg_shell

    Update README.md -Enabling flutter desktop causes App build issue. This has been the case for some time. Only use custom devices for debugging eLinux Flutter.

    FPS feature cleanup -Fix narrowing warnings -Update README for usage

    Remove pinch gesture references -Dart layer gesture detection being used. Not all targets have this protocol

    opened by jwinarske 4
  • How do I run release version of flutter app with ivi-homescreen ?

    How do I run release version of flutter app with ivi-homescreen ?

    Firs of all this is not an issue. I am not able to find steps to run release version of flutter apps.

    With this patch I was able to run debug version of the the apps with ivi-homescreen.

    diff --git a/shell/engine.cc b/shell/engine.cc
    index 5eb4205..7c979f1 100644
    --- a/shell/engine.cc
    +++ b/shell/engine.cc
    @@ -87,7 +87,7 @@ Engine::Engine(App* app, size_t index)
           }),
           m_renderer_config(
               {.type = kOpenGL,
    -           .open_gl = {
    +           .open_gl = FlutterOpenGLRendererConfig {
                    .struct_size = sizeof(FlutterOpenGLRendererConfig),
                    .make_current = [](void* userdata) -> bool {
                      auto e = reinterpret_cast<Engine*>(userdata);
    

    Above fix is probably only required for g++ & not clang++.

    $ g++ --version
    g++ (Ubuntu 11.2.0-7ubuntu2) 11.2.0
    

    However when I attempt to run release bundle I see an error about missing flutter_assets/kernel_blob.bin

    [INFO:display.cc(67)] No agl_shell extension present
    [INFO:display.cc(71)] WL_SHM_FORMAT_XRGB32 not available
    [INFO:display.cc(257)] Pointer Present
    [INFO:display.cc(266)] Keyboard Present
    [ERROR:/home/skamath/proactive/flutter/ivi-homescreen/shell/engine.cc(142)] (0) /usr/local/share/homescreen/bundle/flutter_assets/kernel_blob.bin missing Flutter Kernel
    
    opened by shrkamat 4
  • Minor parsing fixes for JSON configuration file

    Minor parsing fixes for JSON configuration file

    This patch series fixes some minor parsing isssues I've found while using the JSON config file.

    Specifically, app_id specified over the configuration is being ignored and found similar issue with debug_backend and disable_cursor.

    opened by mv0 3
  • Enable pixel_ratio arg from CLI

    Enable pixel_ratio arg from CLI

    Allows making pixel_ratio something other than 1.0 using optional command line arg.

    Examples --

    ./homescreen --w=640 --h=480 --r=2.0
    
    Screen Shot 2022-06-22 at 8 44 03 PM
    ./homescreen --w=640 --h=480 --r=0.5
    
    Screen Shot 2022-06-22 at 8 44 21 PM enhancement 
    opened by cmc5788 2
  • Simplify wayland mouse input translation

    Simplify wayland mouse input translation

    Addressing issue described in #56 and simplifying the previous wayland mouse input events to flutter pointer events translation in ivi-homescreen:

    Sanity checked implementation here against the official flutter linux shell's mouse input handling for motion, scrolling and button events. The relevant analogous code sections are linked below:

    Motion: https://github.com/flutter/engine/blob/main/shell/platform/linux/fl_view.cc#L371-L372 motion events are either kMove or KHover, matching linux desktop: https://github.com/flutter/engine/blob/main/shell/platform/linux/fl_view.cc#L383

    Scrolling (Axis in wayland): https://github.com/flutter/engine/blob/main/shell/platform/linux/fl_scrolling_manager.cc#L67 Notice that for scrolling events the pointer phase is disregarded and kMove is chosen arbitrarily based on this comment https://github.com/flutter/engine/blob/main/shell/platform/linux/fl_scrolling_manager.cc#L122-L123

    Button: https://github.com/flutter/engine/blob/main/shell/platform/linux/fl_view.cc#L114-L115 Currently this PR does not drop redundant events but perhaps it should try to mimic such behavior. Another difference is that this PR does not keep track of previous button state and so only sends kUp or kDown events for button events, never kMove or KHover, it's unclear to me if this should behavior should be copied or not. https://github.com/flutter/engine/blob/main/shell/platform/linux/fl_view.cc#L130-L148

    Tested this PR manually on the default flutter increment button app which no longer crashes with debug assertions described in Issue #56.

    opened by doesnotexist 2
  • Mouse pointer motion events sometimes violate debug assertion check for state.is_down

    Mouse pointer motion events sometimes violate debug assertion check for state.is_down

    On my ubuntu 20.04, wayland+weston+ivi-homescreen running the default flutter create "increment" button app with debug engine v2.10.3 arm64, I'm finding that the app often crashes when using mouse input because this assertion check fails.

    [FATAL:flutter/lib/ui/window/pointer_data_packet_converter.cc(189)] Check failed: !state.is_down. 
    

    https://github.com/flutter/engine/blob/main/lib/ui/window/pointer_data_packet_converter.cc#L190

    I believe this is a manifestation of a bug in translating wayland input events to flutter, specifically within Display::pointer_handle_motion() https://github.com/toyota-connected/ivi-homescreen/blob/main/shell/display.cc#L399

    Which calls getPointerPhase(), and in some instances the state can be such that p->buttons is not null and state == WL_POINTER_BUTTON_STATE_RELEASED which ends up translating the event to FlutterPointerPhase::kUp. https://github.com/toyota-connected/ivi-homescreen/blob/main/shell/display.cc#L337 However, if no kDown event is sent between this kUp event and some previous kUp event (say from releasing the mouse button) then the debug assert fails and the app crashes with the FATAL warning above.

    Based on what I've gathered from reading the comments in embedder.h https://github.com/flutter/engine/blob/main/shell/platform/embedder/embedder.h#L727-L743

    I propose that the wayland input event listener Display::pointer_handle_motion() should only translate to FlutterPointerPhase::kMove or FlutterPointerPhase::kHover depending on whether the left mouse button is currently pressed down or not during the motion event. PR that implements this change coming shortly.

    opened by doesnotexist 1
  • Why does ivi-homescreen the fixed flutter assets path(=`/usr/local/share/homescreen`)?

    Why does ivi-homescreen the fixed flutter assets path(=`/usr/local/share/homescreen`)?

    From my understanding, ivi-homescreen can launch the flutter aseets placed at /usr/local/share/homescreen only. How can I launch multiple flutter apps with ivi-homescreen?

    If ivi-homescreen accepts another flutter assets path from cmdline args like flutter-wayland(https://github.com/chinmaygarde/flutter_wayland), ivi-homescreen will become more flexible.

    What do you think of this idea?

    opened by WAKazuyoshiAkiyama 1
  • Widget Exception Fix

    Widget Exception Fix

    • Fixes: "The following _CastError was thrown while checking if the clipboard has strings: type 'bool' is not a subtype of type 'Map<String, dynamic>?' in type cast"

    Signed-off-by: Joel Winarske [email protected]

    opened by jwinarske 0
  • Add CodeQL workflow

    Add CodeQL workflow

    Hi toyota-connected/ivi-homescreen!

    This is not an automatic, 🤖-generated PR, as you can check in my GitHub profile, I work for GitHub and I am part of the GitHub Security Lab which is helping out with the migration of LGTM configurations to Code Scanning. You might have heard that we've integrated LGTM's underlying CodeQL analysis engine natively into GitHub. The result is GitHub code scanning!

    With LGTM fully integrated into code scanning, we are focused on improving CodeQL within the native GitHub code scanning experience. In order to take advantage of current and future improvements to our analysis capabilities, we suggest you enable code scanning on your repository. Please take a look at our blog post for more information.

    This pull request enables code scanning by adding an auto-generated codeql.yml workflow file for GitHub Actions to your repository — take a look! We tested it before opening this pull request, so all should be working :heavy_check_mark:. In fact, you might already have seen some alerts appear on this pull request!

    Where needed and if possible, we’ve adjusted the configuration to the needs of your particular repository. But of course, you should feel free to tweak it further! Check this page for detailed documentation.

    Questions? Check out the FAQ below!

    FAQ

    Click here to expand the FAQ section

    How often will the code scanning analysis run?

    By default, code scanning will trigger a scan with the CodeQL engine on the following events:

    • On every pull request — to flag up potential security problems for you to investigate before merging a PR.
    • On every push to your default branch and other protected branches — this keeps the analysis results on your repository’s Security tab up to date.
    • Once a week at a fixed time — to make sure you benefit from the latest updated security analysis even when no code was committed or PRs were opened.

    What will this cost?

    Nothing! The CodeQL engine will run inside GitHub Actions, making use of your unlimited free compute minutes for public repositories.

    What types of problems does CodeQL find?

    The CodeQL engine that powers GitHub code scanning is the exact same engine that powers LGTM.com. The exact set of rules has been tweaked slightly, but you should see almost exactly the same types of alerts as you were used to on LGTM.com: we’ve enabled the security-and-quality query suite for you.

    How do I upgrade my CodeQL engine?

    No need! New versions of the CodeQL analysis are constantly deployed on GitHub.com; your repository will automatically benefit from the most recently released version.

    The analysis doesn’t seem to be working

    If you get an error in GitHub Actions that indicates that CodeQL wasn’t able to analyze your code, please follow the instructions here to debug the analysis.

    How do I disable LGTM.com?

    If you have LGTM’s automatic pull request analysis enabled, then you can follow these steps to disable the LGTM pull request analysis. You don’t actually need to remove your repository from LGTM.com; it will automatically be removed in the next few months as part of the deprecation of LGTM.com (more info here).

    Which source code hosting platforms does code scanning support?

    GitHub code scanning is deeply integrated within GitHub itself. If you’d like to scan source code that is hosted elsewhere, we suggest that you create a mirror of that code on GitHub.

    How do I know this PR is legitimate?

    This PR is filed by the official LGTM.com GitHub App, in line with the deprecation timeline that was announced on the official GitHub Blog. The proposed GitHub Action workflow uses the official open source GitHub CodeQL Action. If you have any other questions or concerns, please join the discussion here in the official GitHub community!

    I have another question / how do I get in touch?

    Please join the discussion here to ask further questions and send us suggestions!

    opened by jorgectf 0
  • Multi-View Video Player

    Multi-View Video Player

    Only a single instance of Video Player is currently supported. The static plugin needs to be refactored to handle multiple views.

    Currently a low priority.

    opened by jwinarske 0
  • ivi-homescreen does not support keyboard repeat

    ivi-homescreen does not support keyboard repeat

    @jwinarske I tried to run my app to check the ivi-homescreen's features related to input envents, but, my app have not worked correctly. It seems ivi-homescreen cannot accept any keyboard events at least.

    The behavior of my app is the following.

    • When the up half of the window is clicked, the mid bar will become blue to indicate that the up half takes focus.
    • While the up half takes focus, TextField will start to work.
    • When A or B key is pressed, some messages like [A_KeyDown][A_Repeat][A_KeyUp] will be output in the low half of the window.
    • When other keys is pressed, a character of a pressed key is visible in TextField.

    When I use the official linux-desktop device, the app worked correctly, but, when I use ivi-homescreen for Desktop, even if I press any keys, the app has no reaction for any keys.

    Please see the video.

    How can I use keyboard inputs in ivi-homescreen? OR, keyboard inputs is the missing feature of ivi-homescreen?

    SIDE NOTES: ivi-homescreen causes core-dump when it is interrupted by Ctrl-C.

    $ ~/homescreen --a=build/flutter_assets
    [INFO:display.cc(50)] agl_shell extension not present
    [INFO:display.cc(280)] Pointer Present
    [INFO:display.cc(289)] Keyboard Present
    [INFO:engine.cc(200)] Runtime=debug
    [INFO:engine.cc(91)] flutter: The Dart VM service is listening on http://127.0.0.1:42187/ufLHlW6rddA=/
    [INFO:navigation.cc(33)] Navigation: Select Single Entry History
    [INFO:navigation.cc(47)] Navigation: Route Information Updated
    	location: /
    	state: 
    	replace: 0
    dddddddddddddddaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbb^C[FATAL:flutter/fml/thread_local.cc(30)] Check failed: false. pthread_setspecific failed (22): Invalid argument
    [1]    28678 abort (core dumped)  ~/homescreen --a=build/flutter_assets
    
    opened by WAKazuyoshiAkiyama 40
Owner
null
Embedded Flutter

flutter_embedded This repo is used for CI automation to build flutter-engine embedder for Linux. Project Status x86_86 and aarch64 functional No exter

Joel Winarske 154 Dec 28, 2022
Flutter plugin for Flutter desktop(macOS/Linux/Windows) to change window size.

desktop_window Flutter plugin for Flutter desktop(macOS/Linux/Windows) to change window size. Usage import 'package:desktop_window/desktop_window.dart

ChunKoo Park 72 Dec 2, 2022
Flutter on Windows, MacOS and Linux - based on Flutter Embedding, Go and GLFW.

go-flutter - A package that brings Flutter to the desktop Purpose Flutter allows you to build beautiful native apps on iOS and Android from a single c

null 5.5k Jan 6, 2023
A clean front-end plugin to Volumio, the Linux distribution for music playback. Volumio Touch Display Lite is written in Flutter and runs on flutter-pi.

EN | 中文 Touch Display Lite plugin for Volumio 3 Feng Zhou, 2021-12 Touch Display Lite is a clean and fast user interface for Volumio 3, the Linux dist

Feng Zhou 5 Jul 26, 2022
File picker plugin for Flutter, compatible with mobile (iOS & Android), Web, Desktop (Mac, Linux, Windows) platforms with Flutter Go support.

A package that allows you to use the native file explorer to pick single or multiple files, with extensions filtering support.

Miguel Ruivo 987 Jan 6, 2023
🎞 Flutter media playback, broadcast & recording library for Windows, Linux & macOS. Written in C++ using libVLC & libVLC++. (Both audio & video)

dart_vlc Flutter media playback, broadcast, recording & chromecast library for Windows, Linux & macOS. Written in C++ using libVLC & libVLC++. Install

Hitesh Kumar Saini 417 Dec 29, 2022
Flutter library for window blur & transparency effects for on Windows & Linux. 💙

flutter_acrylic Window blur & transparency effects for Flutter on Windows & Linux Installation Mention in your pubspec.yaml. dependencies: ... flu

Hitesh Kumar Saini 437 Dec 31, 2022
A Flutter plugin to read 🔖 metadata of 🎵 media files. Supports Windows, Linux & Android.

flutter_media_metadata A Flutter plugin to read metadata of media files. A part of Harmonoid open source project ?? Install Add in your pubspec.yaml.

Harmonoid 60 Dec 2, 2022
A cross-platform (Android/Windows/macOS/Linux) USB plugin for Flutter

quick_usb A cross-platform (Android/Windows/macOS/Linux) USB plugin for Flutter Usage List devices List devices with additional description Get device

Woodemi Co., Ltd 39 Oct 1, 2022
A tutorial for creating an Ubuntu Linux Flutter app, using the yaru theme

Building a Yaru app with Flutter Summary URL https://github.com/ubuntu/user_manager Category Environment Linux Status Feedback Link Author Frederik Fe

Ubuntu 22 Dec 21, 2022
A flutter application to monitor your Linux PC statistic.

Linux Stats App A flutter application to monitor your Linux PC statistic. Screenshots Installation Download or clone the repository: $ git clone https

Malte2036 7 Dec 17, 2022
An 🎵 audio playback library for Flutter Desktop. Supports Windows & Linux. Based on miniaudio.

✒ libwinmedia is sequel to this project. It provides network playback, better format support, control & features. An audio playback library for Flutte

Hitesh Kumar Saini 50 Oct 31, 2022
A small karaoke app made in Flutter for Linux

Karaoke app for linux A small karaoke/lyrics display for the currently running VLC song. Video: Make sure the songs have metadata (at least title and

Wazzaps 63 Jan 7, 2023
A simple-to-use flutter update package for Windows, MacOS, and Linux.

Updat - The simple-to-use, flutter-based desktop update package Updat is a simple-to-use reliable flutter-native updater that handles your application

Eduardo M. 14 Dec 21, 2022
🎵 A cross-platform media playback library for C/C++ with good number of features (only Windows & Linux).

libwinmedia A cross-platform media playback library for C/C++ & Flutter with good number of features. Example A very simple example can be as follows.

Harmonoid 38 Nov 2, 2022
A package which provides most of the window decorations from linux themes.

Window Decorations A package which provides most of the window decorations from linux themes. Features Easier to use and implement Native looking wind

Prateek SU 20 Dec 21, 2022
A cross-platform app ecosystem, bringing iMessage to Android, PC (Windows, Linux, & even macOS), and Web!

BlueBubbles Android App BlueBubbles is an open-source and cross-platform ecosystem of apps aimed to bring iMessage to Android, Windows, Linux, and mor

BlueBubbles 318 Jan 8, 2023
An app to monitor linux PC stats directly from your phone.

L I N U X M O N An app to monitor linux PC stats such as CPU, Battery, RAM etc. on your phone. Installation Install the server on your PC LINUX Downlo

Ayush Singh 20 Dec 21, 2022
A pure Dart implementation of Firebase with initial support aimed at FlutterFire for Linux & Windows.

FlutterFire Desktop A work in progress pure Dart implementation of Firebase with initial support aimed at FlutterFire for Linux & Windows. A FlutterFi

Invertase 293 Jan 4, 2023