SDK Flutter Porting to Set-Top Boxes for Android TV Apps


The world leader in digital TV, which brings advanced online solutions to legacy video systems.



To port the Flutter framework to three different set-top box models with the RDK open software platform, Intel x86, and the ARM architecture.



1. Concept development

The RDK (Reference Design Kit) software stack is used to develop OTT applications, implement voice control of set-top boxes, and other Video on Demand (VoD) functions. In solving our client's challenge, we had to determine whether Flutter could work on a set-top box with limited resources and ARM processors.

The original set-top boxes we worked with in the project were based on the Enlightenment Foundation Libraries (EFL) set and the Wayland graphics server organisation protocol. The drawing of primitives was implemented by node.js based on a plugin native module.

The EFL tools and a node.js platform with a large event loop were not the most suitable solutions for new development projects, despite Flutter allowing more productive rendering packages.

In addition to testing the hypothesis of performance enhancement when switching to Flutter, our list of tasks included migrating the current UI to Dart and supporting Neon instructions. Also, we had to consider the alpha-beta status of Linux support.


2. Software development

We ran Flutter on a platform with Wayland + OpenGL ES. Flutter's rendering is based on the Skia library, which supports OpenGL ES.

The next step was to create a build using the standard Flutter Clang build engine and a correct target sysroot device with RDK. The output is the flutter_engine library, and the header with the necessary functions for the embedder.

Next, we needed to build the Flutter / Dart target project with our library and engine.

The embedder is usually responsible for running the Flutter Engine, so the Linux embedder and GTK embedder were added to Flutter. However, this option was unsuitable when porting, and a GTK-independent solution was needed.

We used a custom embedder, which showed great performance. This is how we organised its work: we configured the call function from the flutter library and defined such parameters as transferring the project settings (a directory with our Flutter bundle) FlutterProjectArgs args and the rendering arguments Flutter Renderer Config.

When building Flutter for the target devices — three set-top boxes with RDK — problems occurred only on one STB with the Intel x86 architecture. There were no problems with the two remaining set-top boxes on ARM platforms.

There were some specific issues during the porting phase that we managed to solve:

  1. The first was that the embedder did not work correctly on the platform. The initialisation of egl-context in other applications and FlutterRendererConfig were correct. It turned out that eglBindAPI could not be triggered before eglGetDisplay, where the nexus display driver was specifically initialised. It is not a problem for a standard Linux distro, but this caused difficulties on our target platform, which was based on the BCM chip.
  2. The second issue had to do with uneven performance. The Flutter SDK had a special AOT machine code compilation mode, which we added to our embedder. In addition, we added certain instructions to FlutterEngineRun.

Then we built the application by getting an AOT-compiled module for our target platform. As a result, the application ran with much better performance.

We also encountered poor performance in the product UI application. As it turned out, one of the panels had a blurring effect that triggered active use of the __brcmcm_cpu_dcache_flush and khrn_copy_8888_to_tf32 functions, which was the reason for that low performance. We eliminated this defect by commenting on the effect: the application performance increased by 2—3 times, and the frame rate increased to 50—60 fps.


Business Value

We tested the concept and ported the Flutter framework to the RDK platform. The result is not just a working product application but a working application with a quality frame rate on Flutter on the target device. The combination turned out to be functional and allowed our client to develop applications on Flutter for RDK, not only for Android/iOS.

Other Case Studies

Tell us about your project!

All submitted information will be kept confidential.