QGuiApplication GUI Begins to Lag on Raspberry Pi 3 When No Input Events
I have a strange issue with my QT GUI application when run on the official raspberry pi touchscreen LCD.
The GUI itself is quite simple, only containing a couple of images and text boxes. A string is updated every 100ms with the current date and time (to the second) and occasionally warning messages appear which flash (swap colour pallet) at a period of 0.5s. A counter is also displayed showing the length of time (to the second) that the warning has been active. Nothing intensive at all. The program does however have a back end that connects it to a controlling server, the socket is kept alive for the entire lifetime of the application.
The GUI responds completely as expected when the application is run for a short duration however, if left running for any more than a few minutes some noticeable lag begins to appear. The rate at which the warning messages 'flash' and their corresponding counters update slows down to a crawl and stops altogether sometimes. This can be immediately fixed however by simply causing a system interrupt to occur, like touching the touchscreen or moving the mouse. When this happens the warning messages will straight away update as normal and the date time string will 'jump' between a few seconds before settling in on a time a few seconds later than what was originally displayed (leading me to believe that the clock too is slowing down).
This occurs regardless of whether my back-end server handling code runs, ruling that out as a cause. However, this issue doesn't occur when the application is displayed through HDMI, only the LCD display. I've tried running with the EGLFS platform which actually makes things worse, the GUI freezes after a while. To be honest I am still very much a newbie when it comes to QT and Raspberry Pi development so I have no idea if this could be caused by my QT source code being written poorly or if the Pi and display is set-up incorrectly. I've been googling for hours and can't seem to find any related posts. Any advice on where might be a good place to start would be greatly appreciated.
Hi and welcome to devnet,
Do you also observe that issue with other application ?
Are you cross-compiling Qt and your application ?
What version of Qt are you using ?
What Linux distribution do you run ?
Note that it might also be a driver issue since you only observe that on the LCD display.
Thank you for the reply.
No I don't see the issue with any other applications although this is the only one I've written with a GUI.
I am not cross compiling. All of the source code is compiled with QT on Linux using GCC.
I am using QT Creator version 4.2.0 - based on QT 5.7.1 GCC version 6.2.1 32 bit
The Linux distribution is 4.14.79-v7+ armv71 with the Raspbian OS.
My initial thought was driver issues. Although would you not also expect to see problems with the inbuilt applications as well if that were the case?
Self-built Qt or the one provided by Raspbian ?
Do you also have that issue with a unmodified default application ?
I've managed to figure out the issue.
It turns out that I needed to disable power management signalling (dpms). I added the following lines to my /home/pi/.config/lxsession/LXDE-pi/autostart file -
@xset s off
@xset s noblank
The GUI now remains fully responsive even after a full day of running.
Thank you for your time @SGaist