diff options
author | Thomas Senyk <[email protected]> | 2024-09-04 11:22:06 -0400 |
---|---|---|
committer | Thomas Senyk <[email protected]> | 2025-07-02 12:46:27 +0200 |
commit | b85ec0a01f72b44d1e54e96632374fe33c6dbfaf (patch) | |
tree | 01df5c9e6645a2b8fc6cac9259d9f38a3ffe5466 /src/testlib/qtestelement.cpp | |
parent | 7fec2a2594de9dcfe019546cc8026bccabd12648 (diff) |
This patch extends eglfs/kms to react to events during runtime:
- screens/displays getting connected ("plug in")
as well as disconnected ("unplug")
This is only enabled when setting QT_QPA_EGLFS_HOTPLUG_ENABLED
- changes to the kms-config-file referenced by QT_QPA_EGLFS_KMS_CONFIG or QT_QPA_KMS_CONFIG
eglfs will now reevaluate the connected displays and the referenced
kms-config during runtime and react accordingly.
Features/functionality of hot-plug:
- QKmsDevice::checkConnectedScreens() (new function)
will be called by QDeviceDiscovery::deviceChanged (new signal),
which is fired by QDeviceDiscoveryUDev::handleUDevNotification
when "change"(formerly ignored) is the action driven/created by udev
- disconnected screens will be unregistered via
QKmsDevice::unregisterScreen
(new virtual function, this variant is empty).
The code lives in the two implementations of unregisterScreen:
QEglFSKmsGbmDevice::unregisterScreen will deal with global-cursor,
then call it's parent variant QEglFSKmsDevice::unregisterScreen
to call QWindowSystemInterface::handleScreenRemoved,
feeding the information about the lost screen into the event loop
- each newly connected display will be "configured" via
QKmsDevice::createScreenInfoForConnector (refactored function),
and then the platform class will be created via
QKmsDevice::createScreen
Features/functionality of hot-reload:
- refactor QKmsDevice::createScreenForConnector to
QKmsDevice::createScreenInfoForConnector, as the hot-reload requires
to update QPlatformScreens rather then creating new ones right away
- QFileSystemWatcher is added to QEglFSKmsGbmIntegration in
QEglFSKmsGbmIntegration::createDevice()
It will watch the file referenced by
QT_QPA_EGLFS_KMS_CONFIG or QT_QPA_KMS_CONFIG
When QFileSystemWatcher::fileChanged is fired,
two function will be called:
- KmsScreenConfig::refreshConfig(),
a new function which clears the old config and calls
QKmsScreenConfig::loadConfig()
- QKmsDevice::updateScreens(), a new function that goes over all
plugged-in and enabled screens, recreates their configuration via
QKmsDevice::createScreenInfoForConnector, updates them via
QKmsDevice/QEglFSKmsDevice::updateScreenOutput (new virtual),
and at the end will call QKmsDevice::registerScreens
(new function, see "shared changes" for details)
Shared changes / necessary refactoring:
- QKmsDevice::createScreens was refactored and split, where
QKmsDevice::registerScreens contains code regarding screen-cloning,
calling QKmsDevice::registerScreen (existing, pure virtual) and
calling QKmsDevice::updateScreen (new, virtual function with one
"proper" implementation in QEglFSKmsDevice::updateScreen)
- Adding code regarding creation and destruction of qt_headless
A replacement screen is needed when going to 0 displays,
as that is not supported by Qt.
This applies to all 3 cases: startup, hotplug and hotreload
(while for 'startup' it will only create a headless screen if
QT_QPA_EGLFS_HOTPLUG_ENABLED is set)
- added "headlessSize" to kms-config to allow the user to configure
the specific size of the headless "fake" screen
- default value for "headlessSize" is 1024x768 (used to be 0x0)
Those two changes are necessary/useful as headless
is an implicit feature in this case as the fallback
for when the last screen is disconnected.
(In contrast to explicit 'headless' option)
- a bunch of extra code regarding cloned screens,
because they can now be added and removed during runtime
(via screen-plug-in/out events as well as config changes)
- renaming m_nonThreadedFlipMutex to s_nonThreadedFlipMutex
as it's a static member
- fix virtualPos to allow for 0,0 to be a valid setting
(by having -1,-1 as 'is not set'-value)
- QKmsDevice::registerScreens will now check if the cursor is
outside the current desktopRegion. If it is, it will be
repositioned to be inside (it would vanish otherwise)
- adding wait-timout in waitForFlipWithEventReader
to account for the fact that cloned screens can be created
and added during the runtime.
Without a timeout it can happen that the clonee waits forever,
as the new clone can be added as a flip-dependency
while it isn't scheduled to wake the clonee's wait yet
Change-Id: I08421a1be156b6edb9906ef736cba149dab360ff
Reviewed-by: Laszlo Agocs <[email protected]>
Diffstat (limited to 'src/testlib/qtestelement.cpp')
0 files changed, 0 insertions, 0 deletions