Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

  • Screens from Chalkboard Electronics - both their older 10" 800x600 screen (2012 model) and their 10" 1280x800 screen (from the beginning of 2013)
  • The M2256PW monitor from 3M
  • The touch screen integrated into the Freescale i.MX6Q Sabre Device Platform.

In general a touch screen that is recognized by Linux and generates EV_ABS events will work with JavaFX.

Raspberry Pi OS

Tested:

  • Raspbian Jessie

  • Raspbian Jessie Lite

    • Note: is missing the Pango package for running OpenJFX. Easily fixed with "apt-get install libpango-1.0-0:armhf libpangoft2-1.0-0:armhf"
  • NOOBS (v1_4_1) installing:
    • Raspbian Debian Wheezy (2015-05-05)

When the raspi_config options are displayed, there is one critical item for OpenJFX. Under "Advanced Option" choose "Memory Split" and set the value to 128 or 256. This is the memory allocated for GPU use. OpenJFX can use quite a bit of memory for textures and shaders. The amount available to OpenJFX cannot be queried from the OS, and OpenJFX cannot always handle the failure gracefully. You can always run the raspi_config tool after install to change the value.

The Jessie images were tested with jdk-8u65-linux-arm32-vfp-hflt.tar.gz, which is downloadable from the Oracle JDK8 download page. Note that this version of the JDK does not come with an integrated JavaFX. JavaFX can be obtained by building OpenJFX for ARM, or by using one of the community builds.

OLDER DISTRO NOTES

The configuration used by Oracle for testing is:

...

  • Make sure to expand the filesystem, or you won't have enough room to install the JDK.
  • If you are using the device primarily with JavaFX, you will probably not want to select "Enable Boot to Desktop". JavaFX on the Pi takes over the whole screen and does not interact with the Linux desktop.
  • Under "Advanced Options" you can select "Memory Split" to allocate memory to the graphics processor. A 50/50 split will let you get most use out of JavaFX accelerated graphics.
  • If you are using JavaFX over ethernet, it can be convenient to turn on the SSH server under "Advanced Options". Since JavaFX takes over input devices, it can be hard to stop an application if you don't have an SSH connection to it from another machine.

Because of the way JavaFX is run, it is sensitive to the system screen blank timer. To disable the screen blank timer, edit the file /etc/kbd/config and change the lines for BLANK_TIME and POWERDOWN_TIME to be 0 (disable), and reboot. If not disabled, many applications will appear to stop after 30 minutes or so of use.

 

Tip

If you are connecting to your Pi over the network, you can save some time by setting a host name, and enabling ssh access for it in raspi-config, then installing the avahi-daemon package (sudo apt-get install avahi-daemon from the command line). You'll then be able to reach the Pi from a Linux PC with the command: ssh pi@<host name>.local

...

Then open /boot/cmdline.txt in an editor and add on the same line as the other options dwc_otg.speed=1. Run sudo sync and reboot. This drops USB speeds from 480Mbits/s to 12Mbits/s, which is known to resolve issues with a variety of USB devices on the Raspberry Pi.

Running a JDK

...

Raspbian has Java SE 7 preinstalled on the image. This version does not contain JavaFX. To obtain JavaFX download either:

...

This downloaded bundle should be unpacked on the Pi. For example,

Code Block
themeMidnight
languagebash
sudo tar zxvf jdk-8-xxxxxx-linux-arm-vfp-hflt.tar.gz -C /opt

To check that the JDK is installed correctly, run:

...

This should show that you are running JDK 8. If the VM won't even start, you might be running a hard-float VM on a soft-float system.

To avoid confusion, change your PATH variable so that the newer version is earlier in the path.

You can use the samples bundle from https://jdk8.java.net/download.html on the Raspberry Pi. Not all the samples will work on the Pi; here are some that will:

...

The older versions Raspberry Pi Raspian preallocate a fixed amount of the system memory for use by the video engine (VRAM).  The utility raspiraspi_config can be used to alter how much memory is allocated to VRAM.

Newer versions of Raspian can dynamically allocate system memory for use as VRAM.

JavaFX applications tend to need significant VRAM to operate properly, particularly applications that use large images, but also for fonts and gradients.

The minimum recommended memory split for JFX on the Pi is 128mb128 MBytes, with many applications requiring 256mb256 MBytes.

This JavaFX contains a texture caching mechanism that attempts to work within a limit of VRAM. Unfortunately, there is not an standard means of determining how much VRAM is available to start, nor is there a way to estimate the efficiency of that allocation. This is similar to standard malloc() which employs bucket mechanisms for efficiency but means that a small allocation will consume the nearest minimum bucket size. This JFX texture caching mechanism currently defaults to 256 MB 512 MBytes - a value that will likely exceed what is available on the Pi. Remember that the allocated VRAM will also be consumed by the framebuffer (width * height * 2 byte per pixel * 2 for swapping) as well as any other system needs. Given the limited amount of VRAM on the Pi, it is quite possible that an image intensive application might fail when the cache exceeds the available system limit.

The property -Dprism.maxvram=90M can be used to set the JFX texture cache limit, and in this example, setting it to 90 MB. This value would be a good starting value for a memory split of 256MB for VRAM.

To debug the JFX application failure, -Dprism.poolstats=true can be used to monitor the texture pool to better determine the upper limit.

In general, JFX will try to use no more than -Dprism.targetvram=xx, freeing textures when this value is exceeded. Least used textures will be discarded, and recreated on need. The default for this setting is calculated as 75% of the  maxvram setting, equal to 45M for the example of 90M. This setting may be overly aggressive for some applications, and experimentation with a larger value and  -Dprism.poolstats=true may result in more performance.Read this page for more details on VRAM and tuning.

Touch events

A touch screen attached to the Raspberry Pi generates both TouchEvents and MouseEvents. Only a single touch point is supported by default, but there is experimental support for multitouch events. To enable multitouch, set the system property -Dcom.sun.javafx.experimental.embedded.multiTouch=true on the Java command lineThe Monocle subsystem in the latest OpenJFX sources supports a wider range of touch screens than the 8u6 release does and also supports calibration.