...
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 128 MBytes, with many applications requiring 256 MBytes.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 JavaFX texture caching mechanism currently defaults to 256 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 setting -Dprism.maxvram=90M
can be used to set the JavaFX 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 a JavaFX application failure to allocate VRAM, -Dprism.poolstats=true
can be used to monitor the texture pool to better determine the upper limit.
In general, JavaFX 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 performanceRead this page for more details on VRAM and tuning.
Touch events
A touch screen attached to the Raspberry Pi generates both TouchEvent
s and MouseEvent
s. The Monocle subsystem in the latest OpenJFX sources supports a wider range of touch screens than the 8u6 release does and also supports calibration.