diff options
author | Jorgen Lind <jorgen.lind@digia.com> | 2014-03-10 09:25:04 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-03-11 15:35:08 +0100 |
commit | 6b173d993542e2aed01b5a97d3e0fb64940ad432 (patch) | |
tree | d9a3e3376917b9fa21c64d6a325e57fb5c8e0b22 | |
parent | a9d9fa463cd6b915fd4fda7e06317b5299c893e7 (diff) | |
download | qtwayland-6b173d993542e2aed01b5a97d3e0fb64940ad432.tar.gz qtwayland-6b173d993542e2aed01b5a97d3e0fb64940ad432.tar.bz2 qtwayland-6b173d993542e2aed01b5a97d3e0fb64940ad432.zip |
Fixup for GLX integration
Change-Id: I2de94481f7d3e109fdce7ca961f8969299cf5d9e
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
13 files changed, 34 insertions, 24 deletions
diff --git a/src/client/hardwareintegration/qwaylandclientbufferintegration_p.h b/src/client/hardwareintegration/qwaylandclientbufferintegration_p.h index 153b3f59..7d79f326 100644 --- a/src/client/hardwareintegration/qwaylandclientbufferintegration_p.h +++ b/src/client/hardwareintegration/qwaylandclientbufferintegration_p.h @@ -61,7 +61,6 @@ public: virtual ~QWaylandClientBufferIntegration(); virtual void initialize(QWaylandDisplay *display) = 0; - virtual bool waitingForEvents() { return false; } virtual bool supportsThreadedOpenGL() const { return false; } diff --git a/src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglclientbufferintegration.cpp b/src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglclientbufferintegration.cpp index 12ab0a47..c26ebd6a 100644 --- a/src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglclientbufferintegration.cpp +++ b/src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglclientbufferintegration.cpp @@ -52,6 +52,7 @@ QT_BEGIN_NAMESPACE QWaylandXCompositeEGLClientBufferIntegration::QWaylandXCompositeEGLClientBufferIntegration() : QWaylandClientBufferIntegration() , mWaylandDisplay(0) + , mDisplay(0) { qDebug() << "Using XComposite-EGL"; } @@ -65,6 +66,10 @@ void QWaylandXCompositeEGLClientBufferIntegration::initialize(QWaylandDisplay *d { mWaylandDisplay = display; mWaylandDisplay->addRegistryListener(&wlDisplayHandleGlobal, this); + while (!mDisplay) { + display->flushRequests(); + display->blockingReadEvents(); + } } QWaylandWindow * QWaylandXCompositeEGLClientBufferIntegration::createEglWindow(QWindow *window) diff --git a/src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglclientbufferintegration.h b/src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglclientbufferintegration.h index 9cf19e1c..cce0e91b 100644 --- a/src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglclientbufferintegration.h +++ b/src/hardwareintegration/client/xcomposite-egl/qwaylandxcompositeeglclientbufferintegration.h @@ -75,7 +75,6 @@ public: ~QWaylandXCompositeEGLClientBufferIntegration(); void initialize(QWaylandDisplay *dispaly) Q_DECL_OVERRIDE; - bool waitingForEvents() Q_DECL_OVERRIDE { return !mDisplay; } QWaylandWindow *createEglWindow(QWindow *window) Q_DECL_OVERRIDE; QPlatformOpenGLContext *createPlatformOpenGLContext(const QSurfaceFormat &glFormat, QPlatformOpenGLContext *share) const Q_DECL_OVERRIDE; diff --git a/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxintegration.cpp b/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxintegration.cpp index b2c0dd5d..f08f8dcb 100644 --- a/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxintegration.cpp +++ b/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxintegration.cpp @@ -68,6 +68,10 @@ void QWaylandXCompositeGLXIntegration::initialize(QWaylandDisplay *display) { mWaylandDisplay = display; mWaylandDisplay->addRegistryListener(QWaylandXCompositeGLXIntegration::wlDisplayHandleGlobal, this); + while (!mDisplay) { + display->flushRequests(); + display->blockingReadEvents(); + } } QWaylandWindow * QWaylandXCompositeGLXIntegration::createEglWindow(QWindow *window) diff --git a/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxintegration.h b/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxintegration.h index 17462915..1751f775 100644 --- a/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxintegration.h +++ b/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxintegration.h @@ -69,11 +69,10 @@ public: QWaylandXCompositeGLXIntegration(); ~QWaylandXCompositeGLXIntegration(); - void initialize(QWaylandDisplay *display); - bool waitingForEvents() { return !mDisplay; } + void initialize(QWaylandDisplay *display) Q_DECL_OVERRIDE; - QWaylandWindow *createEglWindow(QWindow *window); - QPlatformOpenGLContext *createPlatformOpenGLContext(const QSurfaceFormat &glFormat, QPlatformOpenGLContext *share) const; + QWaylandWindow *createEglWindow(QWindow *window) Q_DECL_OVERRIDE; + QPlatformOpenGLContext *createPlatformOpenGLContext(const QSurfaceFormat &glFormat, QPlatformOpenGLContext *share) const Q_DECL_OVERRIDE; QWaylandDisplay *waylandDisplay() const; struct qt_xcomposite *waylandXComposite() const; diff --git a/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxwindow.cpp b/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxwindow.cpp index f33790f3..899ed764 100644 --- a/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxwindow.cpp +++ b/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxwindow.cpp @@ -56,7 +56,6 @@ QWaylandXCompositeGLXWindow::QWaylandXCompositeGLXWindow(QWindow *window, QWayla , m_glxIntegration(glxIntegration) , m_xWindow(0) , m_config(qglx_findConfig(glxIntegration->xDisplay(), glxIntegration->screen(), window->format(), GLX_WINDOW_BIT | GLX_PIXMAP_BIT)) - , m_buffer(0) { } @@ -71,8 +70,6 @@ void QWaylandXCompositeGLXWindow::setGeometry(const QRect &rect) QWaylandWindow::setGeometry(rect); if (m_xWindow) { - delete m_buffer; - XDestroyWindow(m_glxIntegration->xDisplay(), m_xWindow); m_xWindow = 0; } @@ -115,7 +112,7 @@ void QWaylandXCompositeGLXWindow::createSurface() XMapWindow(m_glxIntegration->xDisplay(), m_xWindow); XSync(m_glxIntegration->xDisplay(), False); - m_buffer = new QWaylandXCompositeBuffer(m_glxIntegration->waylandXComposite(), + mBuffer = new QWaylandXCompositeBuffer(m_glxIntegration->waylandXComposite(), (uint32_t)m_xWindow, size); } diff --git a/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxwindow.h b/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxwindow.h index 9866ad03..6fe99466 100644 --- a/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxwindow.h +++ b/src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxwindow.h @@ -62,7 +62,7 @@ public: Window xWindow() const; - QWaylandBuffer *buffer() { return m_buffer; } + QWaylandBuffer *buffer() { return mBuffer; } private: void createSurface(); @@ -71,8 +71,6 @@ private: Window m_xWindow; GLXFBConfig m_config; - - QWaylandBuffer *m_buffer; }; QT_END_NAMESPACE diff --git a/src/hardwareintegration/compositor/xcomposite-glx/xcompositeglxintegration.cpp b/src/hardwareintegration/compositor/xcomposite-glx/xcompositeglxintegration.cpp index dce1fdc3..bd5ddef9 100644 --- a/src/hardwareintegration/compositor/xcomposite-glx/xcompositeglxintegration.cpp +++ b/src/hardwareintegration/compositor/xcomposite-glx/xcompositeglxintegration.cpp @@ -76,6 +76,7 @@ XCompositeGLXClientBufferIntegration::XCompositeGLXClientBufferIntegration() , mDisplay(0) , mHandler(0) { + qDebug() << "Loading GLX integration"; } XCompositeGLXClientBufferIntegration::~XCompositeGLXClientBufferIntegration() @@ -85,6 +86,7 @@ XCompositeGLXClientBufferIntegration::~XCompositeGLXClientBufferIntegration() void XCompositeGLXClientBufferIntegration::initializeHardware(QtWayland::Display *) { + qDebug() << "Initializing GLX integration"; QPlatformNativeInterface *nativeInterface = QGuiApplicationPrivate::platformIntegration()->nativeInterface(); if (nativeInterface) { mDisplay = static_cast<Display *>(nativeInterface->nativeResourceForWindow("Display",m_compositor->window())); @@ -112,7 +114,7 @@ void XCompositeGLXClientBufferIntegration::initializeHardware(QtWayland::Display delete glContext; } -void XCompositeGLXClientBufferIntegration::updateTextureFromBuffer(struct ::wl_resource *buffer) +void XCompositeGLXClientBufferIntegration::bindTextureToBuffer(struct ::wl_resource *buffer) { XCompositeBuffer *compositorBuffer = XCompositeBuffer::fromResource(buffer); Pixmap pixmap = XCompositeNameWindowPixmap(mDisplay, compositorBuffer->window()); diff --git a/src/plugins/hardwareintegration/client/xcomposite-glx/main.cpp b/src/plugins/hardwareintegration/client/xcomposite-glx/main.cpp index f53caf03..2d402194 100644 --- a/src/plugins/hardwareintegration/client/xcomposite-glx/main.cpp +++ b/src/plugins/hardwareintegration/client/xcomposite-glx/main.cpp @@ -56,14 +56,14 @@ public: QStringList QWaylandXCompositeGlxClientBufferIntegrationPlugin::keys() const { QStringList list; - list << "xcomposite-glx"; + list << "wayland-xcomposite-glx"; return list; } QWaylandClientBufferIntegration *QWaylandXCompositeGlxClientBufferIntegrationPlugin::create(const QString& system, const QStringList& paramList) { Q_UNUSED(paramList); - if (system.toLower() == "xcomposite-glx") + if (system.toLower() == "wayland-xcomposite-glx") return new QWaylandXCompositeGLXIntegration(); return 0; diff --git a/src/plugins/hardwareintegration/compositor/xcomposite-glx/xcomposite-glx.json b/src/plugins/hardwareintegration/compositor/xcomposite-glx/xcomposite-glx.json index 8ccd5b46..0f4a3bf6 100644 --- a/src/plugins/hardwareintegration/compositor/xcomposite-glx/xcomposite-glx.json +++ b/src/plugins/hardwareintegration/compositor/xcomposite-glx/xcomposite-glx.json @@ -1,3 +1,3 @@ { - "Keys": [ "wayland-xcomposite" ] + "Keys": [ "wayland-xcomposite-glx" ] } diff --git a/src/plugins/platforms/qwayland-xcomposite-glx/main.cpp b/src/plugins/platforms/qwayland-xcomposite-glx/main.cpp index 17b20f98..2f43b467 100644 --- a/src/plugins/platforms/qwayland-xcomposite-glx/main.cpp +++ b/src/plugins/platforms/qwayland-xcomposite-glx/main.cpp @@ -40,7 +40,9 @@ ****************************************************************************/ #include <qpa/qplatformintegrationplugin.h> -#include "qwaylandintegration.h" +#include <QtWaylandClient/private/qwaylandintegration_p.h> + +#include "qwaylandxcompositeglxplatformintegration.h" QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/qwayland-xcomposite-glx/qwayland-xcomposite-glx.pro b/src/plugins/platforms/qwayland-xcomposite-glx/qwayland-xcomposite-glx.pro index dcf2e1b6..307ad5ed 100644 --- a/src/plugins/platforms/qwayland-xcomposite-glx/qwayland-xcomposite-glx.pro +++ b/src/plugins/platforms/qwayland-xcomposite-glx/qwayland-xcomposite-glx.pro @@ -10,3 +10,5 @@ OTHER_FILES += qwayland-xcomposite-glx.json SOURCES += \ main.cpp +HEADERS += \ + qwaylandxcompositeglxplatformintegration.h diff --git a/src/plugins/platforms/qwayland-xcomposite-glx/qwaylandxcompositeglxplatformintegration.h b/src/plugins/platforms/qwayland-xcomposite-glx/qwaylandxcompositeglxplatformintegration.h index fe8c5b7c..a7308f64 100644 --- a/src/plugins/platforms/qwayland-xcomposite-glx/qwaylandxcompositeglxplatformintegration.h +++ b/src/plugins/platforms/qwayland-xcomposite-glx/qwaylandxcompositeglxplatformintegration.h @@ -42,7 +42,8 @@ #ifndef QWAYLANDXCOMPOSITEGLXPLATFORMINTEGRATION_H #define QWAYLANDXCOMPOSITEGLXPLATFORMINTEGRATION_H -#include <QtWaylandClient/qwaylandintegration.h> +#include <QtWaylandClient/private/qwaylandintegration_p.h> +#include <QtWaylandClient/private/qwaylanddisplay_p.h> #include "qwaylandxcompositeglxintegration.h" @@ -51,14 +52,16 @@ class QWaylandXCompositeGlxPlatformIntegration : public QWaylandIntegration public: QWaylandXCompositeGlxPlatformIntegration() : QWaylandIntegration() - , m_gl_integration(new QWaylandXCompositeGLXIntegration(display())) - { } + , m_client_buffer_integration(new QWaylandXCompositeGLXIntegration()) + { + m_client_buffer_integration->initialize(display()); + } - QWaylandGLIntegration *glIntegration() const Q_DECL_OVERRIDE - { return m_gl_integration; } + QWaylandClientBufferIntegration *clientBufferIntegration() const Q_DECL_OVERRIDE + { return m_client_buffer_integration; } private: - QWaylandGLIntegration *m_gl_integration; + QWaylandClientBufferIntegration *m_client_buffer_integration; }; #endif |