qt-kiosk-browser icon indicating copy to clipboard operation
qt-kiosk-browser copied to clipboard

when visible qtvirtualkeyboard hogs cpu

Open christian523 opened this issue 1 year ago • 4 comments

Hi,

I migrated from qt5.15 to qt6.5 and am using latest qt-kiosk-browser. When I activate the qtvirtualkeyboard by touching an input field it is properly displayed but hogs the cpu(s) with 100% load and it takes 2-3s for every key to respond. When I hide qtvirtualkeyboard cpu load is back to normal.

This is how I start the executable:

#!/bin/bash

export XDG_CONFIG_HOME=/tmp/${UID}-runtime-dir export XDG_RUNTIME_DIR=/tmp/${UID}-runtime-dir export WS_CALUDEV_FILE=/etc/udev/rules.d/ws-calibrate.rules export QT_BEARER_POLL_TIMEOUT=200000000

if ! test -d "${XDG_RUNTIME_DIR}"; then mkdir -p "${XDG_RUNTIME_DIR}" chmod 0700 "${XDG_RUNTIME_DIR}" mkdir -p "${XDG_RUNTIME_DIR}/qtvirtualkeyboard" fi

export QT_QPA_EGLFS_INTEGRATION=eglfs_kms export QT_QPA_EGLFS_KMS_CONFIG="/etc/qt6/eglfs_kms_cfg.json" export QT_QPA_EGLFS_ALWAYS_SET_MODE="1"

export LANG=en_US.UTF-8

qt-kiosk-browser -platform eglfs /etc/qt-kiosk-browser.conf --no-sandbox --noerrdialogs --log-level=1 --disable-pinch

Everything was working fine in qt5.15.

Any idea what could cause the problem?

Br Chris

christian523 avatar Nov 06 '23 18:11 christian523

Hi,

I tried to reproduce the error here with Qt 6.5.3, but I couldn't replicate the problem you mentioned. Could you provide more information about your setup? Which platform are you trying to run this on? Does this issue occur on a specific website?

To assist further, it would be helpful to know:

  • Are there any specific steps or actions within your application that trigger this behavior?
  • Can you provide any additional details about your hardware and software environment?
  • Have you checked if this issue occurs with a minimal or default Qt Virtual Keyboard configuration, ruling out any customizations?
  • Are there any error messages or warnings in the logs when this problem occurs?
  • Are there any specific use cases or input scenarios where you observe this behavior more prominently?

arthursdo avatar Nov 07 '23 21:11 arthursdo

Hi Arthur,

My system is running on a AM5748 which contains a GPU. qt-kiosk-browser is working fine with under Yocto kirkstone with qt 5.15. The problem started with qt 6.5. The behaviour shows only while the Qt Virtual Keyboard is visible.

This is the qtbase config: qtbase -e |grep ^"PACKAGECONFIG=" PACKAGECONFIG=" accessibility dbus fontconfig glib gui harfbuzz icu jpeg libinput openssl png udev widgets xkbcommon zlib zstd kms gbm gles2 eglfs mtdev

Qt Virtual Keyboard configuration is default.

In task manager I see 20 threads (seems to be same as in in qt5) named qt-kiosk-browser -platform eglfs /etc/qt-kiosk-browser.conf --no-sandbox --noerrdialogs --log-level=1 --disable-pinch; all are idle when keyboard is invisible. When keyboard is visible, two of them go to 90% load (I have 2 cores). When I look at ftrace I see OSGRenderThread with a very high load..

Here a snippet of ftrace while keyboard is visible:

QSGRenderThread-6044 [001] d...2.. 8236.200650: sched_switch: prev_comm=QSGRenderThread prev_pid=6044 prev_prio=120 prev_state=R ==> next_comm=tTimer next_pid=1481 next_prio=45 tTimer-1481 [001] d...2.. 8236.200680: sched_switch: prev_comm=tTimer prev_pid=1481 prev_prio=45 prev_state=S ==> next_comm=QSGRenderThread next_pid=6044 next_prio=120 QSGRenderThread-6044 [001] d...2.. 8236.200858: sched_switch: prev_comm=QSGRenderThread prev_pid=6044 prev_prio=120 prev_state=R ==> next_comm=tTimer next_pid=1481 next_prio=45 tTimer-1481 [001] d...2.. 8236.200883: sched_switch: prev_comm=tTimer prev_pid=1481 prev_prio=45 prev_state=S ==> next_comm=QSGRenderThread next_pid=6044 next_prio=120 QSGRenderThread-6044 [001] d...2.. 8236.201066: sched_switch: prev_comm=QSGRenderThread prev_pid=6044 prev_prio=120 prev_state=R ==> next_comm=tTimer next_pid=1481 next_prio=45 tTimer-1481 [001] d...2.. 8236.201091: sched_switch: prev_comm=tTimer prev_pid=1481 prev_prio=45 prev_state=S ==> next_comm=QSGRenderThread next_pid=6044 next_prio=120 QSGRenderThread-6044 [001] d...2.. 8236.201274: sched_switch: prev_comm=QSGRenderThread prev_pid=6044 prev_prio=120 prev_state=R ==> next_comm=tTimer next_pid=1481 next_prio=45

So it seems that while the keyboard is visible, it's rendering at 100% all the time. As soon as I close it, load decreases again to ~0%

The GUI is written in Javascript (React framework) and is working properly.

I'm getting some error messages ("MESA LOADER" I had already with qt5.15, Address family not supported is new with qt6) and IMHO do not relate, timewise, to the visibility of the keyboard:

MESA-LOADER: failed to open omapdrm: /usr/lib/dri/omapdrm_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/dri, suffix _dri) failed to load driver: omapdrm MESA-LOADER: failed to open zink: /usr/lib/dri/zink_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/dri, suffix _dri) failed to load driver: zink qml: Loading configuration from 'file:/etc/qt-kiosk-browser.conf' [2592:2626:0126/193921.898610:ERROR:socket_posix.cc(93)] CreatePlatformSocket() failed: Address family not supported by protocol (97) [2592:2626:0126/193923.987611:ERROR:socket_posix.cc(93)] CreatePlatformSocket() failed: Address family not supported by protocol (97)

BR, Chris

christian523 avatar Nov 08 '23 08:11 christian523

It looks like the high CPU usage with the Qt Virtual Keyboard in Qt 6.5 might be due to Qt 6's lack of official support on TI processors (as per recent TI forum discussions).

I couldn't replicate the issue without TI hardware, but the problem likely lies in the Qt 6 and TI processor integration. Can you share your /etc/qt6/eglfs_kms_cfg.json? It might give us more clues.

For now, it seems this is a compatibility issue with Qt 6 on TI hardware.

arthursdo avatar Nov 10 '23 14:11 arthursdo

Hi Arthur, this is the file /etc/qt6/eglfs_kms_cfg.json

{ "device": "/dev/dri/card0", "hwcursor": false, "pbuffers": true }

christian523 avatar Nov 10 '23 15:11 christian523