Brussels / 31 January & 1 February 2015



Programming the Linux Framebuffer in Java. #essentialtools and #allthethings #rgb

Java is a great language for rapid prototyping. For those interested in multimedia and UI design in Linux, however, there are limited options that provide a varying degree of performance and feasibility. It is quite straightforward to perform I/O on a Video 4 Linux device or the Linux framebuffer in C, but not as straightforward in Java. The end result of this project enables Java programmers program devices like the Linux framebuffer much ease as they use byte[] and int[] classes. An interactive demonstration will be made available as part of the workshop. Moreover, the implementation demonstrates speedups of up to 150x in MappedByteBuffer I/O.

This patchset [1], currently implemented as a proof of concept using JamVM and GNU Classpath, enables

1) the JVM to mmap special files (i.e. those in /dev) - something no other VM can do AFAIK 2) a true, direct, MappedByteBuffer from any mapping or pointer in the CRT 3) provides a safe, memory-managed Java backing array, via MappedByteBuffer.array() 4) speeds up MappedByteBuffer I/O by factor of up to 150 times!!

In human terms, it lets me draw to the FB[4] using pure Java :-) Since originally posting my patchset, I have made a few changes including removing the custom JNI calls in favour of using sun.misc.Unsafe API.

  • If possible describe why Free Java is helpful or perhaps even essential to your project.

This would have been practically impossible to do with a closed-source JVM and class library. JamVM and GNU Classpath have been open source for as long as I've known, and that's enabled me to become familiar enough with the source to make it do whatever I needed in various embedded environments.

  • What the audience will learn from the talk.

I will provide a fairly minimal VMWare image so that the audience can easily download the VM, modify some Java code, and draw whatever demo's they would like to to the FB - using pure Java! My forks are up on github [2,3]

  • How can people help out with the project, what feedback are you looking for?

I would like to have some feedback about the patchset to get it in good enough shape for acceptance to GNU Classpath and JamVM. I would like to entice some other tinkerers to port the changes to OpenJDK as well, and would like to get some feedback about possibly using JNA in combination with my /dev/fb and /dev/event classes. Lastly, I would very much like to open up the discussion about forming a performance-optimization group.

Recording me on audio and/or video: YES (acceptable)

[1] [2] [3] [4]


Photo of Chris Friedt Chris Friedt