summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar.sletta@jollamobile.com>2014-01-24 14:19:13 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-01-24 15:48:32 +0100
commit7bf752b2b76c3c8f289d03801f2716b27480be67 (patch)
tree625276dfa01338aa3baa4388447748fb2ef48653 /src
parent4fb6fb6612f1615729965f0515032d86695a86ba (diff)
downloadqtwayland-7bf752b2b76c3c8f289d03801f2716b27480be67.tar.gz
Don't clobber the m_damaged state during rendering.
If the QWaylandSurfaceNode had m_damage during preprocess() (which it could get if the GUI thread got a surfaceDamaged) it would call into the item, update its texture and clear its m_damaged state. This resulted in that the next time we advanced the buffer queue, the item would not have m_damaged set and as a result, the texture would not be updated. Also, the call from preprocess() to updateTexture, though protected by a mutex in preprocess(), touched a number of variables on the GUI thread which were not being protected there, such as m_damaged and smooth(). The QWaylandSurfaceNode was doing this primarily to deal with direct rendering which has been removed pending a better solution, so we replace its use with the built-in QSGSimpleTextureNode. Change-Id: Ifccb6b1149980b4796a182fa8525446a00bbe57f Reviewed-by: Robin Burchell <robin+qt@viroteck.net> Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/compositor/compositor_api/compositor_api.pri6
-rw-r--r--src/compositor/compositor_api/qwaylandsurfaceitem.cpp20
-rw-r--r--src/compositor/compositor_api/qwaylandsurfaceitem.h2
-rw-r--r--src/compositor/compositor_api/qwaylandsurfacenode.cpp96
-rw-r--r--src/compositor/compositor_api/qwaylandsurfacenode_p.h76
5 files changed, 7 insertions, 193 deletions
diff --git a/src/compositor/compositor_api/compositor_api.pri b/src/compositor/compositor_api/compositor_api.pri
index 06d89554..87d28003 100644
--- a/src/compositor/compositor_api/compositor_api.pri
+++ b/src/compositor/compositor_api/compositor_api.pri
@@ -18,12 +18,10 @@ QT += core-private
qtHaveModule(quick) {
SOURCES += \
- compositor_api/qwaylandsurfaceitem.cpp \
- compositor_api/qwaylandsurfacenode.cpp
+ compositor_api/qwaylandsurfaceitem.cpp
HEADERS += \
- compositor_api/qwaylandsurfaceitem.h \
- compositor_api/qwaylandsurfacenode_p.h
+ compositor_api/qwaylandsurfaceitem.h
DEFINES += QT_COMPOSITOR_QUICK
diff --git a/src/compositor/compositor_api/qwaylandsurfaceitem.cpp b/src/compositor/compositor_api/qwaylandsurfaceitem.cpp
index ddb44c48..b4191e21 100644
--- a/src/compositor/compositor_api/qwaylandsurfaceitem.cpp
+++ b/src/compositor/compositor_api/qwaylandsurfaceitem.cpp
@@ -39,7 +39,6 @@
****************************************************************************/
#include "qwaylandsurfaceitem.h"
-#include "qwaylandsurfacenode_p.h"
#include "qwaylandsurface.h"
#include "qwaylandcompositor.h"
#include "qwaylandinput.h"
@@ -51,7 +50,7 @@
#include <QtGui/QGuiApplication>
#include <QtGui/QScreen>
-#include <QtQuick/QSGSimpleRectNode>
+#include <QtQuick/QSGSimpleTextureNode>
#include <QtQuick/QQuickWindow>
#include <QtCore/QMutexLocker>
@@ -90,7 +89,6 @@ QWaylandSurfaceItem::QWaylandSurfaceItem(QQuickItem *parent)
: QQuickItem(parent)
, m_surface(0)
, m_provider(0)
- , m_node(0)
, m_paintEnabled(true)
, m_mapped(false)
, m_useTextureAlpha(false)
@@ -106,7 +104,6 @@ QWaylandSurfaceItem::QWaylandSurfaceItem(QWaylandSurface *surface, QQuickItem *p
: QQuickItem(parent)
, m_surface(0)
, m_provider(0)
- , m_node(0)
, m_paintEnabled(true)
, m_mapped(false)
, m_useTextureAlpha(false)
@@ -164,8 +161,6 @@ void QWaylandSurfaceItem::init(QWaylandSurface *surface)
QWaylandSurfaceItem::~QWaylandSurfaceItem()
{
QMutexLocker locker(mutex);
- if (m_node)
- m_node->setItem(0);
if (m_surface)
m_surface->setSurfaceItem(0);
if (m_provider)
@@ -405,22 +400,17 @@ QSGNode *QWaylandSurfaceItem::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeD
return 0;
}
- QWaylandSurfaceNode *node = static_cast<QWaylandSurfaceNode *>(oldNode);
-
- if (!node) {
- node = new QWaylandSurfaceNode(this);
- }
-
- node->updateTexture();
+ QSGSimpleTextureNode *node = static_cast<QSGSimpleTextureNode *>(oldNode);
+ if (!node)
+ node = new QSGSimpleTextureNode();
+ node->setTexture(m_provider->t);
if (surface()->isYInverted()) {
node->setRect(0, height(), width(), -height());
} else {
node->setRect(0, 0, width(), height());
}
- node->setTextureUpdated(true);
-
return node;
}
diff --git a/src/compositor/compositor_api/qwaylandsurfaceitem.h b/src/compositor/compositor_api/qwaylandsurfaceitem.h
index b3b750e3..26288a7d 100644
--- a/src/compositor/compositor_api/qwaylandsurfaceitem.h
+++ b/src/compositor/compositor_api/qwaylandsurfaceitem.h
@@ -52,7 +52,6 @@
QT_BEGIN_NAMESPACE
class QWaylandSurfaceTextureProvider;
-class QWaylandSurfaceNode;
class QMutex;
Q_DECLARE_METATYPE(QWaylandSurface*)
@@ -141,7 +140,6 @@ private:
QWaylandSurface *m_surface;
QWaylandSurfaceTextureProvider *m_provider;
- QWaylandSurfaceNode *m_node;
bool m_paintEnabled;
bool m_mapped;
bool m_useTextureAlpha;
diff --git a/src/compositor/compositor_api/qwaylandsurfacenode.cpp b/src/compositor/compositor_api/qwaylandsurfacenode.cpp
deleted file mode 100644
index d13b970d..00000000
--- a/src/compositor/compositor_api/qwaylandsurfacenode.cpp
+++ /dev/null
@@ -1,96 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qwaylandsurfacenode_p.h"
-#include "qwaylandsurfaceitem.h"
-
-#include <QtCore/QMutexLocker>
-#include <QtQuick/QSGTexture>
-#include <QtQuick/QSGSimpleTextureNode>
-#include <QtQuick/QSGFlatColorMaterial>
-
-QT_BEGIN_NAMESPACE
-
-QWaylandSurfaceNode::QWaylandSurfaceNode(QWaylandSurfaceItem *item)
- : m_item(item)
- , m_textureUpdated(false)
-{
- if (m_item)
- m_item->m_node = this;
- setFlag(UsePreprocess,true);
-}
-
-
-QWaylandSurfaceNode::~QWaylandSurfaceNode()
-{
- QMutexLocker locker(QWaylandSurfaceItem::mutex);
- if (m_item)
- m_item->m_node = 0;
-}
-
-void QWaylandSurfaceNode::preprocess()
-{
- QMutexLocker locker(QWaylandSurfaceItem::mutex);
-
- if (m_item && m_item->surface()) {
- //Update if the item is dirty and we haven't done an updateTexture for this frame
- if (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 QWaylandSurfaceNode::updateTexture()
-{
- Q_ASSERT(m_item && m_item->textureProvider());
- QSGTexture *texture = m_item->textureProvider()->texture();
- setTexture(texture);
-}
-
-void QWaylandSurfaceNode::setItem(QWaylandSurfaceItem *item)
-{
- m_item = item;
-}
-
-QT_END_NAMESPACE
diff --git a/src/compositor/compositor_api/qwaylandsurfacenode_p.h b/src/compositor/compositor_api/qwaylandsurfacenode_p.h
deleted file mode 100644
index 1c71acf1..00000000
--- a/src/compositor/compositor_api/qwaylandsurfacenode_p.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWAYLANDSURFACENODE_H
-#define QWAYLANDSURFACENODE_H
-
-#include <QtQuick/QSGSimpleTextureNode>
-#include <QtQuick/QSGOpaqueTextureMaterial>
-
-QT_BEGIN_NAMESPACE
-
-class QWaylandSurfaceItem;
-class QSGTexture;
-
-class QWaylandSurfaceNode : public QSGSimpleTextureNode
-{
-public:
- QWaylandSurfaceNode(QWaylandSurfaceItem *item = 0);
- ~QWaylandSurfaceNode();
-
- void preprocess();
- void updateTexture();
-
- bool isTextureUpdated() const { return m_textureUpdated; }
- void setTextureUpdated(bool textureUpdated) { m_textureUpdated = textureUpdated; }
-
- QWaylandSurfaceItem *item() const { return m_item; }
- void setItem(QWaylandSurfaceItem *item);
-
-private:
-
- QWaylandSurfaceItem *m_item;
- bool m_textureUpdated;
-};
-
-QT_END_NAMESPACE
-
-#endif // QWAYLANDSURFACENODE_H