diff options
author | Jorgen Lind <jorgen.lind@digia.com> | 2013-11-25 10:49:02 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-12-27 21:39:45 +0100 |
commit | d747b0a3cac5e9a3d7c3f4f53bf9da3b88187698 (patch) | |
tree | 628ba8ead251324ba8eb52882c62c3b0726c9af2 /src/client/qwaylandintegration.cpp | |
parent | dcef544fb24f810b21fa38cc0e9e77f3a4f86ba8 (diff) |
Add hardware integration protocol
This sends to clients what HW integration is being used in the
compositor. This is useful when the wayland clients are loading their
buffer integrations with plugins since they then can pick the correct
plugin automatically.
Change-Id: Ib4eac3b855c6772ac1581b7f06aa929aeb1a1db0
Reviewed-by: Andy Nichols <andy.nichols@digia.com>
Diffstat (limited to 'src/client/qwaylandintegration.cpp')
-rw-r--r-- | src/client/qwaylandintegration.cpp | 44 |
1 files changed, 36 insertions, 8 deletions
diff --git a/src/client/qwaylandintegration.cpp b/src/client/qwaylandintegration.cpp index 70a09b2ed..9acda2107 100644 --- a/src/client/qwaylandintegration.cpp +++ b/src/client/qwaylandintegration.cpp @@ -65,6 +65,7 @@ #include <qpa/qplatformaccessibility.h> #include <qpa/qplatforminputcontext.h> +#include "qwaylandhardwareintegration.h" #include "qwaylandclientbufferintegration.h" #include "qwaylandclientbufferintegrationfactory.h" @@ -260,34 +261,61 @@ void QWaylandIntegration::initializeClientBufferIntegration() { mClientBufferIntegrationInitialized = true; - QByteArray clientBufferIntegrationName = qgetenv("QT_WAYLAND_CLIENT_BUFFER_INTEGRATION"); - if (clientBufferIntegrationName.isEmpty()) - clientBufferIntegrationName = QByteArrayLiteral("wayland-egl"); + QString targetKey; + bool disableHardwareIntegration = qEnvironmentVariableIsSet("QT_WAYLAND_DISABLE_HW_INTEGRATION"); + disableHardwareIntegration = disableHardwareIntegration || !mDisplay->hardwareIntegration(); + if (disableHardwareIntegration) { + QByteArray clientBufferIntegrationName = qgetenv("QT_WAYLAND_CLIENT_BUFFER_INTEGRATION"); + if (clientBufferIntegrationName.isEmpty()) + clientBufferIntegrationName = QByteArrayLiteral("wayland-egl"); + targetKey = QString::fromLocal8Bit(clientBufferIntegrationName); + } else { + targetKey = mDisplay->hardwareIntegration()->clientBufferIntegration(); + } + + if (targetKey.isEmpty()) { + qWarning("Failed to determin what client buffer integration to use"); + return; + } QStringList keys = QWaylandClientBufferIntegrationFactory::keys(); - QString targetKey = QString::fromLocal8Bit(clientBufferIntegrationName); if (keys.contains(targetKey)) { mClientBufferIntegration = QWaylandClientBufferIntegrationFactory::create(targetKey, QStringList()); } if (mClientBufferIntegration) mClientBufferIntegration->initialize(mDisplay); + else + qWarning("Failed to load client buffer intgration: %s\n", qPrintable(targetKey)); } void QWaylandIntegration::initializeServerBufferIntegration() { mServerBufferIntegrationInitialized = true; - QByteArray serverBufferIntegrationName = qgetenv("QT_WAYLAND_SERVER_BUFFER_INTEGRATION"); - if (serverBufferIntegrationName.isEmpty()) - serverBufferIntegrationName = QByteArrayLiteral("wayland-egl"); + QString targetKey; + + bool disableHardwareIntegration = qEnvironmentVariableIsSet("QT_WAYLAND_DISABLE_HW_INTEGRATION"); + disableHardwareIntegration = disableHardwareIntegration || !mDisplay->hardwareIntegration(); + if (disableHardwareIntegration) { + QByteArray serverBufferIntegrationName = qgetenv("QT_WAYLAND_SERVER_BUFFER_INTEGRATION"); + QString targetKey = QString::fromLocal8Bit(serverBufferIntegrationName); + } else { + targetKey = mDisplay->hardwareIntegration()->serverBufferIntegration(); + } + + if (targetKey.isEmpty()) { + qWarning("Failed to determin what server buffer integration to use"); + return; + } QStringList keys = QWaylandServerBufferIntegrationFactory::keys(); - QString targetKey = QString::fromLocal8Bit(serverBufferIntegrationName); if (keys.contains(targetKey)) { mServerBufferIntegration = QWaylandServerBufferIntegrationFactory::create(targetKey, QStringList()); } if (mServerBufferIntegration) mServerBufferIntegration->initialize(mDisplay); + else + qWarning("Failed to load server buffer integration %s\n", qPrintable(targetKey)); } QT_END_NAMESPACE |