seb42
Posts: 4
Joined: Sun Nov 15, 2015 10:36 am

Running Flutter, Google’s Portable UI Toolkit, on a rpi

Tue Jan 22, 2019 8:18 am

Haven't had a play with Flutter yet on my rpi, might get a screen this week and give it a go.
Flutter currently only has official support only for andorid and ios devices, it has also been used for UI stuff on Google's new OS, Fuchsia. So am interested to see where they go with Flutter this year.

Here is article about getting a flutter app running on the pi.
https://medium.com/flutter-io/flutter-o ... 24c5e7dcb1

IF you aren't across Flutter, here is a 11 minute recap of the Flutter live 1.0 event from December 2018.
https://youtu.be/D-o4BqJxmJE

Robbiedobbie
Posts: 5
Joined: Thu Jan 03, 2013 7:27 pm

Re: Running Flutter, Google’s Portable UI Toolkit, on a rpi

Wed Mar 20, 2019 2:47 pm

Did you happen to try this?
I'm currently trying to write an app for the raspi in flutter. I managed to get it up and running, however display elements keep disappearing at random. To me it looks like the gpu can't handle the amount of textures (Running on raspi3, with a 50/50 memory split, so it should have enough memory).

Maybe we can exchange notes?

Andyroo
Posts: 2823
Joined: Sat Jun 16, 2018 12:49 am
Location: Lincs U.K.

Re: Running Flutter, Google’s Portable UI Toolkit, on a rpi

Wed Mar 20, 2019 3:24 pm

The OP has not been back here since Jan. You can check by clicking on their user name in the post.
Need Pi spray - these things are breeding in my house...

Robbiedobbie
Posts: 5
Joined: Thu Jan 03, 2013 7:27 pm

Re: Running Flutter, Google’s Portable UI Toolkit, on a rpi

Thu Mar 21, 2019 7:48 am

Always worth a try. He might have a subsciption on this topic, with an email alert...

gedw99
Posts: 1
Joined: Sun Apr 07, 2019 3:06 pm

Re: Running Flutter, Google’s Portable UI Toolkit, on a rpi

Sun Apr 07, 2019 3:14 pm

If anyone gets a GitHub repo up with the build of flutter on rasp pi please list it.

I run flutter on desktops with golang and can help port plugins etc to get it all ticking along on a rasp pi.

Pretty exciting stuff btw !

Robbiedobbie
Posts: 5
Joined: Thu Jan 03, 2013 7:27 pm

Re: Running Flutter, Google’s Portable UI Toolkit, on a rpi

Mon Apr 08, 2019 7:48 am

It's not too hard to start from scratch. Basically you just use your hello triangle example but link against a self build (Which is the hardest part) libflutter_engine.so, and call the FlutterEngineRun function with a config for opengl backends. You then implement 5 callbacks that should refer back to opengl functions, et voila, it runs. (If you try release mode builds for the engine, you'll also have to prepare an AOT binary blob from your app, and map that into (partly executable memory).

I'm currently working on a photobooth in this framework, and will be releasing it as opensource when it's finished. It will have the code to run on raspberry pi, but I'm not sure that it will actually run on it. I still haven't managed to solve the texture issue, but it sure looks like it's just a limit on the very limited gpu of the raspberry pi.

I suspect that a raspi clone with a more modern (mali?) gpu would work much better for flutter.

ardera
Posts: 5
Joined: Wed Jul 18, 2018 9:49 am

Re: Running Flutter, Google’s Portable UI Toolkit, on a rpi

Fri Jun 07, 2019 9:08 am

Got it working too, including mouse support (but not mouse cursor support!). Code for the embedder is here: https://github.com/ardera/flutter-pi
And I, too, got the same weird texture problem; could be that it's because I didn't implement the make_resource_current callback, but that should be optional.
I don't think it's the VRAM either, cause the behaviour is the same with 64MB or 256MB VRAM. There are definitely points where all textures are loaded and visible, so maybe it's not the amount of textures that's causing this. I really hope it's just some kind of inconsistency in the raspberry pi's graphics implementation that we can hack around.

Performance is not that bad, 50-60fps with the default "flutter create" app, and I didn't even compile the engine in release mode yet.

Robbiedobbie
Posts: 5
Joined: Thu Jan 03, 2013 7:27 pm

Re: Running Flutter, Google’s Portable UI Toolkit, on a rpi

Fri Jun 07, 2019 9:12 am

I did implement make_resource_current since I also thought it might be related to that. It is not :(

I still think it is either memory related (It does seem to display just a little bit more with more vram). However, it might also have to do with the lack of power of 2 textures, however, I haven't looked into this...

ardera
Posts: 5
Joined: Wed Jul 18, 2018 9:49 am

Re: Running Flutter, Google’s Portable UI Toolkit, on a rpi

Fri Jun 07, 2019 8:04 pm

I still don't think it's memory related. You can get the amount of free gpu ram usage with

Code: Select all

vcgencmd get_mem malloc
+

Code: Select all

vcgencmd get_mem reloc
(Which is the amount of free-mem in the VideoCore malloc heap + VideoCore reloc heap)
For me, there were always 10MB (of 12MB total) malloc heap and ~190 (of ~245MB total) reloc heap free.

Also, there are a lot of basic OpenGL games that run under the VC IV. They probably use more textures that the basic "flutter create" app. So I don't think (and hope) it's hitting a VRAM limit here.

But how do you even start debugging this? I thought of hooking the procedures returned by the proc_resolver callback to trace the GL calls, but that's so much work.


EDIT: added VRAM numbers

Return to “Other programming languages”