diff options
author | Paul Olav Tvete <paul.tvete@nokia.com> | 2011-03-14 15:55:19 (GMT) |
---|---|---|
committer | Paul Olav Tvete <paul.tvete@nokia.com> | 2011-03-14 15:55:19 (GMT) |
commit | 369ad09515fc8dac87613930114f4b3cf6381e81 (patch) | |
tree | 9c623f2c9a7e4863f0a18cb0b53114644cfff24b /src | |
parent | 48ebe36a8b5d101c5dcad26d88d6fc0504fc9319 (diff) | |
download | Qt-369ad09515fc8dac87613930114f4b3cf6381e81.zip Qt-369ad09515fc8dac87613930114f4b3cf6381e81.tar.gz Qt-369ad09515fc8dac87613930114f4b3cf6381e81.tar.bz2 |
Fix race condition in the non-GL case
Make sure to also flush output when waiting for an ack from the
compositor, in case we haven't sent the frame request yet.
Reviewed-by: Jørgen
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/platforms/wayland/qwaylanddisplay.cpp | 11 | ||||
-rw-r--r-- | src/plugins/platforms/wayland/qwaylanddisplay.h | 4 | ||||
-rw-r--r-- | src/plugins/platforms/wayland/qwaylandshmsurface.cpp | 2 |
3 files changed, 12 insertions, 5 deletions
diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index d0a0725..27f4334 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -141,7 +141,12 @@ void QWaylandDisplay::displayHandleGlobal(struct wl_display *display, } } -void QWaylandDisplay::eventDispatcher(void) +void QWaylandDisplay::iterate() +{ + wl_display_iterate(mDisplay, WL_DISPLAY_READABLE | WL_DISPLAY_WRITABLE); +} + +void QWaylandDisplay::readEvents(void) { wl_display_iterate(mDisplay, WL_DISPLAY_READABLE); } @@ -189,7 +194,7 @@ QWaylandDisplay::QWaylandDisplay(void) mNativeEglDisplay = 0; #endif - eventDispatcher(); + readEvents(); #ifdef QT_WAYLAND_GL_SUPPORT mEglDisplay = eglGetDisplay((EGLNativeDisplayType)mNativeEglDisplay); @@ -208,7 +213,7 @@ QWaylandDisplay::QWaylandDisplay(void) int fd = wl_display_get_fd(mDisplay, sourceUpdate, this); mReadNotifier = new QSocketNotifier(fd, QSocketNotifier::Read, this); connect(mReadNotifier, - SIGNAL(activated(int)), this, SLOT(eventDispatcher())); + SIGNAL(activated(int)), this, SLOT(readEvents())); mWriteNotifier = new QSocketNotifier(fd, QSocketNotifier::Write, this); connect(mWriteNotifier, diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.h b/src/plugins/platforms/wayland/qwaylanddisplay.h index ca31756..d994ffe 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay.h @@ -81,8 +81,10 @@ public: void syncCallback(wl_display_sync_func_t func, void *data); void frameCallback(wl_display_frame_func_t func, void *data); + void iterate(); + public slots: - void eventDispatcher(void); + void readEvents(void); void flushRequests(void); private: diff --git a/src/plugins/platforms/wayland/qwaylandshmsurface.cpp b/src/plugins/platforms/wayland/qwaylandshmsurface.cpp index b1cba71..6872bac 100644 --- a/src/plugins/platforms/wayland/qwaylandshmsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmsurface.cpp @@ -111,7 +111,7 @@ QPaintDevice *QWaylandShmWindowSurface::paintDevice() void QWaylandShmWindowSurface::beginPaint(const QRegion &) { while (mWaitingForFrameSync) { - mDisplay->eventDispatcher(); + mDisplay->iterate(); } } |