Use of GTK on embedded Linux systems

Hi! I’ve encountered recently a question about which toolkit to use on embedded Linux. Being a GNOME person, I suggested GTK without knowing anything about the embedded use-case. The other party mentioned they’d like to draw directly to framebuffer and have it hardware accelerated. Qt seems to offer well-documented features for this use case: Qt for Embedded Linux | Qt 5.15.

Is GTK a good choice for embedded Linux or is it more convenient to stick with Qt or under solutions? And GTK is a good choice what should one use to properly utilize it?

No, GTK does not have a direct framebuffer backend. You still need to provide a windowing system, like X11 or Wayland.

…such as a minimal copy of Weston (which does provide a framebuffer backend), which is already used “in the wild” for embedded projects. You’ll probably want to look at “kiosk shell” — rather than the default desktop-shell — which autostarts a given fullscreen app

Weston also has a kiosk mode, which you can trivially activate with --shell=kiosk-shell.so or appending the following in the weston.ini config file

[core]
shell=kiosk-shell.so

So, the recommend approach would be to set up a Wayland compositor (either Shell, Weston or anything similar) and then use GTK in an application the “classic” way?

Given a more concrete example, let’s say I have a RaspberryPi 3B with a touchscreen display. If I were to use the simplified approach above, would I get hardware acceleration for the created GUI?

Yes, that’s how GTK works.

Define “hardware acceleration”. RPi3 has a GPU on its SoC that can use GLES, so you can have a Wayland display server that uses hardware acceleration to move buffers and present them on the screen. Additionally, GTK4 supports GLES as a rendering API, so it can use hardware acceleration to draw the contents of an application.

Of course, I would recommend using an RPi4, because anything older than that is kind of low spec’ed for complex rendering, especially if you end up on websites.

But I would also be hard pressed to classify a Raspberry Pi as an “embedded” Linux system. Just because it’s an Arm SoC, it doesn’t mean it’s “embedded”; otherwise, an Apple Arm MacBook would classify as an “embedded” system.

2 Likes

Sounds like exactly what I’m looking for.

Definitely but personally I believe even a RPi3 should be enough for a single running app on the system.But of course a beefier machine is always better.

You’re probably right. A RPi is the closest I’ve ever gotten to “embedded” myself, so I’m using it as an example. Don’t really know anything else.

Thank you for your insight!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.