summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndy Nichols <andy.nichols@nokia.com>2012-02-09 19:08:30 +0100
committerJørgen Lind <jorgen.lind@nokia.com>2012-02-10 14:08:50 +0100
commit0a25184b9af19786d8d20c520f93ee0bfc65355f (patch)
tree79a8a68724b8d47690de583e4d06b75eb7f8c16b /src
parent39aacb4dd11b6745a32d4404cee207c047177b07 (diff)
Remove hack that causes deadlock when waiting in eglSwapBuffers
This hack was added to work around the problem of calling wl_display_iterate in two separate threads, but now that we are are enforceing that wl_display_iterate can only be called in one thread it now causes a deadlock when we are waiting in eglSwapBuffers for the gui thread to actually call wl_display_iterate. Change-Id: Id3153b184c191494838fc363380f7cae621ac64e Reviewed-by: Jørgen Lind <jorgen.lind@nokia.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandglcontext.cpp6
-rw-r--r--src/plugins/platforms/wayland/qwaylanddisplay.cpp50
2 files changed, 20 insertions, 36 deletions
diff --git a/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandglcontext.cpp b/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandglcontext.cpp
index f2671ae2f..e0af14ae5 100644
--- a/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandglcontext.cpp
+++ b/src/plugins/platforms/wayland/gl_integration/wayland_egl/qwaylandglcontext.cpp
@@ -49,7 +49,6 @@
#include <QtGui/QPlatformOpenGLContext>
#include <QtGui/QSurfaceFormat>
-#include <QtCore/QMutex>
QWaylandGLContext::QWaylandGLContext(EGLDisplay eglDisplay, const QSurfaceFormat &format, QPlatformOpenGLContext *share)
: QPlatformOpenGLContext()
@@ -85,13 +84,8 @@ void QWaylandGLContext::doneCurrent()
eglMakeCurrent(m_eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
}
-// lock to sync with QWaylandDisplay event loop ( defined in qwaylanddisplay.cpp )
-extern QMutex g_waylandLock;
-
void QWaylandGLContext::swapBuffers(QPlatformSurface *surface)
{
- QMutexLocker l(&g_waylandLock);
-
EGLSurface eglSurface = static_cast<QWaylandEglWindow *>(surface)->eglSurface();
eglSwapBuffers(m_eglDisplay, eglSurface);
}
diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp
index b1b1d3357..bf21e0b46 100644
--- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp
+++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp
@@ -70,11 +70,6 @@
#include <stdio.h>
#include <errno.h>
-#include <QMutex>
-
-// lock used to syncronize swap-buffers with the display-event-loop
-QMutex g_waylandLock;
-
#include <QtCore/QDebug>
struct wl_surface *QWaylandDisplay::createSurface(void *handle)
@@ -184,32 +179,27 @@ void QWaylandDisplay::flushRequests()
void QWaylandDisplay::readEvents()
{
- if (g_waylandLock.tryLock())
- {
- fd_set fds;
- FD_ZERO(&fds);
- FD_SET(mFd, &fds);
-
- fd_set nds;
- FD_ZERO(&nds);
- fd_set rs = fds;
- fd_set ws = nds;
- fd_set es = nds;
- timeval timeout;
-
- timeout.tv_sec = 0;
- timeout.tv_usec = 0;
-
- int ret = ::select(mFd+1, &rs, &ws, &es, &timeout );
-
- if (ret <= 0) {
- g_waylandLock.unlock();
- return;
- }
-
- wl_display_iterate(mDisplay, WL_DISPLAY_READABLE);
- g_waylandLock.unlock();
+ fd_set fds;
+ FD_ZERO(&fds);
+ FD_SET(mFd, &fds);
+
+ fd_set nds;
+ FD_ZERO(&nds);
+ fd_set rs = fds;
+ fd_set ws = nds;
+ fd_set es = nds;
+ timeval timeout;
+
+ timeout.tv_sec = 0;
+ timeout.tv_usec = 0;
+
+ int ret = ::select(mFd+1, &rs, &ws, &es, &timeout );
+
+ if (ret <= 0) {
+ return;
}
+
+ wl_display_iterate(mDisplay, WL_DISPLAY_READABLE);
}
void QWaylandDisplay::blockingReadEvents()