summaryrefslogtreecommitdiffstats
path: root/src/hardwareintegration
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@digia.com>2014-08-22 12:41:42 +0200
committerLaszlo Agocs <laszlo.agocs@digia.com>2014-08-25 11:50:32 +0200
commitb743fc7a1e6ee680ca89ae17fb6b521178fd09a9 (patch)
tree7f382058a662094671a65bf56b124d2807e707f6 /src/hardwareintegration
parentb98218587757699a2b17cee724b81ca8ea6b402d (diff)
Support RasterGLSurface windows
In an attempt to make QOpenGLWidget and QQuickWidget working on Wayland. Since Qt 5.3 all widget windows are of type RasterGLSurface (given that the plugin reports this capability which wayland will, with this patch). Such a window can behave either like a raster or an OpenGL window. This concept maps badly to platform plugins that have a rigid separation between raster and OpenGL platform window implementations. From now on, the OpenGL window implementation, that is used pretty much always, except for raw RasterSurface windows, must be prepared to behave like a raster window too, which involves having a backingstore. Change-Id: I0226704b8d5893843fcae68059c5fe9ad2f5e761 Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
Diffstat (limited to 'src/hardwareintegration')
-rw-r--r--src/hardwareintegration/client/wayland-egl/qwaylandeglclientbufferintegration.cpp20
-rw-r--r--src/hardwareintegration/client/wayland-egl/qwaylandeglclientbufferintegration.h1
-rw-r--r--src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp10
3 files changed, 22 insertions, 9 deletions
diff --git a/src/hardwareintegration/client/wayland-egl/qwaylandeglclientbufferintegration.cpp b/src/hardwareintegration/client/wayland-egl/qwaylandeglclientbufferintegration.cpp
index 68d38c498..b0edc175c 100644
--- a/src/hardwareintegration/client/wayland-egl/qwaylandeglclientbufferintegration.cpp
+++ b/src/hardwareintegration/client/wayland-egl/qwaylandeglclientbufferintegration.cpp
@@ -57,6 +57,7 @@ static const char *qwaylandegl_threadedgl_blacklist_vendor[] = {
QWaylandEglClientBufferIntegration::QWaylandEglClientBufferIntegration()
: m_waylandDisplay(0)
+ , m_eglDisplay(EGL_NO_DISPLAY)
, m_supportsThreading(false)
{
qDebug() << "Using Wayland-EGL";
@@ -79,13 +80,15 @@ void QWaylandEglClientBufferIntegration::initialize(QWaylandDisplay *display)
EGLint major,minor;
m_eglDisplay = eglGetDisplay((EGLNativeDisplayType) m_waylandDisplay);
- if (m_eglDisplay == NULL) {
+ if (m_eglDisplay == EGL_NO_DISPLAY) {
qWarning("EGL not available");
- } else {
- if (!eglInitialize(m_eglDisplay, &major, &minor)) {
- qWarning("failed to initialize EGL display");
- return;
- }
+ return;
+ }
+
+ if (!eglInitialize(m_eglDisplay, &major, &minor)) {
+ qWarning("failed to initialize EGL display");
+ m_eglDisplay = EGL_NO_DISPLAY;
+ return;
}
m_supportsThreading = true;
@@ -101,6 +104,11 @@ void QWaylandEglClientBufferIntegration::initialize(QWaylandDisplay *display)
}
}
+bool QWaylandEglClientBufferIntegration::isValid() const
+{
+ return m_eglDisplay != EGL_NO_DISPLAY;
+}
+
bool QWaylandEglClientBufferIntegration::supportsThreadedOpenGL() const
{
return m_supportsThreading;
diff --git a/src/hardwareintegration/client/wayland-egl/qwaylandeglclientbufferintegration.h b/src/hardwareintegration/client/wayland-egl/qwaylandeglclientbufferintegration.h
index 0c7d76cb9..7f2e28b88 100644
--- a/src/hardwareintegration/client/wayland-egl/qwaylandeglclientbufferintegration.h
+++ b/src/hardwareintegration/client/wayland-egl/qwaylandeglclientbufferintegration.h
@@ -58,6 +58,7 @@ public:
~QWaylandEglClientBufferIntegration();
void initialize(QWaylandDisplay *display) Q_DECL_OVERRIDE;
+ bool isValid() const Q_DECL_OVERRIDE;
bool supportsThreadedOpenGL() const Q_DECL_OVERRIDE;
QWaylandWindow *createEglWindow(QWindow *window) Q_DECL_OVERRIDE;
diff --git a/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp b/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp
index 527ac868b..a9247d4a1 100644
--- a/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp
+++ b/src/hardwareintegration/client/wayland-egl/qwaylandeglwindow.cpp
@@ -64,7 +64,10 @@ QWaylandEglWindow::QWaylandEglWindow(QWindow *window)
, m_resize(false)
, m_format(q_glFormatFromConfig(m_clientBufferIntegration->eglDisplay(), m_eglConfig))
{
- updateSurface(true);
+ // Do not create anything from here. This platform window may belong to a
+ // RasterGLSurface window which may have pure raster content. In this case, where the
+ // window is never actually made current, creating a wl_egl_window and EGL surface
+ // should be avoided.
}
QWaylandEglWindow::~QWaylandEglWindow()
@@ -74,7 +77,8 @@ QWaylandEglWindow::~QWaylandEglWindow()
m_eglSurface = 0;
}
- wl_egl_window_destroy(m_waylandEglWindow);
+ if (m_waylandEglWindow)
+ wl_egl_window_destroy(m_waylandEglWindow);
delete m_contentFBO;
}
@@ -125,7 +129,7 @@ void QWaylandEglWindow::updateSurface(bool create)
m_resize = true;
}
- } else {
+ } else if (create) {
m_waylandEglWindow = wl_egl_window_create(object(), sizeWithMargins.width(), sizeWithMargins.height());
}