summaryrefslogtreecommitdiffstats
path: root/src/compositor
diff options
context:
space:
mode:
authorAndy Nichols <andy.nichols@nokia.com>2012-05-02 15:30:06 +0200
committerAndy Nichols <andy.nichols@nokia.com>2012-05-18 13:48:21 +0200
commitb55620a74ed21f0ef497deeaad9f011078b5ce39 (patch)
treed4458d953a31ecfe2872115cd01a5db0f3a1e1dd /src/compositor
parentc1ee015bab06e82bccbb723b522c185a8188cab5 (diff)
Fix case where we get a new damage event too soon
As in when we get a damage event between when updatePaintNode calls updateTexture, and WaylandSurfaceNode::preprocess is called. Change-Id: Ib953ea6ff6c5e1c0239b734940dcf6fc39d3bb27 Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
Diffstat (limited to 'src/compositor')
-rw-r--r--src/compositor/compositor_api/waylandsurfaceitem.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/compositor/compositor_api/waylandsurfaceitem.cpp b/src/compositor/compositor_api/waylandsurfaceitem.cpp
index 6316bcabd..71bfd6196 100644
--- a/src/compositor/compositor_api/waylandsurfaceitem.cpp
+++ b/src/compositor/compositor_api/waylandsurfaceitem.cpp
@@ -60,7 +60,9 @@
class WaylandSurfaceNode : public QSGSimpleTextureNode
{
public:
- WaylandSurfaceNode(WaylandSurfaceItem *item) : m_item(item) {
+ WaylandSurfaceNode(WaylandSurfaceItem *item)
+ : m_item(item), m_textureUpdated(false)
+ {
if (m_item)
m_item->m_node = this;
setFlag(UsePreprocess,true);
@@ -72,10 +74,14 @@ public:
}
void preprocess() {
QMutexLocker locker(WaylandSurfaceItem::mutex);
- if (m_item && m_item->m_damaged) {
+
+ //Update if the item is dirty and we haven't done an updateTexture for this frame
+ if (m_item && m_item->m_damaged && !m_textureUpdated) {
m_item->updateTexture();
updateTexture();
}
+ //Reset value for next frame: we have not done updatePaintNode yet
+ m_textureUpdated = false;
}
void updateTexture() {
@@ -87,6 +93,7 @@ public:
}
WaylandSurfaceItem *m_item;
+ bool m_textureUpdated;
};
class WaylandSurfaceTextureProvider : public QSGTextureProvider
@@ -414,6 +421,7 @@ QSGNode *WaylandSurfaceItem::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeDa
node->setRect(0, 0, width(), height());
}
+ node->m_textureUpdated = true;
return node;
}