What is the use of various Qt platform plugins?

2020-05-19 04:29发布

问题:

I was doing some cross compiling of a Qt5.2 application for an ARM based target (TI AM335x EVM) and it was failing to display anything on my platform. After doing some google’ing I found that if I launched it with:

 ./helloworld -platform eglfs

it would show up (full screen, but it worked)!

I started looking at all the platform options, I found:

android, eglfs, linuxfb, minimalegl, windows, xcb, cocoa, ios, offscreen, qnx, directfp, kms, minimal, openwfd

I’m wondering what they are for. I assume, for example, that if I wanted to run my application on an Android device I’d have to pass -platform android, but they’re not all obvious to me.

Is there a listing anywhere of when each of these parameters should be used?

For example, what does eglfs stand for? And why did I need to use that where as linuxfb didn’t work?
(I would have thought the linux frame buffer was how I wanted to launch my application since it was running on embedded linux)

回答1:

If the linuxfb plugin doesn't work, then possibly you didn't correctly configure the framebuffer device on your system. Maybe a directf layer is already running, so you may want to try the directfb plugin instead.

If you wish to avoid having to specify the platform option when you run the executable, you can pass the default one to configure when you build Qt.

The plugins can be described as follows:

  • Linux plugins - those use Linux-specific input devices and various output devices

    • eglfs - Uses the OpenGL ES in fullscreen mode. There's no other way since OpenGL has no concept of a window manager.

    • directfb (not directfp) - Uses the linux frame buffer with OpenGL ES via the directfb layer. Integrates into the directfb windowing.

    • linuxfb - Uses the linux frame buffer in fullscreen mode. There's no other way since linuxfb has no concept of a window manager.

    • kms - Uses linux kernel modesetting API in fullscreen mode. There's no other way since DRM has no concept of a window manager.

    • openwfd - Uses an openwfd Wifi display in fullscreen mode. There's no other way since openwfd has no concept of a window manager.

  • Platform-independent plugins - could be made to run on any OS

    • xcb - Runs on an X11 server and is integrated into the X11 windowing environment. Generally it won't behave correctly without a window manager running as well. Can be made to work on Windows, given a Windows implementation of xlib, if you want to, say, serve applications from a Windows server to X11 thin terminals (typically Unix boxes).

    • offscreen - Renders to an offscreen buffer. Useful for rendering to custom displays.

    • minimal - A minimalistic backing store that optionally dumps the virtual screen to a file. Implements the bare minimum of functionality just to demonstrate how to start writing a platform plugin.

  • Other platform-specific plugins

    • android - Uses the Android APIs and is integrated into the Android environment.

    • windows - Uses the WINAPI and is integrated into the Windows windowing environment.

    • cocoa - Uses the Cocoa APIs and is integrated into the OS X windowing environment.

    • iOS - Uses the iOS toolkits and is integrated into the iOS environment.

    • qnx - Uses the QNX APIs and is integrated into the QNX photon windowing environment.



回答2:

I just replied in the TI forums to the same query. If eglfs is functional and linuxfb is not, please file a bug in JIRA with qt-project.org, as both eglfs and linuxfb in AM335x use the linux framebuffer. eglfs (when used with a widget application) uses dirty-rectangle approach with a fullscreen display. Also move to QML if possible when on Qt5.

PS: you can export QT_QPA_PLATFORM=eglfs (or linuxfb) on the target to avoid setting the platform everytime you invoke the application. (http://doc.qt.io/qt-5/embedded-linux.html)