Qt 5.6 is here and it runs on FreeBSD/Pi

March 20, 2016 — 12 Comments

Qt 5.6 is finally out so I thought I’d give it a spin on my Raspberry Pi. Previously I used cross-compilation but this time I thought I’d spend some time in trying to create ports Qt modules. There is Qt 5.5.1 in ports and it’s nicely split into sub-ports and most of gory details are hidden in bsd.qt.mk library. The problem with it is it’s highly coupled with Xorg stuff and I didn’t find easy way to squeeze non-desktop use cases into current infrastructure. So I just created new custom devel/qt56 port.

In order to get it done as fast as possible I took several shortcuts: all the stuff is installed to /usr/local/qt5 directory, there is no meta-port for submodules to share common part yet. Also besides base the only module I packaged (I was particularly interested in it) was QtMultimedia. Should be fairly easy to fix last 2 items though.

Qt layer for UI provider is called QPA: Qt Platform Abstraction. There are quite a few of them but I am familiar and interested in two: plain framebuffer and eglfs. Plain framebuffer stock QPA plugin is called linuxfb and naturally we can’t use it for FreeBSD. Luckily there is a lot of similarities between Linux fb and syscons(or vt) fb (you can’t get very innovative with framebuffer) so writing QPA support for scfb was easy. It can be used with any generic SoC with framebuffer support: AM335x(beaglebone black), i.MX6(Wandboard), NVIDIA Tegra, Pi.

elgfs is full-screen OpenGL mode. OpenGL implementation depends on SoC vendor, e.g. Pi’s library is provided by raspberrypi-userland port. If we had OpenGL support for AM335x it would have been provided by PowerVR userland libraries. As far as I understand eglfs can’t be made universal: each implementation has its own quirks so you have to specify target OpenGL vendor during build time. So far we support eglfs only for Raspberry Pi thanks to Broadcom’s open-sourcing kernel drivers and userland libraries.

Then there is question of input. When you start your application from console you have several options to get user’s input: keyboard, mouse, touchscreen. Common way to do this on Linux is through evdev which is a universal ways to access these kinds of devices. There is effort to get this functionality on FreeBSD so when it’s there stock input plugins could be used as-is. Until then there are two non-standard plugins by yours truly: bsdkeyboard and bsdsysmouse.

scfb, bsdysmouse, and bsdkeyboard are included in experimental ports as patches.

All in all experience of getting Qt 5.6 running on FreeBSD/Pi was smooth. And to make this post more entertining here are two demos running on my Pi2 with official touchscreen.

Qt demo player with visualizer (src):

OpenGL demo with Qt logo in it (src):



12 responses to Qt 5.6 is here and it runs on FreeBSD/Pi

  1. What are you using as display for FreeBSD/rpi on this video ? Thank you!

      • You get amazing responsiveness and fluidity on your Pi touchscreen.

        I don’t have such touchscreen so I am using my raspberry pi 2 HDMI output, and I experience slowness in the bar visualization, it doesn’t look responsive and synchronized with the sound.

        See my TV for yourself: https://youtu.be/HY_lprHkyqA

        Do you experience the same behavior with your qt-demo-player when plugged on your HDMI TV?

        Thanks for your feedback!

        • Current visualizer code is very inefficient. On larger resolutions it’s slow. I am planning to optimize it first, and then write one more implementation using OpenGL.

          • Thanks Oleksandr for your feedback! Indeed my TV resolution is 1920×1080, so I understand my QT installation is not faulty, instead code has to be optimized.

            Can’t wait for your new QT code or a new blog post from you (about FreeBSD on the raspberry pi obviously ;-))

      • One last (hopefully) question: how do you use the mouse and keyboard (how do you load the qbsdkeyboard and qbsdsysmouse plugins at runtime)?

        I have VT console and usb keyboard and mouse working on the framebuffer console, but how do I make them work in a QT eglfs application?

        Thanks in advance

        • OK got it, added -plugin bsdkeyboard -plugin bsdsysmouse. Keyboard works for most keys (have an Apple Keyboard) when I press some key then I lost complete control and even killing the app makes it mess the vt console keyboard.

          For the bsdsysmouse, I didn’t manage to get the cursor appear 🙁 Did you manage?

          • I am going to polish both plugins and submit them upstream. Could you describe sequence of events that leads to loosing control over keyboard?

            As for mouse – cursor is part of Qt and may be I have it disabled as part of configure, I just don’t remember. I’m going to recover this setup in next few days so I’ll have more information then

  2. As always, pretty amazed by your work! Please continue the blog and continue committing to the FreeBSD project for the Pi 2, I am learning a lot with your code.

  3. Which EGL version are you using (the one from graphics/libEGL of the one from misc/raspberrypi-userland)?

    I am getting pkg / ports conflicts between libEGL and raspberry-userland, how did you overcome them? I wish I could use the two at the same time so that I could have both omxplayer and some other ports which require graphics/libEGL installed on my system.


    • Maybe we could have the misc/raspberrypi-userland port installed in /usr/local/vc/(lib|include) rather than directly in /usr/local/(lib|include). I can only think of the multimedia/omxplayer port which would be impacted (and the sample programs which come with the userland port).

    • My bad I wasn’t using you own devel port.

Leave a Reply

Text formatting is available via select HTML. <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>