summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel van Vugt <daniel.van.vugt@canonical.com>2015-07-28 16:43:13 +0800
committerDaniel van Vugt <daniel.van.vugt@canonical.com>2015-07-28 16:43:13 +0800
commit43443ddd7ebe4417fd2b033b7aea27de298f27db (patch)
treeffe6973d780f5a44b23924c45c159f12d47a0ef6
parent5435c2d8e18affc57d03d0742029edadba6f48fa (diff)
The working fix, fresh off the phone.
-rw-r--r--src/modules/Unity/Application/mirsurfaceitem.cpp11
-rw-r--r--src/modules/Unity/Application/mirsurfaceitem.h2
2 files changed, 7 insertions, 6 deletions
diff --git a/src/modules/Unity/Application/mirsurfaceitem.cpp b/src/modules/Unity/Application/mirsurfaceitem.cpp
index 37337a4..9f07dc3 100644
--- a/src/modules/Unity/Application/mirsurfaceitem.cpp
+++ b/src/modules/Unity/Application/mirsurfaceitem.cpp
@@ -233,7 +233,7 @@ MirSurfaceItem::MirSurfaceItem(std::shared_ptr<mir::scene::Surface> surface,
QQmlEngine::setObjectOwnership(this, QQmlEngine::CppOwnership);
connect(&m_frameDropperTimer, &QTimer::timeout,
- this, &MirSurfaceItem::dropPendingBuffers);
+ this, &MirSurfaceItem::dropPendingBuffer);
// Rationale behind the frame dropper and its interval value:
//
// We want to give ample room for Qt scene graph to have a chance to fetch and render
@@ -735,22 +735,23 @@ void MirSurfaceItem::updateMirSurfaceFocus(bool focused)
}
}
-void MirSurfaceItem::dropPendingBuffers()
+void MirSurfaceItem::dropPendingBuffer()
{
QMutexLocker locker(&m_mutex);
const void* const userId = (void*)123; // TODO: Multimonitor support
- while (m_surface->buffers_ready_for_compositor(userId) > 0) {
+ int framesPending = m_surface->buffers_ready_for_compositor(userId);
+ if (framesPending > 0) {
// The line below looks like an innocent, effect-less, getter. But as this
// method returns a unique_pointer, not holding its reference causes the
// buffer to be destroyed/released straight away.
for (auto const & item : m_surface->generate_renderables(userId))
item->buffer();
- qCDebug(QTMIR_SURFACES) << "MirSurfaceItem::dropPendingBuffers()"
+ qCDebug(QTMIR_SURFACES) << "MirSurfaceItem::dropPendingBuffer()"
<< "surface =" << this
<< "buffer dropped."
- << m_surface->buffers_ready_for_compositor(userId)
+ << framesPending-1
<< "left.";
}
}
diff --git a/src/modules/Unity/Application/mirsurfaceitem.h b/src/modules/Unity/Application/mirsurfaceitem.h
index fd3ab45..e1e168f 100644
--- a/src/modules/Unity/Application/mirsurfaceitem.h
+++ b/src/modules/Unity/Application/mirsurfaceitem.h
@@ -154,7 +154,7 @@ protected:
private Q_SLOTS:
void surfaceDamaged();
- void dropPendingBuffers();
+ void dropPendingBuffer();
void scheduleTextureUpdate();
void scheduleMirSurfaceSizeUpdate();