High CPU usage in Wayland Arch Linux.
-
Hello everyone, I have a small issue that I need help with. When I set a fixed size for my Qt5 Python app, I notice higher CPU usage than usual, between 10% and 12%. However, if I don't fix the window size, the CPU usage is normal.
I tracked down the problem to the Qt platform on Wayland. If I switch to using xcb by setting the environment variable
QT_QPA_PLATFORM=xcb
, I don't face this issue.Here's a minimal example that causes the problem:
import sys from PyQt5.QtWidgets import QApplication, QWidget if __name__ == "__main__": app = QApplication(sys.argv) window = QWidget() window.setWindowTitle("High CPU usage in Wayland on Arch Linux") # Set the fixed size of the window window.setFixedSize(800, 600) # Width: 800, Height: 600 window.show() sys.exit(app.exec_())
If anyone has encountered this issue or knows a potential workaround, I would greatly appreciate your help.
Thank you!
-
Hi and welcome to devnet,
Do you experience the same issue with PySide6 ?
Which desktop environment are you using ?
Which version of Wayland ? -
Hey and thank you,
Yes i tried the same program with PySide6 and had the same issue and it gets fixed when I change the Qt platform from Wayland to XCB.
For the desktop environment I am on Hyperland and I am using the 1.22.0-1 version of Wayland.
Hope that helps.