Tuesday, October 2, 2012

JavaOne 2012: JavaFX on Smart Embedded Devices

My first trip to Hotel Nikko for JavaOne 2012 came on Tuesday afternoon when I ventured to Nikko Ballroom II/III for David Hill's "JavaFX on Smart Embedded Devices." This was my second during-conference change in sessions. I had planned originally to attend the always-excellent Mark Reinhold talk on "The Modular Java Platform and Project Jigsaw," but just could not muster the motivation to attend a presentation, even from Reinhold, on a subject that won't be more directly relevant until at least 2015. I hope to catch him talking on Project Jigsaw at a conference in 2014.

With around 30 to 35 people in the audience at session start time, this was probably the least crowded session I've attended so far (the room would hold many times that number of people). It seems that the sessions starting at 3 pm after the only one-hour break of the day take a hit in terms of attendees who come at all and who come on time. The fact that this presentation was also in the Nikko and the festivities are now on the other (Taylor Street) side of the Hilton (used to be on the Mason Street side) may also have played a role. Or, it could be explained by the intersection of embedded developers and JavaFX developers being a small sample.

Hill started with a few questions. Less than half of the audience considers themselves to be embedded developers, but the vast majority have some degree of familiarity with JavaFX. Hill had a "JavaFX" slide that listed four bullets introducing JavaFX and he emphasized that JavaFX Embedded targets GPUs.

Hill quickly moved on from his introduction to JavaFX given the familiarity in the room with JavaFX. His slide "JavaFX Embedded" talked about potential markets: industrial automation, home automation, home entertainment systems, medical devices, automotive, and retail/informational kiosks.

Hill defined JavaFX Embedded as "a proper subset of JavaFX" without dependency on AWT or Swing. The later point implies that JavaFX Embedded cannot be used with the wrappers for Swing and SWT. He added that NetBeans and Scene Builder are tools common to both JavaFX and to JavaFX Embedded.

Hill talked about JavaFX Embedded rendering as well as input via mouse and keyboard and touch screens. JavaFX Embedded supports a virtual touch keyboard.

JavaFX Embedded's minimum footprint goal is approximately 16 MB (10 MB from Java Embedded SE and 6 MB from JavaFX Core). Media, Charts, and WebView (future release) will require the cost of additional memory footprint.

JavaFX Embedded has a "porting layer" on top of the mostly common code with the desktop. The porting layer is small and includes a Window Manager, special input, rendering, media decoders, and Webnode (future).

One of Hill's slides emphasized JavaFX features that won't be in JavaFX Embedded 8: System Menu support, Swing/SWT related nodes, drag and drop, and WebView. Only the last (WebView) "may make sense" for JavaFX Embedded.

JavaFX Embedded Developer Preview for ARM was made available on the same day as the JavaOne 2012 Strategy and Technical Keynotes. The targeted platforms are Linux 3.x and ARM. One of the challenges was picking the target platforms for limited resources to be focused on. Some of the "monitored platforms" include Raspberry Pi, Freescale I.MX53, and PandaBoard.

The JavaFX Embedded team is looking at several rendering paths. They currently prefer OpenGL ES2, EGL, and Frame Buffer. Hill talked about using DirectFB to Frame Builder without AWT dependency as another potential rendering path. Using OpenGL ES2, EGL, and X11 is yet another potential rendering path, but it adds overhead and limitations as well and won't be part of Java SE Embedded 8 release.

JavaFX Embedded uses GStreamer and they plan to support vendor-supplied GStreamer plugins.

Hill said that a desktop JavaFX application "probably will" run on an embedded device, but likely won't be usable. Real estate concerns are just one of several that arise when moving from desktop to embedded device. He reminded the audience that embedded platforms tend to have "slower CPU/GPU," "less memory," "likely smaller display" (Raspberry Pi outputs in high definition), and possibly a touch screen. He said you'll more likely be able to run your JavaFX Embedded application on a desktop.

Design considerations for JavaFX Embedded applications include maintaining simplicity when possible. Complex scene graphs will slow rendering. It is important to "free up unused resources," but this is a trade-off of memory for time. JavaFX has numerous effects and their performance costs differ based on the platform GPU. Another design consideration is to load pre-scaled images to avoid wasting "precious memory" to load a large image.

The minimum set of resources to run a JavaFX Embedded application include Linux, the JVM, and accelerated graphics. The question prompting this was related specifically to Raspberry Pi and Hill believes that environment is satisfactory for JavaFX Embedded.

This session interested me even though I don't have any familiarity with embedded development. I like to attend several sessions with practical and actionable things for me to learn, but I like to attend a few presentations like this that expand my view beyond my comfort zone.

3 comments:

Kai Wähner said...

Great blog post, Dustin. Unfortunately, I missed this session due do overlappings with another interesting one.

I believe that embedded software is THE future of JavaFX. As it requires a Java plugin, it is no good alternative in many uses cases for desktop and web - as I have also mentioned in my latest blog post: http://www.kai-waehner.de/blog/2012/10/02/avatar-as-alternative-for-java-server-faces-jsf-and-javafx-javaone-2012/

Best regards,
Kai Wähner (Twitter: @KaiWaehner)

Wan @ Jasper said...

JavaFX Embedded's minimum footprint goal is approximately 16 MB (10 MB from Java Embedded SE and 6 GB from JavaFX Core). Media, Charts, and WebView (future release) will require the cost of additional memory footprint.

i thinks you means 16 MB (10 MB from Java Embedded SE and 6 MB from JavaFX Core)
Right?

Dustin said...

Kai,

Thanks for the feedback. I'll admit that I haven't thought much before this about JavaFX on embedded software, but your comment and thinking about it more since attending this presentation has made me realize you might be correct about it being THE future of JavaFX. I'll check out your blog post.


Wan@Jasper,

Thanks for pointing that out. You are correct that all units are MB rather than GB and I'll fix that in the post. This just goes to show that I'm more use to dealing with desktop/GB than with embedded/MB.

Dustin