diff options
author | Paul Olav Tvete <paul.tvete@nokia.com> | 2012-01-09 17:24:45 +0100 |
---|---|---|
committer | Jørgen Lind <jorgen.lind@nokia.com> | 2012-01-09 18:39:35 +0100 |
commit | d70a139911a3329bd2b4b443c2d6f9b954b528a2 (patch) | |
tree | f2cbe8affc07291f2ce9c943a840776e0d14492a /src/compositor/wayland_wrapper/wlsurface.cpp | |
parent | 748b894937769c84e942b237c058cf175d03aee5 (diff) |
Workaround for race condition when compositor is animating
If the compositor is animating, and rendering in another thread, we
may get a frameFinished call for a buffer that has not been displayed
yet. This buffer would then never get released, and the client would
hang. This is just a workaround: the real solution would fix the
race condition between markSurfaceAsDirty() and emit damaged().
Also fix misplaced paranthesis.
Change-Id: Iadecc77a6c6e3999a9f07815db0d0f810d92c1d3
Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Jørgen Lind <jorgen.lind@nokia.com>
Diffstat (limited to 'src/compositor/wayland_wrapper/wlsurface.cpp')
-rw-r--r-- | src/compositor/wayland_wrapper/wlsurface.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/compositor/wayland_wrapper/wlsurface.cpp b/src/compositor/wayland_wrapper/wlsurface.cpp index c23dc2150..86ae1e973 100644 --- a/src/compositor/wayland_wrapper/wlsurface.cpp +++ b/src/compositor/wayland_wrapper/wlsurface.cpp @@ -268,6 +268,11 @@ public: if (surfaceBuffer && surfaceBuffer->isPosted()) surfaceBuffer->destructBufferState(); + if (surfaceBuffer && !surfaceBuffer->isDisplayed()) { + qDebug() << "### not skipping undisplayed buffer"; + return; + } + surfaceBuffer = bufferQueue.takeFirst(); int width = 0; @@ -441,7 +446,7 @@ void Surface::damage(const QRect &rect) { Q_D(Surface); - if (!d->bufferQueue.isEmpty() && (!d->surfaceBuffer || d->surfaceBuffer->isFinished()) || !d->surfaceBuffer->handle() ) { + if (!d->bufferQueue.isEmpty() && (!d->surfaceBuffer || d->surfaceBuffer->isFinished() || !d->surfaceBuffer->handle())) { // Handle the "slow" case where we've finished the previous frame before the next damage comes. d->newCurrentBuffer(); d->doUpdate(rect); |