From fb20d2f7b149725b0fcc8e5bbb377cd6dababc9b Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Thu, 19 Apr 2018 18:29:30 +0200 Subject: Use Los Angeles to represent PST8PDT, not Vancouver This amends commit 2b8b7a162be52f8cd6c2bc39f498a1ddfb59dd68. The very last test (15.9.5.43-0-8) in the ES test-suite relies on constructing a time *just* outside the valid range, to provoke (and check it gets) a RangeError. However, it uses the current time-zone offset in computing this; and the local time -> UTC conversion in the Date constructor uses the zone information for the zone at the given time. The TZ db uses each zone's local mean solar time for the period before a formal zone was introduced; and Vancouver is further West than the nominal meridian for its zone. The test code throws in an hour's correction in case it's run in daylight-saving time, which would put the test time, when run during standard time, an hour (and a millisecond, rather than just the millisecond) outside the valid Date range, so as to ensure it's still a ms outside when the test is run during DST. However, the 12m28s mean solar offset overcomes the 1ms and puts the time back in range durign DST (but still 47m32.001s outside during standard time, which is why this problem only surfaced when North America entered summer time). Fortunately, Los Angeles is further East than the meridian in question, and uses the same zone. Task-number: QTBUG-67010 Change-Id: I58fd7bf14366ebe5842b8abd7e6802c9c78ca27e Reviewed-by: Lars Knoll Reviewed-by: Simon Hausmann --- tests/auto/qml/ecmascripttests/test262.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/qml/ecmascripttests/test262.py b/tests/auto/qml/ecmascripttests/test262.py index ae4c54df9d..e055c7a8e7 100755 --- a/tests/auto/qml/ecmascripttests/test262.py +++ b/tests/auto/qml/ecmascripttests/test262.py @@ -555,7 +555,7 @@ def Main(): # Uncomment the next line for more logging info. #logging.basicConfig(level=logging.DEBUG) # Some date tests rely on being run in pacific time and the USA's locale: - os.environ["TZ"] = "America/Vancouver" + os.environ["TZ"] = "America/Los_Angeles" # it *matters* that this is (7m8s) *East* of PST's nominal meridian ! os.environ["LANG"] = "en_US.UTF-8" os.environ["LC_TIME"] = "en_US.UTF-8" parser = BuildOptions() -- cgit v1.2.3 From 8f1ba6faffc921842c6c97e18941852f3acef0af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pasi=20Pet=C3=A4j=C3=A4j=C3=A4rvi?= Date: Mon, 12 Feb 2018 13:22:57 +0200 Subject: Build fix for -no-feature-testlib Task-number: QTBUG-66609 Change-Id: I6d96b14299f7d764414f6482b7b9b003611d8344 Reviewed-by: Oswald Buddenhagen --- src/imports/imports.pro | 4 ++-- src/src.pro | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/imports/imports.pro b/src/imports/imports.pro index 5d7e434884..56975a89f7 100644 --- a/src/imports/imports.pro +++ b/src/imports/imports.pro @@ -17,9 +17,9 @@ qtHaveModule(quick) { handlers \ layouts \ qtquick2 \ - window \ - testlib + window + qtHaveModule(testlib): SUBDIRS += testlib qtConfig(systemsemaphore): SUBDIRS += sharedimage qtConfig(quick-particles): \ SUBDIRS += particles diff --git a/src/src.pro b/src/src.pro index ff0e1e99bc..5177dfc743 100644 --- a/src/src.pro +++ b/src/src.pro @@ -8,9 +8,9 @@ SUBDIRS += \ qtHaveModule(gui):qtConfig(animation) { SUBDIRS += \ - quick \ - qmltest + quick + qtConfig(testlib): SUBDIRS += qmltest qtConfig(quick-particles): \ SUBDIRS += particles qtHaveModule(widgets): SUBDIRS += quickwidgets -- cgit v1.2.3 From 15202d33cdb2874c185d2307fa9a5c0b47c55711 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Mon, 23 Apr 2018 10:50:09 +0200 Subject: Make QPacketProtocol independent of Qml Just because we need a data stream version for QQmlDebugPacket, we don't need to add such a huge dependency. Using a template here adds some boiler plate to all users of QQmlDebugPacket, but this is worth it. Task-number: QTBUG-60996 Change-Id: Ibade8757e28ac772942129c22c8721b504da3aee Reviewed-by: Simon Hausmann --- .../qmltooling/packetprotocol/packetprotocol.pro | 4 +- .../qmltooling/packetprotocol/qqmldebugpacket_p.h | 71 ---------------------- .../qmltooling/packetprotocol/qversionedpacket_p.h | 69 +++++++++++++++++++++ .../qmldbg_debugger/qqmlenginedebugservice.cpp | 5 +- .../qmltooling/qmldbg_debugger/qv4debugservice.cpp | 4 +- .../qmldbg_inspector/globalinspector.cpp | 5 +- .../qmldbg_messages/qdebugmessageservice.cpp | 4 +- .../qmldbg_native/qqmlnativedebugconnector.cpp | 2 +- .../qqmlnativedebugservice.cpp | 4 +- .../qmldbg_profiler/qqmlenginecontrolservice.cpp | 5 +- .../qmldbg_profiler/qqmlprofileradapter.cpp | 2 +- .../qmldbg_profiler/qqmlprofilerservice.cpp | 1 - .../qmldbg_profiler/qqmlprofilerservice.h | 3 + .../qmldbg_profiler/qv4profileradapter.h | 3 +- .../qmldbg_quickprofiler/qquickprofileradapter.cpp | 5 +- .../qmltooling/qmldbg_server/qqmldebugserver.cpp | 3 +- 16 files changed, 105 insertions(+), 85 deletions(-) delete mode 100644 src/plugins/qmltooling/packetprotocol/qqmldebugpacket_p.h create mode 100644 src/plugins/qmltooling/packetprotocol/qversionedpacket_p.h diff --git a/src/plugins/qmltooling/packetprotocol/packetprotocol.pro b/src/plugins/qmltooling/packetprotocol/packetprotocol.pro index 990d3169ad..a188b87a81 100644 --- a/src/plugins/qmltooling/packetprotocol/packetprotocol.pro +++ b/src/plugins/qmltooling/packetprotocol/packetprotocol.pro @@ -1,11 +1,11 @@ TARGET = QtPacketProtocol -QT = core-private qml-private +QT = core-private CONFIG += static internal_module HEADERS = \ qpacketprotocol_p.h \ qpacket_p.h \ - qqmldebugpacket_p.h + qversionedpacket_p.h SOURCES = \ qpacketprotocol.cpp \ diff --git a/src/plugins/qmltooling/packetprotocol/qqmldebugpacket_p.h b/src/plugins/qmltooling/packetprotocol/qqmldebugpacket_p.h deleted file mode 100644 index 9a0f8cd82d..0000000000 --- a/src/plugins/qmltooling/packetprotocol/qqmldebugpacket_p.h +++ /dev/null @@ -1,71 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtQml module 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QQMLDEBUGPACKET_P_H -#define QQMLDEBUGPACKET_P_H - -#include "qpacket_p.h" - -#include -#include - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -QT_BEGIN_NAMESPACE - -// QPacket with a fixed data stream version, centrally set by QQmlDebugServer -class QQmlDebugPacket : public QPacket -{ -public: - QQmlDebugPacket() : QPacket(QQmlDebugConnector::dataStreamVersion()) {} - QQmlDebugPacket(const QByteArray &ba) : QPacket(QQmlDebugConnector::dataStreamVersion(), ba) {} -}; - -QT_END_NAMESPACE - -#endif // QQMLDEBUGPACKET_P_H diff --git a/src/plugins/qmltooling/packetprotocol/qversionedpacket_p.h b/src/plugins/qmltooling/packetprotocol/qversionedpacket_p.h new file mode 100644 index 0000000000..635072adbc --- /dev/null +++ b/src/plugins/qmltooling/packetprotocol/qversionedpacket_p.h @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtQml module 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 The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/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 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QVERSIONEDPACKET_P_H +#define QVERSIONEDPACKET_P_H + +#include "qpacket_p.h" + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +QT_BEGIN_NAMESPACE + +// QPacket with a fixed data stream version, centrally set by some Connector +template +class QVersionedPacket : public QPacket +{ +public: + QVersionedPacket(const QByteArray &ba) : QPacket(Connector::dataStreamVersion(), ba) {} + QVersionedPacket() : QPacket(Connector::dataStreamVersion()) {} +}; + +QT_END_NAMESPACE + +#endif // QVERSIONEDPACKET_P_H diff --git a/src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.cpp b/src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.cpp index 236109d041..d008b86a78 100644 --- a/src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.cpp +++ b/src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.cpp @@ -56,10 +56,13 @@ #include #include #include -#include +#include +#include QT_BEGIN_NAMESPACE +using QQmlDebugPacket = QVersionedPacket; + QQmlEngineDebugServiceImpl::QQmlEngineDebugServiceImpl(QObject *parent) : QQmlEngineDebugService(2, parent), m_watch(new QQmlWatcher(this)), m_statesDelegate(nullptr) { diff --git a/src/plugins/qmltooling/qmldbg_debugger/qv4debugservice.cpp b/src/plugins/qmltooling/qmldbg_debugger/qv4debugservice.cpp index 61209e08cb..32de8e9027 100644 --- a/src/plugins/qmltooling/qmldbg_debugger/qv4debugservice.cpp +++ b/src/plugins/qmltooling/qmldbg_debugger/qv4debugservice.cpp @@ -45,7 +45,7 @@ #include #include #include -#include +#include #include #include @@ -70,6 +70,8 @@ QT_BEGIN_NAMESPACE class V8CommandHandler; class UnknownV8CommandHandler; +using QQmlDebugPacket = QVersionedPacket; + int QV4DebugServiceImpl::sequence = 0; class V8CommandHandler diff --git a/src/plugins/qmltooling/qmldbg_inspector/globalinspector.cpp b/src/plugins/qmltooling/qmldbg_inspector/globalinspector.cpp index 7ce83daed6..bac4e01df1 100644 --- a/src/plugins/qmltooling/qmldbg_inspector/globalinspector.cpp +++ b/src/plugins/qmltooling/qmldbg_inspector/globalinspector.cpp @@ -44,7 +44,8 @@ #include #include #include -#include +#include +#include #include @@ -63,6 +64,8 @@ QT_BEGIN_NAMESPACE +using QQmlDebugPacket = QVersionedPacket; + const char REQUEST[] = "request"; const char RESPONSE[] = "response"; const char EVENT[] = "event"; diff --git a/src/plugins/qmltooling/qmldbg_messages/qdebugmessageservice.cpp b/src/plugins/qmltooling/qmldbg_messages/qdebugmessageservice.cpp index 2bf9210b37..4f6cb9364d 100644 --- a/src/plugins/qmltooling/qmldbg_messages/qdebugmessageservice.cpp +++ b/src/plugins/qmltooling/qmldbg_messages/qdebugmessageservice.cpp @@ -40,10 +40,12 @@ #include "qdebugmessageservice.h" #include -#include +#include QT_BEGIN_NAMESPACE +using QQmlDebugPacket = QVersionedPacket; + void DebugMessageHandler(QtMsgType type, const QMessageLogContext &ctxt, const QString &buf) { diff --git a/src/plugins/qmltooling/qmldbg_native/qqmlnativedebugconnector.cpp b/src/plugins/qmltooling/qmldbg_native/qqmlnativedebugconnector.cpp index 93ac875e2d..bf73440a39 100644 --- a/src/plugins/qmltooling/qmldbg_native/qqmlnativedebugconnector.cpp +++ b/src/plugins/qmltooling/qmldbg_native/qqmlnativedebugconnector.cpp @@ -40,7 +40,7 @@ #include "qqmlnativedebugconnector.h" #include -#include +#include #include #include diff --git a/src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservice.cpp b/src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservice.cpp index e17fe92983..b19115aa60 100644 --- a/src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservice.cpp +++ b/src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservice.cpp @@ -49,7 +49,7 @@ #include #include #include -#include +#include #include #include @@ -65,6 +65,8 @@ QT_BEGIN_NAMESPACE +using QQmlDebugPacket = QVersionedPacket; + class BreakPoint { public: diff --git a/src/plugins/qmltooling/qmldbg_profiler/qqmlenginecontrolservice.cpp b/src/plugins/qmltooling/qmldbg_profiler/qqmlenginecontrolservice.cpp index 4eedb4bd51..f76add448f 100644 --- a/src/plugins/qmltooling/qmldbg_profiler/qqmlenginecontrolservice.cpp +++ b/src/plugins/qmltooling/qmldbg_profiler/qqmlenginecontrolservice.cpp @@ -38,11 +38,14 @@ ****************************************************************************/ #include "qqmlenginecontrolservice.h" -#include +#include +#include #include QT_BEGIN_NAMESPACE +using QQmlDebugPacket = QVersionedPacket; + QQmlEngineControlServiceImpl::QQmlEngineControlServiceImpl(QObject *parent) : QQmlEngineControlService(1, parent) { diff --git a/src/plugins/qmltooling/qmldbg_profiler/qqmlprofileradapter.cpp b/src/plugins/qmltooling/qmldbg_profiler/qqmlprofileradapter.cpp index 5ff1b1f97e..19104927f2 100644 --- a/src/plugins/qmltooling/qmldbg_profiler/qqmlprofileradapter.cpp +++ b/src/plugins/qmltooling/qmldbg_profiler/qqmlprofileradapter.cpp @@ -38,8 +38,8 @@ ****************************************************************************/ #include "qqmlprofileradapter.h" +#include "qqmlprofilerservice.h" -#include #include QT_BEGIN_NAMESPACE diff --git a/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp b/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp index 7014249c83..21a5663f59 100644 --- a/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp +++ b/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp @@ -43,7 +43,6 @@ #include "qqmlprofilerservicefactory.h" #include -#include #include #include diff --git a/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.h b/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.h index a8c3047421..2b92a478c1 100644 --- a/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.h +++ b/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.h @@ -56,6 +56,8 @@ #include #include #include +#include +#include #include #include @@ -70,6 +72,7 @@ QT_BEGIN_NAMESPACE class QUrl; +using QQmlDebugPacket = QVersionedPacket; class QQmlProfilerServiceImpl : public QQmlConfigurableDebugService, diff --git a/src/plugins/qmltooling/qmldbg_profiler/qv4profileradapter.h b/src/plugins/qmltooling/qmldbg_profiler/qv4profileradapter.h index 7ac378acd9..2211c82fc5 100644 --- a/src/plugins/qmltooling/qmldbg_profiler/qv4profileradapter.h +++ b/src/plugins/qmltooling/qmldbg_profiler/qv4profileradapter.h @@ -51,9 +51,10 @@ // We mean it. // +#include "qqmlprofilerservice.h" + #include #include -#include #include #include diff --git a/src/plugins/qmltooling/qmldbg_quickprofiler/qquickprofileradapter.cpp b/src/plugins/qmltooling/qmldbg_quickprofiler/qquickprofileradapter.cpp index a05d11664d..2c152e4cd5 100644 --- a/src/plugins/qmltooling/qmldbg_quickprofiler/qquickprofileradapter.cpp +++ b/src/plugins/qmltooling/qmldbg_quickprofiler/qquickprofileradapter.cpp @@ -40,12 +40,15 @@ #include "qquickprofileradapter.h" #include -#include +#include +#include #include #include QT_BEGIN_NAMESPACE +using QQmlDebugPacket = QVersionedPacket; + QQuickProfilerAdapter::QQuickProfilerAdapter(QObject *parent) : QQmlAbstractProfilerAdapter(parent), next(0) { diff --git a/src/plugins/qmltooling/qmldbg_server/qqmldebugserver.cpp b/src/plugins/qmltooling/qmldbg_server/qqmldebugserver.cpp index 1814e28b83..c1e86f0b3c 100644 --- a/src/plugins/qmltooling/qmldbg_server/qqmldebugserver.cpp +++ b/src/plugins/qmltooling/qmldbg_server/qqmldebugserver.cpp @@ -47,7 +47,7 @@ #include #include #include -#include +#include #include #include @@ -83,6 +83,7 @@ QT_BEGIN_NAMESPACE Q_QML_DEBUG_PLUGIN_LOADER(QQmlDebugServerConnection) const int protocolVersion = 1; +using QQmlDebugPacket = QVersionedPacket; class QQmlDebugServerImpl; class QQmlDebugServerThread : public QThread -- cgit v1.2.3 From bea27694ae60bc0273ee3a6f34a57168c9bf01a1 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Fri, 20 Apr 2018 19:08:22 +0200 Subject: Update submodule now that I've fixed the actual bug here The submodule has now reverted my "fix" for a test the ES spec initially lead me to think was misguided; the test is fine, in fact, but I was using the wrong time-zone to run it. That's now fixed here, so we can take in the revert of the mis-fix. Task-number: QTBUG-67010 Change-Id: I89c8236ce11ee4dc16eb145e37f4510e19977bb2 Reviewed-by: Simon Hausmann --- tests/auto/qml/ecmascripttests/test262 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/qml/ecmascripttests/test262 b/tests/auto/qml/ecmascripttests/test262 index 40b4f28e98..e505c11eeb 160000 --- a/tests/auto/qml/ecmascripttests/test262 +++ b/tests/auto/qml/ecmascripttests/test262 @@ -1 +1 @@ -Subproject commit 40b4f28e98c416a092e26aa17489bf94ccb8bf4f +Subproject commit e505c11eebe5a389a7d47a4bf570c66469740b01 -- cgit v1.2.3 From 03739f2150d59248fb2c4b688c6352182f630f3e Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Mon, 23 Apr 2018 12:23:42 +0200 Subject: Make QtQmlDebug independent of QtQml This means QtQmlDebug needs its own qqmlprofilerdefintions.h. This is a good thing because this way we notice if we change the definitions in an incompatible way. The test uses QtQmlDebug after all. Also, qqmldebugserviceinterfaces_p.h is not available anymore, which means the service names have to be spelled out. This, also, is beneficial as it prevents us from accidentally changing the names. In the context of QmlDebug we don't need to namespace the profiler definitions, either. This simplifies some code. Task-number: QTBUG-60996 Change-Id: Ibb39e48c9b758687d68b8ce4431f45eb26939a09 Reviewed-by: Simon Hausmann --- src/qml/debugger/qqmlprofilerdefinitions_p.h | 27 ---- src/qmldebug/qmldebug.pro | 5 +- src/qmldebug/qqmlenginecontrolclient.cpp | 3 +- src/qmldebug/qqmlprofilerclient.cpp | 1 - src/qmldebug/qqmlprofilerclient_p.h | 4 +- src/qmldebug/qqmlprofilerclient_p_p.h | 6 +- src/qmldebug/qqmlprofilerclientdefinitions_p.h | 152 +++++++++++++++++++++ src/qmldebug/qqmlprofilerevent_p.h | 4 +- src/qmldebug/qqmlprofilereventtype.cpp | 26 +++- src/qmldebug/qqmlprofilereventtype_p.h | 5 +- src/qmldebug/qqmlprofilertypedevent.cpp | 91 ++++++------ .../tst_qqmlprofilerservice.cpp | 84 +++++------- tools/qmlprofiler/qmlprofiler.pro | 2 +- tools/qmlprofiler/qmlprofilerapplication.cpp | 5 +- tools/qmlprofiler/qmlprofilerclient.h | 2 +- tools/qmlprofiler/qmlprofilerdata.cpp | 110 +++++++-------- tools/qmlprofiler/qmlprofilerdata.h | 6 +- 17 files changed, 329 insertions(+), 204 deletions(-) create mode 100644 src/qmldebug/qqmlprofilerclientdefinitions_p.h diff --git a/src/qml/debugger/qqmlprofilerdefinitions_p.h b/src/qml/debugger/qqmlprofilerdefinitions_p.h index f84a2c44e2..7b972c5d0d 100644 --- a/src/qml/debugger/qqmlprofilerdefinitions_p.h +++ b/src/qml/debugger/qqmlprofilerdefinitions_p.h @@ -96,11 +96,6 @@ struct QQmlProfilerDefinitions { MaximumRangeType }; - enum BindingType { - QmlBinding, - MaximumBindingType - }; - enum PixmapEventType { PixmapSizeKnown, PixmapReferenceCountChanged, @@ -129,8 +124,6 @@ struct QQmlProfilerDefinitions { NumGUIThreadFrameTypes = MaximumSceneGraphFrameType - NumRenderThreadFrameTypes }; - typedef QV4::Profiling::MemoryType MemoryType; - enum ProfileFeature { ProfileJavaScript, ProfileMemory, @@ -162,26 +155,6 @@ struct QQmlProfilerDefinitions { MaximumInputEventType }; - - static ProfileFeature featureFromRangeType(RangeType range) - { - switch (range) { - case Painting: - return ProfilePainting; - case Compiling: - return ProfileCompiling; - case Creating: - return ProfileCreating; - case Binding: - return ProfileBinding; - case HandlingSignal: - return ProfileHandlingSignal; - case Javascript: - return ProfileJavaScript; - default: - return MaximumProfileFeature; - } - } }; QT_END_NAMESPACE diff --git a/src/qmldebug/qmldebug.pro b/src/qmldebug/qmldebug.pro index 2539414d8f..2c1b71797d 100644 --- a/src/qmldebug/qmldebug.pro +++ b/src/qmldebug/qmldebug.pro @@ -1,5 +1,5 @@ TARGET = QtQmlDebug -QT = core-private network packetprotocol-private qml-private +QT = core-private network packetprotocol-private CONFIG += static internal_module load(qt_module) @@ -28,4 +28,5 @@ HEADERS += \ qqmlprofilereventlocation_p.h \ qqmlprofilereventreceiver_p.h \ qqmlprofilereventtype_p.h \ - qqmlprofilertypedevent_p.h + qqmlprofilertypedevent_p.h \ + qqmlprofilerclientdefinitions_p.h diff --git a/src/qmldebug/qqmlenginecontrolclient.cpp b/src/qmldebug/qqmlenginecontrolclient.cpp index 13f216ce38..45d672d4bc 100644 --- a/src/qmldebug/qqmlenginecontrolclient.cpp +++ b/src/qmldebug/qqmlenginecontrolclient.cpp @@ -41,7 +41,6 @@ #include "qqmlenginecontrolclient_p_p.h" #include "qqmldebugconnection_p.h" -#include #include QT_BEGIN_NAMESPACE @@ -142,7 +141,7 @@ void QQmlEngineControlClient::messageReceived(const QByteArray &data) } QQmlEngineControlClientPrivate::QQmlEngineControlClientPrivate(QQmlDebugConnection *connection) : - QQmlDebugClientPrivate(QQmlEngineControlService::s_key, connection) + QQmlDebugClientPrivate(QLatin1String("EngineControl"), connection) { } diff --git a/src/qmldebug/qqmlprofilerclient.cpp b/src/qmldebug/qqmlprofilerclient.cpp index d2a2d24f13..661b43f164 100644 --- a/src/qmldebug/qqmlprofilerclient.cpp +++ b/src/qmldebug/qqmlprofilerclient.cpp @@ -39,7 +39,6 @@ #include "qqmlprofilerclient_p_p.h" #include "qqmldebugconnection_p.h" -#include QT_BEGIN_NAMESPACE diff --git a/src/qmldebug/qqmlprofilerclient_p.h b/src/qmldebug/qqmlprofilerclient_p.h index 68a32a1a5a..7b8e286f5b 100644 --- a/src/qmldebug/qqmlprofilerclient_p.h +++ b/src/qmldebug/qqmlprofilerclient_p.h @@ -43,8 +43,8 @@ #include "qqmldebugclient_p.h" #include "qqmlprofilereventlocation_p.h" #include "qqmlprofilereventreceiver_p.h" +#include "qqmlprofilerclientdefinitions_p.h" -#include #include // @@ -61,7 +61,7 @@ QT_BEGIN_NAMESPACE class QQmlProfilerClientPrivate; -class QQmlProfilerClient : public QQmlDebugClient, public QQmlProfilerDefinitions +class QQmlProfilerClient : public QQmlDebugClient { Q_OBJECT Q_DECLARE_PRIVATE(QQmlProfilerClient) diff --git a/src/qmldebug/qqmlprofilerclient_p_p.h b/src/qmldebug/qqmlprofilerclient_p_p.h index 0caef8e448..994c08cafc 100644 --- a/src/qmldebug/qqmlprofilerclient_p_p.h +++ b/src/qmldebug/qqmlprofilerclient_p_p.h @@ -45,10 +45,10 @@ #include "qqmlenginecontrolclient_p.h" #include "qqmlprofilerclient_p.h" #include "qqmlprofilertypedevent_p.h" - -#include +#include "qqmlprofilerclientdefinitions_p.h" #include +#include // // W A R N I N G @@ -63,7 +63,7 @@ QT_BEGIN_NAMESPACE -class QQmlProfilerClientPrivate : public QQmlDebugClientPrivate, public QQmlProfilerDefinitions { +class QQmlProfilerClientPrivate : public QQmlDebugClientPrivate { Q_DECLARE_PUBLIC(QQmlProfilerClient) public: QQmlProfilerClientPrivate(QQmlDebugConnection *connection, diff --git a/src/qmldebug/qqmlprofilerclientdefinitions_p.h b/src/qmldebug/qqmlprofilerclientdefinitions_p.h new file mode 100644 index 0000000000..c8524574f6 --- /dev/null +++ b/src/qmldebug/qqmlprofilerclientdefinitions_p.h @@ -0,0 +1,152 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtQml module 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 The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/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 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QQMLPROFILERCLIENTDEFINITIONS_P_H +#define QQMLPROFILERCLIENTDEFINITIONS_P_H + +#include + +QT_BEGIN_NAMESPACE + +enum Message { + Event, + RangeStart, + RangeData, + RangeLocation, + RangeEnd, + Complete, // end of transmission + PixmapCacheEvent, + SceneGraphFrame, + MemoryAllocation, + DebugMessage, + + MaximumMessage +}; + +enum EventType { + FramePaint, + Mouse, + Key, + AnimationFrame, + EndTrace, + StartTrace, + + MaximumEventType +}; + +enum RangeType { + Painting, + Compiling, + Creating, + Binding, //running a binding + HandlingSignal, //running a signal handler + Javascript, + + MaximumRangeType +}; + +enum PixmapEventType { + PixmapSizeKnown, + PixmapReferenceCountChanged, + PixmapCacheCountChanged, + PixmapLoadingStarted, + PixmapLoadingFinished, + PixmapLoadingError, + + MaximumPixmapEventType +}; + +enum SceneGraphFrameType { + SceneGraphRendererFrame, // Render Thread + SceneGraphAdaptationLayerFrame, // Render Thread + SceneGraphContextFrame, // Render Thread + SceneGraphRenderLoopFrame, // Render Thread + SceneGraphTexturePrepare, // Render Thread + SceneGraphTextureDeletion, // Render Thread + SceneGraphPolishAndSync, // GUI Thread + SceneGraphWindowsRenderShow, // Unused + SceneGraphWindowsAnimations, // GUI Thread + SceneGraphPolishFrame, // GUI Thread + + MaximumSceneGraphFrameType, + NumRenderThreadFrameTypes = SceneGraphPolishAndSync, + NumGUIThreadFrameTypes = MaximumSceneGraphFrameType - NumRenderThreadFrameTypes +}; + +enum MemoryType { + HeapPage, + LargeItem, + SmallItem +}; + +enum ProfileFeature { + ProfileJavaScript, + ProfileMemory, + ProfilePixmapCache, + ProfileSceneGraph, + ProfileAnimations, + ProfilePainting, + ProfileCompiling, + ProfileCreating, + ProfileBinding, + ProfileHandlingSignal, + ProfileInputEvents, + ProfileDebugMessages, + + MaximumProfileFeature +}; + +enum InputEventType { + InputKeyPress, + InputKeyRelease, + InputKeyUnknown, + + InputMousePress, + InputMouseRelease, + InputMouseMove, + InputMouseDoubleClick, + InputMouseWheel, + InputMouseUnknown, + + MaximumInputEventType +}; + +QT_END_NAMESPACE + +#endif // QQMLPROFILERCLIENTDEFINITIONS_P_H diff --git a/src/qmldebug/qqmlprofilerevent_p.h b/src/qmldebug/qqmlprofilerevent_p.h index 49a0c9e347..1e205d8dbb 100644 --- a/src/qmldebug/qqmlprofilerevent_p.h +++ b/src/qmldebug/qqmlprofilerevent_p.h @@ -40,7 +40,7 @@ #ifndef QQMLPROFILEREVENT_P_H #define QQMLPROFILEREVENT_P_H -#include +#include "qqmlprofilerclientdefinitions_p.h" #include #include @@ -63,7 +63,7 @@ QT_BEGIN_NAMESPACE -struct QQmlProfilerEvent : public QQmlProfilerDefinitions { +struct QQmlProfilerEvent { QQmlProfilerEvent() : m_timestamp(-1), m_typeIndex(-1), m_dataType(Inline8Bit), m_dataLength(0) {} diff --git a/src/qmldebug/qqmlprofilereventtype.cpp b/src/qmldebug/qqmlprofilereventtype.cpp index b0aad3fc5b..c92e914d74 100644 --- a/src/qmldebug/qqmlprofilereventtype.cpp +++ b/src/qmldebug/qqmlprofilereventtype.cpp @@ -38,6 +38,7 @@ ****************************************************************************/ #include "qqmlprofilereventtype_p.h" +#include "qqmlprofilerclientdefinitions_p.h" #include @@ -49,8 +50,8 @@ QDataStream &operator>>(QDataStream &stream, QQmlProfilerEventType &type) quint8 rangeType; stream >> type.m_displayName >> type.m_data >> type.m_location >> message >> rangeType >> type.m_detailType; - type.m_message = static_cast(message); - type.m_rangeType = static_cast(rangeType); + type.m_message = static_cast(message); + type.m_rangeType = static_cast(rangeType); return stream; } @@ -61,7 +62,7 @@ QDataStream &operator<<(QDataStream &stream, const QQmlProfilerEventType &type) << type.m_detailType; } -QQmlProfilerDefinitions::ProfileFeature QQmlProfilerEventType::feature() const +ProfileFeature QQmlProfilerEventType::feature() const { switch (m_message) { case Event: { @@ -84,7 +85,24 @@ QQmlProfilerDefinitions::ProfileFeature QQmlProfilerEventType::feature() const case DebugMessage: return ProfileDebugMessages; default: - return featureFromRangeType(m_rangeType); + break; + } + + switch (m_rangeType) { + case Painting: + return ProfilePainting; + case Compiling: + return ProfileCompiling; + case Creating: + return ProfileCreating; + case Binding: + return ProfileBinding; + case HandlingSignal: + return ProfileHandlingSignal; + case Javascript: + return ProfileJavaScript; + default: + return MaximumProfileFeature; } } diff --git a/src/qmldebug/qqmlprofilereventtype_p.h b/src/qmldebug/qqmlprofilereventtype_p.h index 7bd67f9ca8..7189df53ef 100644 --- a/src/qmldebug/qqmlprofilereventtype_p.h +++ b/src/qmldebug/qqmlprofilereventtype_p.h @@ -41,8 +41,7 @@ #define QQMLPROFILEREVENTTYPE_P_H #include "qqmlprofilereventlocation_p.h" - -#include +#include "qqmlprofilerclientdefinitions_p.h" #include #include @@ -61,7 +60,7 @@ QT_BEGIN_NAMESPACE -class QQmlProfilerEventType : public QQmlProfilerDefinitions { +class QQmlProfilerEventType { public: QQmlProfilerEventType(Message message = MaximumMessage, RangeType rangeType = MaximumRangeType, int detailType = -1, diff --git a/src/qmldebug/qqmlprofilertypedevent.cpp b/src/qmldebug/qqmlprofilertypedevent.cpp index 9b00481e17..31a36bd052 100644 --- a/src/qmldebug/qqmlprofilertypedevent.cpp +++ b/src/qmldebug/qqmlprofilertypedevent.cpp @@ -38,6 +38,8 @@ ****************************************************************************/ #include "qqmlprofilertypedevent_p.h" +#include "qqmlprofilerclientdefinitions_p.h" + #include QT_BEGIN_NAMESPACE @@ -50,15 +52,15 @@ QDataStream &operator>>(QDataStream &stream, QQmlProfilerTypedEvent &event) stream >> time >> messageType; - if (messageType < 0 || messageType > QQmlProfilerDefinitions::MaximumMessage) - messageType = QQmlProfilerDefinitions::MaximumMessage; + if (messageType < 0 || messageType > MaximumMessage) + messageType = MaximumMessage; - QQmlProfilerDefinitions::RangeType rangeType = QQmlProfilerDefinitions::MaximumRangeType; + RangeType rangeType = MaximumRangeType; if (!stream.atEnd()) { stream >> subtype; - rangeType = static_cast(subtype); - if (rangeType < 0 || rangeType > QQmlProfilerDefinitions::MaximumRangeType) - rangeType = QQmlProfilerDefinitions::MaximumRangeType; + rangeType = static_cast(subtype); + if (rangeType < 0 || rangeType > MaximumRangeType) + rangeType = MaximumRangeType; } else { subtype = -1; } @@ -68,13 +70,13 @@ QDataStream &operator>>(QDataStream &stream, QQmlProfilerTypedEvent &event) event.serverTypeId = 0; switch (messageType) { - case QQmlProfilerDefinitions::Event: { + case Event: { event.type = QQmlProfilerEventType( - static_cast(messageType), - QQmlProfilerDefinitions::MaximumRangeType, subtype); + static_cast(messageType), + MaximumRangeType, subtype); switch (subtype) { - case QQmlProfilerDefinitions::StartTrace: - case QQmlProfilerDefinitions::EndTrace: { + case StartTrace: + case EndTrace: { QVarLengthArray engineIds; while (!stream.atEnd()) { qint32 id; @@ -84,7 +86,7 @@ QDataStream &operator>>(QDataStream &stream, QQmlProfilerTypedEvent &event) event.event.setNumbers, qint32>(engineIds); break; } - case QQmlProfilerDefinitions::AnimationFrame: { + case AnimationFrame: { qint32 frameRate, animationCount; qint32 threadId; stream >> frameRate >> animationCount; @@ -96,11 +98,9 @@ QDataStream &operator>>(QDataStream &stream, QQmlProfilerTypedEvent &event) event.event.setNumbers({frameRate, animationCount, threadId}); break; } - case QQmlProfilerDefinitions::Mouse: - case QQmlProfilerDefinitions::Key: - int inputType = (subtype == QQmlProfilerDefinitions::Key - ? QQmlProfilerDefinitions::InputKeyUnknown - : QQmlProfilerDefinitions::InputMouseUnknown); + case Mouse: + case Key: + int inputType = (subtype == Key ? InputKeyUnknown : InputMouseUnknown); if (!stream.atEnd()) stream >> inputType; qint32 a = -1; @@ -116,13 +116,13 @@ QDataStream &operator>>(QDataStream &stream, QQmlProfilerTypedEvent &event) break; } - case QQmlProfilerDefinitions::Complete: { + case Complete: { event.type = QQmlProfilerEventType( - static_cast(messageType), - QQmlProfilerDefinitions::MaximumRangeType, subtype); + static_cast(messageType), + MaximumRangeType, subtype); break; } - case QQmlProfilerDefinitions::SceneGraphFrame: { + case SceneGraphFrame: { QVarLengthArray params; qint64 param; @@ -132,41 +132,40 @@ QDataStream &operator>>(QDataStream &stream, QQmlProfilerTypedEvent &event) } event.type = QQmlProfilerEventType( - static_cast(messageType), - QQmlProfilerDefinitions::MaximumRangeType, subtype); + static_cast(messageType), + MaximumRangeType, subtype); event.event.setNumbers, qint64>(params); break; } - case QQmlProfilerDefinitions::PixmapCacheEvent: { + case PixmapCacheEvent: { qint32 width = 0, height = 0, refcount = 0; QString filename; stream >> filename; - if (subtype == QQmlProfilerDefinitions::PixmapReferenceCountChanged - || subtype == QQmlProfilerDefinitions::PixmapCacheCountChanged) { + if (subtype == PixmapReferenceCountChanged || subtype == PixmapCacheCountChanged) { stream >> refcount; - } else if (subtype == QQmlProfilerDefinitions::PixmapSizeKnown) { + } else if (subtype == PixmapSizeKnown) { stream >> width >> height; refcount = 1; } event.type = QQmlProfilerEventType( - static_cast(messageType), - QQmlProfilerDefinitions::MaximumRangeType, subtype, + static_cast(messageType), + MaximumRangeType, subtype, QQmlProfilerEventLocation(filename, 0, 0)); event.event.setNumbers({width, height, refcount}); break; } - case QQmlProfilerDefinitions::MemoryAllocation: { + case MemoryAllocation: { qint64 delta; stream >> delta; event.type = QQmlProfilerEventType( - static_cast(messageType), - QQmlProfilerDefinitions::MaximumRangeType, subtype); + static_cast(messageType), + MaximumRangeType, subtype); event.event.setNumbers({delta}); break; } - case QQmlProfilerDefinitions::RangeStart: { + case RangeStart: { if (!stream.atEnd()) { qint64 typeId; stream >> typeId; @@ -175,22 +174,22 @@ QDataStream &operator>>(QDataStream &stream, QQmlProfilerTypedEvent &event) // otherwise it's the old binding type of 4 bytes } - event.type = QQmlProfilerEventType(QQmlProfilerDefinitions::MaximumMessage, rangeType, -1); - event.event.setRangeStage(QQmlProfilerDefinitions::RangeStart); + event.type = QQmlProfilerEventType(MaximumMessage, rangeType, -1); + event.event.setRangeStage(RangeStart); break; } - case QQmlProfilerDefinitions::RangeData: { + case RangeData: { QString data; stream >> data; - event.type = QQmlProfilerEventType(QQmlProfilerDefinitions::MaximumMessage, rangeType, -1, + event.type = QQmlProfilerEventType(MaximumMessage, rangeType, -1, QQmlProfilerEventLocation(), data); - event.event.setRangeStage(QQmlProfilerDefinitions::RangeData); + event.event.setRangeStage(RangeData); if (!stream.atEnd()) stream >> event.serverTypeId; break; } - case QQmlProfilerDefinitions::RangeLocation: { + case RangeLocation: { QString filename; qint32 line = 0; qint32 column = 0; @@ -202,21 +201,21 @@ QDataStream &operator>>(QDataStream &stream, QQmlProfilerTypedEvent &event) stream >> event.serverTypeId; } - event.type = QQmlProfilerEventType(QQmlProfilerDefinitions::MaximumMessage, rangeType, -1, + event.type = QQmlProfilerEventType(MaximumMessage, rangeType, -1, QQmlProfilerEventLocation(filename, line, column)); - event.event.setRangeStage(QQmlProfilerDefinitions::RangeLocation); + event.event.setRangeStage(RangeLocation); break; } - case QQmlProfilerDefinitions::RangeEnd: { - event.type = QQmlProfilerEventType(QQmlProfilerDefinitions::MaximumMessage, rangeType, -1); - event.event.setRangeStage(QQmlProfilerDefinitions::RangeEnd); + case RangeEnd: { + event.type = QQmlProfilerEventType(MaximumMessage, rangeType, -1); + event.event.setRangeStage(RangeEnd); break; } default: event.event.setNumbers({}); event.type = QQmlProfilerEventType( - static_cast(messageType), - QQmlProfilerDefinitions::MaximumRangeType, subtype); + static_cast(messageType), + MaximumRangeType, subtype); break; } diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp index 562804bc45..a6fbdf41e4 100644 --- a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp +++ b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp @@ -40,7 +40,7 @@ #include #include -class QQmlProfilerTestClient : public QQmlProfilerEventReceiver, public QQmlProfilerDefinitions +class QQmlProfilerTestClient : public QQmlProfilerEventReceiver { Q_OBJECT @@ -229,8 +229,8 @@ private: bool m_isComplete = false; // Don't use ({...}) here as MSVC will interpret that as the "QVector(int size)" ctor. - const QVector m_rangeStart = (QVector() << QQmlProfilerDefinitions::RangeStart); - const QVector m_rangeEnd = (QVector() << QQmlProfilerDefinitions::RangeEnd); + const QVector m_rangeStart = (QVector() << RangeStart); + const QVector m_rangeEnd = (QVector() << RangeEnd); }; #define VERIFY(type, position, expected, checks, numbers) \ @@ -247,7 +247,7 @@ QQmlDebugTest::ConnectResult tst_QQmlProfilerService::connect( // ### Still using qmlscene due to QTBUG-33377 return QQmlDebugTest::connect( QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmlscene", - restrictServices ? QQmlDebuggingEnabler::profilerServices().join(',') : QString(), + restrictServices ? "CanvasFrameRate,EngineControl,DebugMessages" : QString(), testFile(file), block); } @@ -272,15 +272,11 @@ void tst_QQmlProfilerService::checkTraceReceived() QVector numbers; // must start with "StartTrace" - QQmlProfilerEventType expected(QQmlProfilerDefinitions::Event, - QQmlProfilerDefinitions::MaximumRangeType, - QQmlProfilerDefinitions::StartTrace); + QQmlProfilerEventType expected(Event, MaximumRangeType, StartTrace); VERIFY(MessageListAsynchronous, 0, expected, CheckMessageType | CheckDetailType, numbers); // must end with "EndTrace" - expected = QQmlProfilerEventType(QQmlProfilerDefinitions::Event, - QQmlProfilerDefinitions::MaximumRangeType, - QQmlProfilerDefinitions::EndTrace); + expected = QQmlProfilerEventType(Event, MaximumRangeType, EndTrace); VERIFY(MessageListAsynchronous, m_client->asynchronousMessages.length() - 1, expected, CheckMessageType | CheckDetailType, numbers); } @@ -299,15 +295,15 @@ void tst_QQmlProfilerService::checkJsHeap() const qint64 amount = message.number(0); const QQmlProfilerEventType &type = m_client->types.at(message.typeIndex()); switch (type.detailType()) { - case QV4::Profiling::HeapPage: + case HeapPage: allocated += amount; seen_alloc = true; break; - case QV4::Profiling::SmallItem: + case SmallItem: used += amount; seen_small = true; break; - case QV4::Profiling::LargeItem: + case LargeItem: allocated += amount; used += amount; seen_large = true; @@ -548,28 +544,27 @@ void tst_QQmlProfilerService::pixmapCacheData() checkTraceReceived(); checkJsHeap(); - auto createType = [](QQmlProfilerDefinitions::PixmapEventType type) { - return QQmlProfilerEventType(QQmlProfilerDefinitions::PixmapCacheEvent, - QQmlProfilerDefinitions::MaximumRangeType, type); + auto createType = [](PixmapEventType type) { + return QQmlProfilerEventType(PixmapCacheEvent, MaximumRangeType, type); }; QVector numbers; // image starting to load - VERIFY(MessageListPixmap, 0, createType(QQmlProfilerDefinitions::PixmapLoadingStarted), + VERIFY(MessageListPixmap, 0, createType(PixmapLoadingStarted), CheckMessageType | CheckDetailType, numbers); // image size numbers = QVector({2, 2, 1}); - VERIFY(MessageListPixmap, 1, createType(QQmlProfilerDefinitions::PixmapSizeKnown), + VERIFY(MessageListPixmap, 1, createType(PixmapSizeKnown), CheckMessageType | CheckDetailType | CheckNumbers, numbers); // image loaded - VERIFY(MessageListPixmap, 2, createType(QQmlProfilerDefinitions::PixmapLoadingFinished), + VERIFY(MessageListPixmap, 2, createType(PixmapLoadingFinished), CheckMessageType | CheckDetailType, numbers); // cache size - VERIFY(MessageListPixmap, 3, createType(QQmlProfilerDefinitions::PixmapCacheCountChanged), + VERIFY(MessageListPixmap, 3, createType(PixmapCacheCountChanged), CheckMessageType | CheckDetailType, numbers); } @@ -597,8 +592,8 @@ void tst_QQmlProfilerService::scenegraphData() if (QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::OpenGL)) { foreach (const QQmlProfilerEvent &msg, m_client->asynchronousMessages) { const QQmlProfilerEventType &type = m_client->types.at(msg.typeIndex()); - if (type.message() == QQmlProfilerDefinitions::SceneGraphFrame) { - if (type.detailType() == QQmlProfilerDefinitions::SceneGraphContextFrame) { + if (type.message() == SceneGraphFrame) { + if (type.detailType() == SceneGraphContextFrame) { contextFrameTime = msg.timestamp(); break; } @@ -610,7 +605,7 @@ void tst_QQmlProfilerService::scenegraphData() #endif foreach (const QQmlProfilerEvent &msg, m_client->asynchronousMessages) { const QQmlProfilerEventType &type = m_client->types.at(msg.typeIndex()); - if (type.detailType() == QQmlProfilerDefinitions::SceneGraphRendererFrame) { + if (type.detailType() == SceneGraphRendererFrame) { QVERIFY(msg.timestamp() >= contextFrameTime); renderFrameTime = msg.timestamp(); break; @@ -621,7 +616,7 @@ void tst_QQmlProfilerService::scenegraphData() foreach (const QQmlProfilerEvent &msg, m_client->asynchronousMessages) { const QQmlProfilerEventType &type = m_client->types.at(msg.typeIndex()); - if (type.detailType() == QQmlProfilerDefinitions::SceneGraphRenderLoopFrame) { + if (type.detailType() == SceneGraphRenderLoopFrame) { if (msg.timestamp() >= contextFrameTime) { // Make sure SceneGraphRenderLoopFrame is not between SceneGraphContextFrame and // SceneGraphRendererFrame. A SceneGraphRenderLoopFrame before everything else is @@ -664,8 +659,7 @@ void tst_QQmlProfilerService::signalSourceLocation() auto createType = [](int line, int column) { return QQmlProfilerEventType( - QQmlProfilerDefinitions::MaximumMessage, - QQmlProfilerDefinitions::HandlingSignal, -1, + MaximumMessage, HandlingSignal, -1, QQmlProfilerEventLocation(QLatin1String("signalSourceLocation.qml"), line, column)); }; @@ -684,23 +678,21 @@ void tst_QQmlProfilerService::javascript() checkTraceReceived(); checkJsHeap(); - VERIFY(MessageListJavaScript, 2, QQmlProfilerEventType(QQmlProfilerDefinitions::MaximumMessage, - QQmlProfilerDefinitions::Javascript), + VERIFY(MessageListJavaScript, 2, QQmlProfilerEventType(MaximumMessage, Javascript), CheckMessageType | CheckDetailType | CheckNumbers, m_rangeStart); VERIFY(MessageListJavaScript, 3, - QQmlProfilerEventType(QQmlProfilerDefinitions::MaximumMessage, - QQmlProfilerDefinitions::Javascript, -1, - QQmlProfilerEventLocation(QLatin1String("javascript.qml"), 4, 5)), + QQmlProfilerEventType( + MaximumMessage, Javascript, -1, + QQmlProfilerEventLocation(QLatin1String("javascript.qml"), 4, 5)), CheckType | CheckNumbers, m_rangeStart); VERIFY(MessageListJavaScript, 4, QQmlProfilerEventType( - QQmlProfilerDefinitions::MaximumMessage, QQmlProfilerDefinitions::Javascript, -1, + MaximumMessage, Javascript, -1, QQmlProfilerEventLocation(), QLatin1String("something")), CheckMessageType | CheckDetailType | CheckDataEndsWith | CheckNumbers, m_rangeStart); - VERIFY(MessageListJavaScript, 10, QQmlProfilerEventType(QQmlProfilerDefinitions::MaximumMessage, - QQmlProfilerDefinitions::Javascript), + VERIFY(MessageListJavaScript, 10, QQmlProfilerEventType(MaximumMessage, Javascript), CheckMessageType | CheckDetailType | CheckNumbers, m_rangeEnd); } @@ -726,8 +718,7 @@ void tst_QQmlProfilerService::translationBinding() checkTraceReceived(); checkJsHeap(); - const QQmlProfilerEventType type(QQmlProfilerDefinitions::MaximumMessage, - QQmlProfilerDefinitions::Binding); + const QQmlProfilerEventType type(MaximumMessage, Binding); VERIFY(MessageListQML, 4, type, CheckDetailType | CheckMessageType | CheckNumbers, m_rangeStart); @@ -746,7 +737,7 @@ void tst_QQmlProfilerService::memory() int smallItems = 0; for (auto message : m_client->jsHeapMessages) { const QQmlProfilerEventType &type = m_client->types[message.typeIndex()]; - if (type.detailType() == QV4::Profiling::SmallItem) + if (type.detailType() == SmallItem) ++smallItems; } @@ -756,8 +747,7 @@ void tst_QQmlProfilerService::memory() static bool hasCompileEvents(const QVector &types) { for (const QQmlProfilerEventType &type : types) { - if (type.message() == QQmlProfilerDefinitions::MaximumMessage - && type.rangeType() == QQmlProfilerDefinitions::Compiling) + if (type.message() == MaximumMessage && type.rangeType() == Compiling) return true; } return false; @@ -776,29 +766,29 @@ void tst_QQmlProfilerService::compile() checkTraceReceived(); checkJsHeap(); - QQmlProfilerDefinitions::Message rangeStage = QQmlProfilerDefinitions::MaximumMessage; + Message rangeStage = MaximumMessage; for (auto message : m_client->qmlMessages) { const QQmlProfilerEventType &type = m_client->types[message.typeIndex()]; - if (type.rangeType() == QQmlProfilerDefinitions::Compiling) { + if (type.rangeType() == Compiling) { switch (rangeStage) { - case QQmlProfilerDefinitions::MaximumMessage: - QCOMPARE(message.rangeStage(), QQmlProfilerDefinitions::RangeStart); + case MaximumMessage: + QCOMPARE(message.rangeStage(), RangeStart); break; - case QQmlProfilerDefinitions::RangeStart: - QCOMPARE(message.rangeStage(), QQmlProfilerDefinitions::RangeEnd); + case RangeStart: + QCOMPARE(message.rangeStage(), RangeEnd); break; default: QFAIL("Wrong range stage"); } rangeStage = message.rangeStage(); - QCOMPARE(type.message(), QQmlProfilerDefinitions::MaximumMessage); + QCOMPARE(type.message(), MaximumMessage); QCOMPARE(type.location().filename(), testFileUrl("test.qml").toString()); QCOMPARE(type.location().line(), 0); QCOMPARE(type.location().column(), 0); } } - QCOMPARE(rangeStage, QQmlProfilerDefinitions::RangeEnd); + QCOMPARE(rangeStage, RangeEnd); } QTEST_MAIN(tst_QQmlProfilerService) diff --git a/tools/qmlprofiler/qmlprofiler.pro b/tools/qmlprofiler/qmlprofiler.pro index a2522e9267..28e316b23a 100644 --- a/tools/qmlprofiler/qmlprofiler.pro +++ b/tools/qmlprofiler/qmlprofiler.pro @@ -1,4 +1,4 @@ -QT = qml-private network core qmldebug-private +QT = network core qmldebug-private CONFIG += no_import_scan SOURCES += main.cpp \ diff --git a/tools/qmlprofiler/qmlprofilerapplication.cpp b/tools/qmlprofiler/qmlprofilerapplication.cpp index 3ab6741afa..0b63a91e5b 100644 --- a/tools/qmlprofiler/qmlprofilerapplication.cpp +++ b/tools/qmlprofiler/qmlprofilerapplication.cpp @@ -70,8 +70,7 @@ static const char *features[] = { "debugmessages" }; -Q_STATIC_ASSERT(sizeof(features) == - QQmlProfilerDefinitions::MaximumProfileFeature * sizeof(char *)); +Q_STATIC_ASSERT(sizeof(features) == MaximumProfileFeature * sizeof(char *)); QmlProfilerApplication::QmlProfilerApplication(int &argc, char **argv) : QCoreApplication(argc, argv), @@ -164,7 +163,7 @@ void QmlProfilerApplication::parseArguments() parser.addOption(record); QStringList featureList; - for (int i = 0; i < QQmlProfilerDefinitions::MaximumProfileFeature; ++i) + for (int i = 0; i < MaximumProfileFeature; ++i) featureList << QLatin1String(features[i]); QCommandLineOption include(QLatin1String("include"), diff --git a/tools/qmlprofiler/qmlprofilerclient.h b/tools/qmlprofiler/qmlprofilerclient.h index b9d8ce241f..30f4a51751 100644 --- a/tools/qmlprofiler/qmlprofilerclient.h +++ b/tools/qmlprofiler/qmlprofilerclient.h @@ -30,7 +30,7 @@ #define QMLPROFILERCLIENT_H #include -#include +#include #include class QmlProfilerData; diff --git a/tools/qmlprofiler/qmlprofilerdata.cpp b/tools/qmlprofiler/qmlprofilerdata.cpp index 32e03298da..d5662a0182 100644 --- a/tools/qmlprofiler/qmlprofilerdata.cpp +++ b/tools/qmlprofiler/qmlprofilerdata.cpp @@ -50,8 +50,7 @@ static const char *RANGE_TYPE_STRINGS[] = { "Javascript" }; -Q_STATIC_ASSERT(sizeof(RANGE_TYPE_STRINGS) == - QQmlProfilerDefinitions::MaximumRangeType * sizeof(const char *)); +Q_STATIC_ASSERT(sizeof(RANGE_TYPE_STRINGS) == MaximumRangeType * sizeof(const char *)); static const char *MESSAGE_STRINGS[] = { "Event", @@ -66,8 +65,7 @@ static const char *MESSAGE_STRINGS[] = { "DebugMessage" }; -Q_STATIC_ASSERT(sizeof(MESSAGE_STRINGS) == - QQmlProfilerDefinitions::MaximumMessage * sizeof(const char *)); +Q_STATIC_ASSERT(sizeof(MESSAGE_STRINGS) == MaximumMessage * sizeof(const char *)); ///////////////////////////////////////////////////////////////// class QmlProfilerDataPrivate @@ -113,7 +111,7 @@ void QmlProfilerData::clear() setState(Empty); } -QString QmlProfilerData::qmlRangeTypeAsString(QQmlProfilerDefinitions::RangeType type) +QString QmlProfilerData::qmlRangeTypeAsString(RangeType type) { if (type * sizeof(char *) < sizeof(RANGE_TYPE_STRINGS)) return QLatin1String(RANGE_TYPE_STRINGS[type]); @@ -121,7 +119,7 @@ QString QmlProfilerData::qmlRangeTypeAsString(QQmlProfilerDefinitions::RangeType return QString::number(type); } -QString QmlProfilerData::qmlMessageAsString(QQmlProfilerDefinitions::Message type) +QString QmlProfilerData::qmlMessageAsString(Message type) { if (type * sizeof(char *) < sizeof(MESSAGE_STRINGS)) return QLatin1String(MESSAGE_STRINGS[type]); @@ -178,13 +176,13 @@ void QmlProfilerData::addEventType(const QQmlProfilerEventType &type) QString displayName; switch (type.message()) { - case QQmlProfilerDefinitions::Event: { + case Event: { switch (type.detailType()) { - case QQmlProfilerDefinitions::Mouse: - case QQmlProfilerDefinitions::Key: + case Mouse: + case Key: displayName = QString::fromLatin1("Input:%1").arg(type.detailType()); break; - case QQmlProfilerDefinitions::AnimationFrame: + case AnimationFrame: displayName = QString::fromLatin1("AnimationFrame"); break; default: @@ -192,29 +190,29 @@ void QmlProfilerData::addEventType(const QQmlProfilerEventType &type) } break; } - case QQmlProfilerDefinitions::RangeStart: - case QQmlProfilerDefinitions::RangeData: - case QQmlProfilerDefinitions::RangeLocation: - case QQmlProfilerDefinitions::RangeEnd: - case QQmlProfilerDefinitions::Complete: + case RangeStart: + case RangeData: + case RangeLocation: + case RangeEnd: + case Complete: Q_UNREACHABLE(); break; - case QQmlProfilerDefinitions::PixmapCacheEvent: { + case PixmapCacheEvent: { const QString filePath = QUrl(type.location().filename()).path(); displayName = filePath.midRef(filePath.lastIndexOf(QLatin1Char('/')) + 1) + QLatin1Char(':') + QString::number(type.detailType()); break; } - case QQmlProfilerDefinitions::SceneGraphFrame: + case SceneGraphFrame: displayName = QString::fromLatin1("SceneGraph:%1").arg(type.detailType()); break; - case QQmlProfilerDefinitions::MemoryAllocation: + case MemoryAllocation: displayName = QString::fromLatin1("MemoryAllocation:%1").arg(type.detailType()); break; - case QQmlProfilerDefinitions::DebugMessage: + case DebugMessage: displayName = QString::fromLatin1("DebugMessage:%1").arg(type.detailType()); break; - case QQmlProfilerDefinitions::MaximumMessage: { + case MaximumMessage: { const QQmlProfilerEventLocation eventLocation = type.location(); // generate hash if (eventLocation.filename().isEmpty()) { @@ -241,21 +239,21 @@ void QmlProfilerData::computeQmlTime() for (const QQmlProfilerEvent &event : qAsConst(d->events)) { const QQmlProfilerEventType &type = d->eventTypes.at(event.typeIndex()); - if (type.message() != QQmlProfilerDefinitions::MaximumMessage) + if (type.message() != MaximumMessage) continue; switch (type.rangeType()) { - case QQmlProfilerDefinitions::Compiling: - case QQmlProfilerDefinitions::Creating: - case QQmlProfilerDefinitions::Binding: - case QQmlProfilerDefinitions::HandlingSignal: - case QQmlProfilerDefinitions::Javascript: + case Compiling: + case Creating: + case Binding: + case HandlingSignal: + case Javascript: switch (event.rangeStage()) { - case QQmlProfilerDefinitions::RangeStart: + case RangeStart: if (level++ == 0) level0Start = event.timestamp(); break; - case QQmlProfilerDefinitions::RangeEnd: + case RangeEnd: if (--level == 0) d->qmlMeasuredTime += event.timestamp() - level0Start; break; @@ -430,8 +428,7 @@ bool QmlProfilerData::save(const QString &filename) if (!eventData.displayName().isEmpty()) stream.writeTextElement("displayname", eventData.displayName()); - stream.writeTextElement("type", - eventData.rangeType() == QQmlProfilerDefinitions::MaximumRangeType + stream.writeTextElement("type", eventData.rangeType() == MaximumRangeType ? qmlMessageAsString(eventData.message()) : qmlRangeTypeAsString(eventData.rangeType())); @@ -444,25 +441,25 @@ bool QmlProfilerData::save(const QString &filename) stream.writeTextElement("column", location.column()); if (!eventData.data().isEmpty()) stream.writeTextElement("details", eventData.data()); - if (eventData.rangeType() == QQmlProfilerDefinitions::Binding) + if (eventData.rangeType() == Binding) stream.writeTextElement("bindingType", eventData.detailType()); - else if (eventData.message() == QQmlProfilerDefinitions::Event) { + else if (eventData.message() == Event) { switch (eventData.detailType()) { - case QQmlProfilerDefinitions::AnimationFrame: + case AnimationFrame: stream.writeTextElement("animationFrame", eventData.detailType()); break; - case QQmlProfilerDefinitions::Key: + case Key: stream.writeTextElement("keyEvent", eventData.detailType()); break; - case QQmlProfilerDefinitions::Mouse: + case Mouse: stream.writeTextElement("mouseEvent", eventData.detailType()); break; } - } else if (eventData.message() == QQmlProfilerDefinitions::PixmapCacheEvent) + } else if (eventData.message() == PixmapCacheEvent) stream.writeTextElement("cacheEventType", eventData.detailType()); - else if (eventData.message() == QQmlProfilerDefinitions::SceneGraphFrame) + else if (eventData.message() == SceneGraphFrame) stream.writeTextElement("sgEventType", eventData.detailType()); - else if (eventData.message() == QQmlProfilerDefinitions::MemoryAllocation) + else if (eventData.message() == MemoryAllocation) stream.writeTextElement("memoryEventType", eventData.detailType()); stream.writeEndElement(); } @@ -477,50 +474,49 @@ bool QmlProfilerData::save(const QString &filename) if (duration != 0) stream.writeAttribute("duration", duration); stream.writeAttribute("eventIndex", event.typeIndex()); - if (type.message() == QQmlProfilerDefinitions::Event) { - if (type.detailType() == QQmlProfilerDefinitions::AnimationFrame) { + if (type.message() == Event) { + if (type.detailType() == AnimationFrame) { // special: animation frame stream.writeAttribute("framerate", event, 0); stream.writeAttribute("animationcount", event, 1); stream.writeAttribute("thread", event, 2); - } else if (type.detailType() == QQmlProfilerDefinitions::Key || - type.detailType() == QQmlProfilerDefinitions::Mouse) { + } else if (type.detailType() == Key || type.detailType() == Mouse) { // numerical value here, to keep the format a bit more compact stream.writeAttribute("type", event, 0); stream.writeAttribute("data1", event, 1); stream.writeAttribute("data2", event, 2); } - } else if (type.message() == QQmlProfilerDefinitions::PixmapCacheEvent) { + } else if (type.message() == PixmapCacheEvent) { // special: pixmap cache event - if (type.detailType() == QQmlProfilerDefinitions::PixmapSizeKnown) { + if (type.detailType() == PixmapSizeKnown) { stream.writeAttribute("width", event, 0); stream.writeAttribute("height", event, 1); - } else if (type.detailType() == QQmlProfilerDefinitions::PixmapReferenceCountChanged - || type.detailType() == QQmlProfilerDefinitions::PixmapCacheCountChanged) { + } else if (type.detailType() == PixmapReferenceCountChanged + || type.detailType() == PixmapCacheCountChanged) { stream.writeAttribute("refCount", event, 1); } - } else if (type.message() == QQmlProfilerDefinitions::SceneGraphFrame) { + } else if (type.message() == SceneGraphFrame) { stream.writeAttribute("timing1", event, 0, false); stream.writeAttribute("timing2", event, 1, false); stream.writeAttribute("timing3", event, 2, false); stream.writeAttribute("timing4", event, 3, false); stream.writeAttribute("timing5", event, 4, false); - } else if (type.message() == QQmlProfilerDefinitions::MemoryAllocation) { + } else if (type.message() == MemoryAllocation) { stream.writeAttribute("amount", event, 0); } stream.writeEndElement(); }; QQueue pointEvents; - QQueue rangeStarts[QQmlProfilerDefinitions::MaximumRangeType]; - QStack rangeEnds[QQmlProfilerDefinitions::MaximumRangeType]; + QQueue rangeStarts[MaximumRangeType]; + QStack rangeEnds[MaximumRangeType]; int level = 0; auto sendPending = [&]() { forever { - int minimum = QQmlProfilerDefinitions::MaximumRangeType; + int minimum = MaximumRangeType; qint64 minimumTime = std::numeric_limits::max(); - for (int i = 0; i < QQmlProfilerDefinitions::MaximumRangeType; ++i) { + for (int i = 0; i < MaximumRangeType; ++i) { const QQueue &starts = rangeStarts[i]; if (starts.isEmpty()) continue; @@ -529,7 +525,7 @@ bool QmlProfilerData::save(const QString &filename) minimum = i; } } - if (minimum == QQmlProfilerDefinitions::MaximumRangeType) + if (minimum == MaximumRangeType) break; while (!pointEvents.isEmpty() && pointEvents.front().timestamp() < minimumTime) @@ -543,15 +539,15 @@ bool QmlProfilerData::save(const QString &filename) for (const QQmlProfilerEvent &event : qAsConst(d->events)) { const QQmlProfilerEventType &type = d->eventTypes.at(event.typeIndex()); - if (type.rangeType() != QQmlProfilerDefinitions::MaximumRangeType) { + if (type.rangeType() != MaximumRangeType) { QQueue &starts = rangeStarts[type.rangeType()]; switch (event.rangeStage()) { - case QQmlProfilerDefinitions::RangeStart: { + case RangeStart: { ++level; starts.enqueue(event); break; } - case QQmlProfilerDefinitions::RangeEnd: { + case RangeEnd: { QStack &ends = rangeEnds[type.rangeType()]; if (starts.length() > ends.length()) { ends.push(event.timestamp()); @@ -571,7 +567,7 @@ bool QmlProfilerData::save(const QString &filename) } } - for (int i = 0; i < QQmlProfilerDefinitions::MaximumRangeType; ++i) { + for (int i = 0; i < MaximumRangeType; ++i) { while (rangeEnds[i].length() < rangeStarts[i].length()) { rangeEnds[i].push(d->traceEndTime); --level; diff --git a/tools/qmlprofiler/qmlprofilerdata.h b/tools/qmlprofiler/qmlprofilerdata.h index 2be0b73aee..16ebc37f28 100644 --- a/tools/qmlprofiler/qmlprofilerdata.h +++ b/tools/qmlprofiler/qmlprofilerdata.h @@ -29,7 +29,7 @@ #ifndef QMLPROFILERDATA_H #define QMLPROFILERDATA_H -#include +#include #include #include @@ -55,8 +55,8 @@ public: void addEvent(const QQmlProfilerEvent &event) override; static QString getHashStringForQmlEvent(const QQmlProfilerEventLocation &location, int eventType); - static QString qmlRangeTypeAsString(QQmlProfilerDefinitions::RangeType type); - static QString qmlMessageAsString(QQmlProfilerDefinitions::Message type); + static QString qmlRangeTypeAsString(RangeType type); + static QString qmlMessageAsString(Message type); qint64 traceStartTime() const; qint64 traceEndTime() const; -- cgit v1.2.3 From 5cc8db797a88a0b2654876e768ba9cdebc053534 Mon Sep 17 00:00:00 2001 From: Jesus Fernandez Date: Mon, 5 Feb 2018 17:20:08 +0100 Subject: Use different buffer for indices and vertices only in the WebGL plugin This patch partially reverts 098ba086530ccd555369a9ea88f3c6668726ab81. Only QtWebGL will use separate buffers for indices and vertices. This patch gives a performance boost. Task-number: QTBUG-66191 Task-number: QTBUG-67147 Change-Id: I58b4db2bdf44cd954390e85e079de82031caf9e5 Reviewed-by: Edward Welbourne Reviewed-by: Qt CI Bot --- src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp | 117 ++++++++-------------- src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h | 10 +- src/quick/scenegraph/qsgdefaultrendercontext.cpp | 12 +++ src/quick/scenegraph/qsgdefaultrendercontext_p.h | 3 +- src/quick/scenegraph/scenegraph.pri | 1 - 5 files changed, 54 insertions(+), 89 deletions(-) diff --git a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp index ba71551302..afe3380494 100644 --- a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp +++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp @@ -775,9 +775,7 @@ Renderer::Renderer(QSGDefaultRenderContext *ctx) , m_currentClip(nullptr) , m_currentClipType(NoClip) , m_vertexUploadPool(256) -#ifdef QSG_SEPARATE_INDEX_BUFFER , m_indexUploadPool(64) -#endif , m_vao(nullptr) , m_visualizeMode(VisualizeNothing) { @@ -834,12 +832,11 @@ static void qsg_wipeBuffer(Buffer *buffer, QOpenGLFunctions *funcs) free(buffer->data); } -static void qsg_wipeBatch(Batch *batch, QOpenGLFunctions *funcs) +static void qsg_wipeBatch(Batch *batch, QOpenGLFunctions *funcs, bool separateIndexBuffer) { qsg_wipeBuffer(&batch->vbo, funcs); -#ifdef QSG_SEPARATE_INDEX_BUFFER - qsg_wipeBuffer(&batch->ibo, funcs); -#endif + if (separateIndexBuffer) + qsg_wipeBuffer(&batch->ibo, funcs); delete batch; } @@ -847,9 +844,13 @@ Renderer::~Renderer() { if (QOpenGLContext::currentContext()) { // Clean up batches and buffers - for (int i=0; iseparateIndexBuffer(); + for (int i = 0; i < m_opaqueBatches.size(); ++i) + qsg_wipeBatch(m_opaqueBatches.at(i), this, separateIndexBuffer); + for (int i = 0; i < m_alphaBatches.size(); ++i) + qsg_wipeBatch(m_alphaBatches.at(i), this, separateIndexBuffer); + for (int i = 0; i < m_batchPool.size(); ++i) + qsg_wipeBatch(m_batchPool.at(i), this, separateIndexBuffer); } for (Node *n : qAsConst(m_nodes)) @@ -889,13 +890,8 @@ void Renderer::map(Buffer *buffer, int byteSize, bool isIndexBuf) if (!m_context->hasBrokenIndexBufferObjects() && m_visualizeMode == VisualizeNothing) { // Common case, use a shared memory pool for uploading vertex data to avoid // excessive reevaluation - QDataBuffer &pool = -#ifdef QSG_SEPARATE_INDEX_BUFFER - isIndexBuf ? m_indexUploadPool : m_vertexUploadPool; -#else - m_vertexUploadPool; - Q_UNUSED(isIndexBuf); -#endif + QDataBuffer &pool = m_context->separateIndexBuffer() && isIndexBuf + ? m_indexUploadPool : m_vertexUploadPool; if (byteSize > pool.size()) pool.resize(byteSize); buffer->data = pool.data(); @@ -1864,11 +1860,11 @@ void Renderer::uploadBatch(Batch *b) ibufferSize = unmergedIndexSize; } -#ifdef QSG_SEPARATE_INDEX_BUFFER - map(&b->ibo, ibufferSize, true); -#else - bufferSize += ibufferSize; -#endif + const bool separateIndexBuffer = m_context->separateIndexBuffer(); + if (separateIndexBuffer) + map(&b->ibo, ibufferSize, true); + else + bufferSize += ibufferSize; map(&b->vbo, bufferSize); if (Q_UNLIKELY(debug_upload())) qDebug() << " - batch" << b << " first:" << b->first << " root:" @@ -1878,22 +1874,17 @@ void Renderer::uploadBatch(Batch *b) if (b->merged) { char *vertexData = b->vbo.data; char *zData = vertexData + b->vertexCount * g->sizeOfVertex(); -#ifdef QSG_SEPARATE_INDEX_BUFFER - char *indexData = b->ibo.data; -#else - char *indexData = zData + (m_useDepthBuffer ? b->vertexCount * sizeof(float) : 0); -#endif + char *indexData = separateIndexBuffer + ? b->ibo.data + : zData + (int(m_useDepthBuffer) * b->vertexCount * sizeof(float)); quint16 iOffset = 0; e = b->first; int verticesInSet = 0; int indicesInSet = 0; b->drawSets.reset(); -#ifdef QSG_SEPARATE_INDEX_BUFFER - int drawSetIndices = 0; -#else - int drawSetIndices = indexData - vertexData; -#endif + int drawSetIndices = separateIndexBuffer ? 0 : indexData - vertexData; + const auto indexBase = separateIndexBuffer ? b->ibo.data : b->vbo.data; b->drawSets << DrawSet(0, zData - vertexData, drawSetIndices); while (e) { verticesInSet += e->node->geometry()->vertexCount(); @@ -1903,11 +1894,7 @@ void Renderer::uploadBatch(Batch *b) b->drawSets.last().indices += 1 * sizeof(quint16); b->drawSets.last().indexCount -= 2; } -#ifdef QSG_SEPARATE_INDEX_BUFFER - drawSetIndices = indexData - b->ibo.data; -#else - drawSetIndices = indexData - b->vbo.data; -#endif + drawSetIndices = indexData - indexBase; b->drawSets << DrawSet(vertexData - b->vbo.data, zData - b->vbo.data, drawSetIndices); @@ -1927,11 +1914,8 @@ void Renderer::uploadBatch(Batch *b) } } else { char *vboData = b->vbo.data; -#ifdef QSG_SEPARATE_INDEX_BUFFER - char *iboData = b->ibo.data; -#else - char *iboData = vboData + b->vertexCount * g->sizeOfVertex(); -#endif + char *iboData = separateIndexBuffer ? b->ibo.data + : vboData + b->vertexCount * g->sizeOfVertex(); Element *e = b->first; while (e) { QSGGeometry *g = e->node->geometry(); @@ -1979,12 +1963,9 @@ void Renderer::uploadBatch(Batch *b) } if (!b->drawSets.isEmpty()) { - const quint16 *id = -# ifdef QSG_SEPARATE_INDEX_BUFFER - (const quint16 *) (b->ibo.data); -# else - (const quint16 *) (b->vbo.data + b->drawSets.at(0).indices); -# endif + const quint16 *id = (const quint16 *)(separateIndexBuffer + ? b->ibo.data + : b->vbo.data + b->drawSets.at(0).indices); { QDebug iDump = qDebug(); iDump << " -- Index Data, count:" << b->indexCount; @@ -2004,9 +1985,8 @@ void Renderer::uploadBatch(Batch *b) #endif // QT_NO_DEBUG_OUTPUT unmap(&b->vbo); -#ifdef QSG_SEPARATE_INDEX_BUFFER - unmap(&b->ibo, true); -#endif + if (separateIndexBuffer) + unmap(&b->ibo, true); if (Q_UNLIKELY(debug_upload())) qDebug() << " --- vertex/index buffers unmapped, batch upload completed..."; @@ -2299,11 +2279,7 @@ void Renderer::renderMergedBatch(const Batch *batch) glBindBuffer(GL_ARRAY_BUFFER, batch->vbo.id); char *indexBase = nullptr; -#ifdef QSG_SEPARATE_INDEX_BUFFER - const Buffer *indexBuf = &batch->ibo; -#else - const Buffer *indexBuf = &batch->vbo; -#endif + const Buffer *indexBuf = m_context->separateIndexBuffer() ? &batch->ibo : &batch->vbo; if (m_context->hasBrokenIndexBufferObjects()) { indexBase = indexBuf->data; glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); @@ -2395,11 +2371,8 @@ void Renderer::renderUnmergedBatch(const Batch *batch) glBindBuffer(GL_ARRAY_BUFFER, batch->vbo.id); char *indexBase = nullptr; -#ifdef QSG_SEPARATE_INDEX_BUFFER - const Buffer *indexBuf = &batch->ibo; -#else - const Buffer *indexBuf = &batch->vbo; -#endif + const auto separateIndexBuffer = m_context->separateIndexBuffer(); + const Buffer *indexBuf = separateIndexBuffer ? &batch->ibo : &batch->vbo; if (batch->indexCount) { if (m_context->hasBrokenIndexBufferObjects()) { indexBase = indexBuf->data; @@ -2428,11 +2401,9 @@ void Renderer::renderUnmergedBatch(const Batch *batch) } int vOffset = 0; -#ifdef QSG_SEPARATE_INDEX_BUFFER char *iOffset = indexBase; -#else - char *iOffset = indexBase + batch->vertexCount * gn->geometry()->sizeOfVertex(); -#endif + if (!separateIndexBuffer) + iOffset += batch->vertexCount * gn->geometry()->sizeOfVertex(); QMatrix4x4 rootMatrix = batch->root ? qsg_matrixForRoot(batch->root) : QMatrix4x4(); @@ -2735,17 +2706,13 @@ void Renderer::render() if (Q_UNLIKELY(debug_render())) timeSorting = timer.restart(); int largestVBO = 0; -#ifdef QSG_SEPARATE_INDEX_BUFFER int largestIBO = 0; -#endif if (Q_UNLIKELY(debug_upload())) qDebug("Uploading Opaque Batches:"); for (int i=0; ivbo.size, largestVBO); -#ifdef QSG_SEPARATE_INDEX_BUFFER largestIBO = qMax(b->ibo.size, largestIBO); -#endif uploadBatch(b); } if (Q_UNLIKELY(debug_render())) timeUploadOpaque = timer.restart(); @@ -2756,18 +2723,14 @@ void Renderer::render() Batch *b = m_alphaBatches.at(i); uploadBatch(b); largestVBO = qMax(b->vbo.size, largestVBO); -#ifdef QSG_SEPARATE_INDEX_BUFFER largestIBO = qMax(b->ibo.size, largestIBO); -#endif } if (Q_UNLIKELY(debug_render())) timeUploadAlpha = timer.restart(); if (largestVBO * 2 < m_vertexUploadPool.size()) m_vertexUploadPool.resize(largestVBO * 2); -#ifdef QSG_SEPARATE_INDEX_BUFFER - if (largestIBO * 2 < m_indexUploadPool.size()) + if (m_context->separateIndexBuffer() && largestIBO * 2 < m_indexUploadPool.size()) m_indexUploadPool.resize(largestIBO * 2); -#endif renderBatches(); @@ -2978,14 +2941,12 @@ void Renderer::visualizeBatch(Batch *b) if (b->merged) { shader->setUniformValue(shader->matrix, matrix); + const auto &dataStart = m_context->separateIndexBuffer() ? b->ibo.data : b->vbo.data; for (int ds=0; dsdrawSets.size(); ++ds) { const DrawSet &set = b->drawSets.at(ds); glVertexAttribPointer(a.position, 2, a.type, false, g->sizeOfVertex(), (void *) (qintptr) (set.vertices)); -#ifdef QSG_SEPARATE_INDEX_BUFFER - glDrawElements(g->drawingMode(), set.indexCount, GL_UNSIGNED_SHORT, (void *) (qintptr) (b->ibo.data + set.indices)); -#else - glDrawElements(g->drawingMode(), set.indexCount, GL_UNSIGNED_SHORT, (void *) (qintptr) (b->vbo.data + set.indices)); -#endif + glDrawElements(g->drawingMode(), set.indexCount, GL_UNSIGNED_SHORT, + (void *)(qintptr)(dataStart + set.indices)); } } else { Element *e = b->first; diff --git a/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h b/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h index 918f3ce82c..12b48c1451 100644 --- a/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h +++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h @@ -433,9 +433,7 @@ struct Batch mutable uint uploadedThisFrame : 1; // solely for debugging purposes Buffer vbo; -#ifdef QSG_SEPARATE_INDEX_BUFFER Buffer ibo; -#endif QDataBuffer drawSets; }; @@ -738,9 +736,7 @@ private: ClipType m_currentClipType; QDataBuffer m_vertexUploadPool; -#ifdef QSG_SEPARATE_INDEX_BUFFER QDataBuffer m_indexUploadPool; -#endif // For minimal OpenGL core profile support QOpenGLVertexArrayObject *m_vao; @@ -760,10 +756,8 @@ Batch *Renderer::newBatch() m_batchPool.resize(size - 1); } else { b = new Batch(); - memset(&b->vbo, 0, sizeof(Buffer)); -#ifdef QSG_SEPARATE_INDEX_BUFFER - memset(&b->ibo, 0, sizeof(Buffer)); -#endif + Q_ASSERT(offsetof(Batch, ibo) == sizeof(Buffer) + offsetof(Batch, vbo)); + memset(&b->vbo, 0, sizeof(Buffer) * 2); // Clear VBO & IBO } b->init(); return b; diff --git a/src/quick/scenegraph/qsgdefaultrendercontext.cpp b/src/quick/scenegraph/qsgdefaultrendercontext.cpp index 7882496062..22e97a2dc9 100644 --- a/src/quick/scenegraph/qsgdefaultrendercontext.cpp +++ b/src/quick/scenegraph/qsgdefaultrendercontext.cpp @@ -39,6 +39,7 @@ #include "qsgdefaultrendercontext_p.h" +#include #include #include @@ -317,6 +318,17 @@ QSGDefaultRenderContext *QSGDefaultRenderContext::from(QOpenGLContext *context) return qobject_cast(context->property(QSG_RENDERCONTEXT_PROPERTY).value()); } +bool QSGDefaultRenderContext::separateIndexBuffer() const +{ + // WebGL: A given WebGLBuffer object may only be bound to one of + // the ARRAY_BUFFER or ELEMENT_ARRAY_BUFFER target in its + // lifetime. An attempt to bind a buffer object to the other + // target will generate an INVALID_OPERATION error, and the + // current binding will remain untouched. + static const bool isWebGL = qGuiApp->platformName().compare(QLatin1String("webgl")) == 0; + return isWebGL; +} + QSGDistanceFieldGlyphCache *QSGDefaultRenderContext::distanceFieldGlyphCache(const QRawFont &font) { QString key = fontKey(font); diff --git a/src/quick/scenegraph/qsgdefaultrendercontext_p.h b/src/quick/scenegraph/qsgdefaultrendercontext_p.h index eb62586a94..57aa4b4c90 100644 --- a/src/quick/scenegraph/qsgdefaultrendercontext_p.h +++ b/src/quick/scenegraph/qsgdefaultrendercontext_p.h @@ -95,6 +95,7 @@ public: bool hasBrokenIndexBufferObjects() const { return m_brokenIBOs; } int maxTextureSize() const override { return m_maxTextureSize; } + bool separateIndexBuffer() const; protected: static QString fontKey(const QRawFont &font); @@ -106,8 +107,6 @@ protected: bool m_serializedRender; bool m_attachToGLContext; QSGAtlasTexture::Manager *m_atlasManager; - - }; QT_END_NAMESPACE diff --git a/src/quick/scenegraph/scenegraph.pri b/src/quick/scenegraph/scenegraph.pri index 4fa3e7b6bf..4f98638487 100644 --- a/src/quick/scenegraph/scenegraph.pri +++ b/src/quick/scenegraph/scenegraph.pri @@ -1,4 +1,3 @@ -# DEFINES += QSG_SEPARATE_INDEX_BUFFER # DEFINES += QSG_DISTANCEFIELD_CACHE_DEBUG # Core API -- cgit v1.2.3 From ac6e893c5c7b43cfc50c25bebee1dfd4d3840124 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Mon, 23 Apr 2018 13:57:11 +0200 Subject: Make the shared test code independent of QtQml This enables us to drop the QML dependency from a number of tests. This is desirable because we want to test that we didn't do any incompatible changes to the debug framework. Change-Id: I937dd45d3079eac15c200c9d68bb4c911f61afc0 Reviewed-by: Simon Hausmann --- .../qdebugmessageservice/qdebugmessageservice.pro | 2 +- .../debugger/qpacketprotocol/qpacketprotocol.pro | 2 +- .../debugger/qqmldebuglocal/tst_qqmldebuglocal.cpp | 1 - .../qqmlenginecontrol/qqmlenginecontrol.pro | 2 +- .../qqmlenginedebuginspectorintegrationtest.pro | 2 +- .../qqmlenginedebugservice.pro | 2 +- .../qml/debugger/qqmlinspector/qqmlinspector.pro | 2 +- .../qqmlprofilerservice/qqmlprofilerservice.pro | 2 +- .../tst_qqmlprofilerservice.cpp | 1 - tests/auto/qml/debugger/shared/debugutil.cpp | 16 ++++++++---- .../qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp | 28 ++++++++++++++++++-- tests/auto/shared/util.cpp | 30 ---------------------- tests/auto/shared/util.h | 6 ----- 13 files changed, 44 insertions(+), 52 deletions(-) diff --git a/tests/auto/qml/debugger/qdebugmessageservice/qdebugmessageservice.pro b/tests/auto/qml/debugger/qdebugmessageservice/qdebugmessageservice.pro index 9cf323ba36..3f2c0ca390 100644 --- a/tests/auto/qml/debugger/qdebugmessageservice/qdebugmessageservice.pro +++ b/tests/auto/qml/debugger/qdebugmessageservice/qdebugmessageservice.pro @@ -1,6 +1,6 @@ CONFIG += testcase TARGET = tst_qdebugmessageservice -QT += qml network testlib gui-private core-private +QT += network testlib gui-private core-private osx:CONFIG -= app_bundle SOURCES += tst_qdebugmessageservice.cpp diff --git a/tests/auto/qml/debugger/qpacketprotocol/qpacketprotocol.pro b/tests/auto/qml/debugger/qpacketprotocol/qpacketprotocol.pro index b1e3835844..dc0120cd87 100644 --- a/tests/auto/qml/debugger/qpacketprotocol/qpacketprotocol.pro +++ b/tests/auto/qml/debugger/qpacketprotocol/qpacketprotocol.pro @@ -6,4 +6,4 @@ SOURCES += tst_qpacketprotocol.cpp include(../shared/debugutil.pri) -QT += qml network testlib gui-private core-private +QT += network testlib gui-private core-private diff --git a/tests/auto/qml/debugger/qqmldebuglocal/tst_qqmldebuglocal.cpp b/tests/auto/qml/debugger/qqmldebuglocal/tst_qqmldebuglocal.cpp index 9f0501241d..5b3c0c5240 100644 --- a/tests/auto/qml/debugger/qqmldebuglocal/tst_qqmldebuglocal.cpp +++ b/tests/auto/qml/debugger/qqmldebuglocal/tst_qqmldebuglocal.cpp @@ -32,7 +32,6 @@ #include #include -#include #include #include diff --git a/tests/auto/qml/debugger/qqmlenginecontrol/qqmlenginecontrol.pro b/tests/auto/qml/debugger/qqmlenginecontrol/qqmlenginecontrol.pro index 73455bd903..36957628b2 100644 --- a/tests/auto/qml/debugger/qqmlenginecontrol/qqmlenginecontrol.pro +++ b/tests/auto/qml/debugger/qqmlenginecontrol/qqmlenginecontrol.pro @@ -8,7 +8,7 @@ include(../shared/debugutil.pri) TESTDATA = data/* -QT += core qml testlib gui-private core-private +QT += core testlib gui-private core-private OTHER_FILES += \ data/test.qml \ diff --git a/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/qqmlenginedebuginspectorintegrationtest.pro b/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/qqmlenginedebuginspectorintegrationtest.pro index 5f58e5ec7f..54244c6d16 100644 --- a/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/qqmlenginedebuginspectorintegrationtest.pro +++ b/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/qqmlenginedebuginspectorintegrationtest.pro @@ -1,7 +1,7 @@ CONFIG += testcase TARGET = tst_qqmlenginedebuginspectorintegration -QT += qml testlib gui-private core-private +QT += testlib gui-private core-private osx:CONFIG -= app_bundle SOURCES += tst_qqmlenginedebuginspectorintegration.cpp diff --git a/tests/auto/qml/debugger/qqmlenginedebugservice/qqmlenginedebugservice.pro b/tests/auto/qml/debugger/qqmlenginedebugservice/qqmlenginedebugservice.pro index 33ee023c06..ed4224446e 100644 --- a/tests/auto/qml/debugger/qqmlenginedebugservice/qqmlenginedebugservice.pro +++ b/tests/auto/qml/debugger/qqmlenginedebugservice/qqmlenginedebugservice.pro @@ -10,4 +10,4 @@ include(../shared/debugutil.pri) DEFINES += QT_QML_DEBUG_NO_WARNING -QT += core-private qml-private quick-private testlib gui-private +QT += quick qml-private testlib diff --git a/tests/auto/qml/debugger/qqmlinspector/qqmlinspector.pro b/tests/auto/qml/debugger/qqmlinspector/qqmlinspector.pro index fd07255ae5..3d4473c693 100644 --- a/tests/auto/qml/debugger/qqmlinspector/qqmlinspector.pro +++ b/tests/auto/qml/debugger/qqmlinspector/qqmlinspector.pro @@ -1,7 +1,7 @@ CONFIG += testcase TARGET = tst_qqmlinspector -QT += qml testlib gui-private core-private +QT += testlib gui-private core-private osx:CONFIG -= app_bundle SOURCES += tst_qqmlinspector.cpp diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro b/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro index 7c78b5fcb3..2a685ed877 100644 --- a/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro +++ b/tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro @@ -8,7 +8,7 @@ include(../shared/debugutil.pri) TESTDATA = data/* -QT += core qml testlib testlib-private gui-private core-private +QT += testlib gui-private OTHER_FILES += \ data/pixmapCacheTest.qml \ diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp index a6fbdf41e4..3cb315b355 100644 --- a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp +++ b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp @@ -34,7 +34,6 @@ #include #include -#include #include #include diff --git a/tests/auto/qml/debugger/shared/debugutil.cpp b/tests/auto/qml/debugger/shared/debugutil.cpp index 8ecbe53822..b118b22c64 100644 --- a/tests/auto/qml/debugger/shared/debugutil.cpp +++ b/tests/auto/qml/debugger/shared/debugutil.cpp @@ -31,8 +31,6 @@ #include -#include - #include #include @@ -52,15 +50,23 @@ bool QQmlDebugTest::waitForSignal(QObject *receiver, const char *member, int tim QList QQmlDebugTest::createOtherClients(QQmlDebugConnection *connection) { QList ret; - foreach (const QString &service, QQmlDebuggingEnabler::debuggerServices()) { + + static const auto debuggerServices + = QStringList({"V8Debugger", "QmlDebugger", "DebugMessages"}); + static const auto inspectorServices + = QStringList({"QmlInspector"}); + static const auto profilerServices + = QStringList({"CanvasFrameRate", "EngineControl", "DebugMessages"}); + + for (const QString &service : debuggerServices) { if (!connection->client(service)) ret << new QQmlDebugClient(service, connection); } - foreach (const QString &service, QQmlDebuggingEnabler::inspectorServices()) { + for (const QString &service : inspectorServices) { if (!connection->client(service)) ret << new QQmlDebugClient(service, connection); } - foreach (const QString &service, QQmlDebuggingEnabler::profilerServices()) { + for (const QString &service : profilerServices) { if (!connection->client(service)) ret << new QQmlDebugClient(service, connection); } diff --git a/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp b/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp index fac3ff15fd..97ca3fa1de 100644 --- a/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp +++ b/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -332,6 +333,29 @@ void tst_qqmlmoduleplugin::remoteImportWithUnquotedUri() VERIFY_ERRORS(0); } +static QByteArray msgComponentError(const QQmlComponent &c, const QQmlEngine *engine /* = 0 */) +{ + QString result; + const QList errors = c.errors(); + QTextStream str(&result); + str << "Component '" << c.url().toString() << "' has " << errors.size() << " errors: '"; + for (int i = 0; i < errors.size(); ++i) { + if (i) + str << ", '"; + str << errors.at(i).toString() << '\''; + } + if (!engine) { + if (QQmlContext *context = c.creationContext()) + engine = context->engine(); + } + if (engine) { + str << " Import paths: (" << engine->importPathList().join(QStringLiteral(", ")) + << ") Plugin paths: (" << engine->pluginPathList().join(QStringLiteral(", ")) + << ')'; + } + return result.toLocal8Bit(); +} + // QTBUG-17324 void tst_qqmlmoduleplugin::importsMixedQmlCppPlugin() @@ -345,7 +369,7 @@ void tst_qqmlmoduleplugin::importsMixedQmlCppPlugin() QQmlComponent component(&engine, testFileUrl(QStringLiteral("importsMixedQmlCppPlugin.qml"))); QObject *o = component.create(); - QVERIFY2(o != nullptr, QQmlDataTest::msgComponentError(component, &engine)); + QVERIFY2(o != nullptr, msgComponentError(component, &engine)); QCOMPARE(o->property("test").toBool(), true); delete o; } @@ -354,7 +378,7 @@ void tst_qqmlmoduleplugin::importsMixedQmlCppPlugin() QQmlComponent component(&engine, testFileUrl(QStringLiteral("importsMixedQmlCppPlugin.2.qml"))); QObject *o = component.create(); - QVERIFY2(o != nullptr, QQmlDataTest::msgComponentError(component, &engine)); + QVERIFY2(o != nullptr, msgComponentError(component, &engine)); QCOMPARE(o->property("test").toBool(), true); QCOMPARE(o->property("test2").toBool(), true); delete o; diff --git a/tests/auto/shared/util.cpp b/tests/auto/shared/util.cpp index 96beb51612..189398f0c2 100644 --- a/tests/auto/shared/util.cpp +++ b/tests/auto/shared/util.cpp @@ -28,11 +28,6 @@ #include "util.h" -#include -#include -#include -#include -#include #include #include @@ -72,31 +67,6 @@ QString QQmlDataTest::testFile(const QString &fileName) const return result; } -QByteArray QQmlDataTest::msgComponentError(const QQmlComponent &c, - const QQmlEngine *engine /* = 0 */) -{ - QString result; - const QList errors = c.errors(); - QTextStream str(&result); - str << "Component '" << c.url().toString() << "' has " << errors.size() - << " errors: '"; - for (int i = 0; i < errors.size(); ++i) { - if (i) - str << ", '"; - str << errors.at(i).toString() << '\''; - - } - if (!engine) - if (QQmlContext *context = c.creationContext()) - engine = context->engine(); - if (engine) { - str << " Import paths: (" << engine->importPathList().join(QStringLiteral(", ")) - << ") Plugin paths: (" << engine->pluginPathList().join(QStringLiteral(", ")) - << ')'; - } - return result.toLocal8Bit(); -} - Q_GLOBAL_STATIC(QMutex, qQmlTestMessageHandlerMutex) QQmlTestMessageHandler *QQmlTestMessageHandler::m_instance = 0; diff --git a/tests/auto/shared/util.h b/tests/auto/shared/util.h index 33d7cbd1d0..6f3f0a06a8 100644 --- a/tests/auto/shared/util.h +++ b/tests/auto/shared/util.h @@ -35,9 +35,6 @@ #include #include -QT_FORWARD_DECLARE_CLASS(QQmlComponent) -QT_FORWARD_DECLARE_CLASS(QQmlEngine) - /* Base class for tests with data that are located in a "data" subfolder. */ class QQmlDataTest : public QObject @@ -61,9 +58,6 @@ public: static inline QQmlDataTest *instance() { return m_instance; } - static QByteArray msgComponentError(const QQmlComponent &, - const QQmlEngine *engine = 0); - public slots: virtual void initTestCase(); -- cgit v1.2.3 From 281c24d9169396a62f409de6dce3545f8d48ca8b Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Mon, 23 Apr 2018 13:13:31 +0200 Subject: Fix QQuickListViewPrivate::snapItemAt for lists with spacing If lists had spacing, snapping would have gaps where snapItemAt would return nullptr eventhough there were items above and below in the list. I.e. if we have a list with items of size 100, and a spacing of 100, and scroll to 110 (right below the first item), then the first item would fail because this is false: itemTop+itemSize()/2 >= pos (50 >= 110) And the next item (the one we should have snapped to), would fail because this is false: itemTop-prevItemSize/2 < pos (200-100/2 < 110) The meaning of first part was probably to see if the middle of the current item is inside the view. The meaning of the second part was probably to see if the middle of the previous item is outside the view. This patch refactors the code so it's more visible what's happening and fixes the bug by taking the spacing into account when computing the position of the halfway positions. Task-number: QTBUG-59852 Change-Id: I60eec0d16e91d2f22d70b97d11bcde5d88ac2997 Reviewed-by: Mitch Curtis --- src/quick/items/qquicklistview.cpp | 7 +++++- .../qquicklistview/data/snapToItemWithSpacing.qml | 18 +++++++++++++++ .../quick/qquicklistview/tst_qquicklistview.cpp | 26 ++++++++++++++++++++++ 3 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 tests/auto/quick/qquicklistview/data/snapToItemWithSpacing.qml diff --git a/src/quick/items/qquicklistview.cpp b/src/quick/items/qquicklistview.cpp index 33becd71ec..60f7efae12 100644 --- a/src/quick/items/qquicklistview.cpp +++ b/src/quick/items/qquicklistview.cpp @@ -538,8 +538,13 @@ FxViewItem *QQuickListViewPrivate::snapItemAt(qreal pos) qreal itemTop = item->position(); if (highlight && itemTop >= pos && item->endPosition() <= pos + highlight->size()) return item; - if (itemTop+item->size()/2 >= pos && itemTop-prevItemSize/2 < pos) + + // Middle of item and spacing (i.e. the middle of the distance between this item and the next + qreal halfwayToNextItem = itemTop + (item->size()+spacing) / 2; + qreal halfwayToPrevItem = itemTop - (prevItemSize+spacing) / 2; + if (halfwayToNextItem >= pos && halfwayToPrevItem < pos) snapItem = item; + prevItemSize = item->size(); } return snapItem; diff --git a/tests/auto/quick/qquicklistview/data/snapToItemWithSpacing.qml b/tests/auto/quick/qquicklistview/data/snapToItemWithSpacing.qml new file mode 100644 index 0000000000..50b5abb206 --- /dev/null +++ b/tests/auto/quick/qquicklistview/data/snapToItemWithSpacing.qml @@ -0,0 +1,18 @@ +import QtQuick 2.0 + +ListView { + width: 100 + height: 300 + snapMode: ListView.SnapToItem + spacing: 100 + model: 10 + delegate: Rectangle { + height: 100 + width: 100 + color: "blue" + Text { + anchors.centerIn: parent + text: index + } + } +} diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp index 8bc5575e34..4d3a665255 100644 --- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp +++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp @@ -176,6 +176,7 @@ private slots: void creationContext(); void snapToItem_data(); void snapToItem(); + void snapToItemWithSpacing_QTBUG_59852(); void snapOneItemResize_QTBUG_43555(); void snapOneItem_data(); void snapOneItem(); @@ -5197,6 +5198,31 @@ void tst_QQuickListView::snapToItem() releaseView(window); } +void tst_QQuickListView::snapToItemWithSpacing_QTBUG_59852() +{ + QQuickView *window = getView(); + + window->setSource(testFileUrl("snapToItemWithSpacing.qml")); + window->show(); + QVERIFY(QTest::qWaitForWindowExposed(window)); + + auto *listView = qobject_cast(window->rootObject()); + QVERIFY(listView); + + QTRY_COMPARE(QQuickItemPrivate::get(listView)->polishScheduled, false); + + // each item in the list is 100 pixels tall, and the spacing is 100 + + listView->setContentY(110); // this is right below the first item + listView->returnToBounds(); + QCOMPARE(listView->contentY(), 200); // the position of the second item + + listView->setContentY(60); // this is right below the middle of the first item + listView->returnToBounds(); + QCOMPARE(listView->contentY(), 0); // it's farther to go to the next item, so snaps to the first + + releaseView(window); +} void tst_QQuickListView::snapOneItemResize_QTBUG_43555() { -- cgit v1.2.3 From f95c18b04e260a633d7a1d7cb0d3aaca01f9782f Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Fri, 20 Apr 2018 14:02:48 +0200 Subject: Make the test pass on my high resolution screen Change-Id: I08e952fb8c19c21caf33ffb1cfdc260b533a01d9 Reviewed-by: Shawn Rutledge --- .../multipointtoucharea_interop/tst_multipointtoucharea_interop.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/quick/pointerhandlers/multipointtoucharea_interop/tst_multipointtoucharea_interop.cpp b/tests/auto/quick/pointerhandlers/multipointtoucharea_interop/tst_multipointtoucharea_interop.cpp index 8d8c915e39..4b096f9c3a 100644 --- a/tests/auto/quick/pointerhandlers/multipointtoucharea_interop/tst_multipointtoucharea_interop.cpp +++ b/tests/auto/quick/pointerhandlers/multipointtoucharea_interop/tst_multipointtoucharea_interop.cpp @@ -211,7 +211,7 @@ void tst_MptaInterop::touchesThenPinch() pinchStoleGrab = i; } qCDebug(lcPointerTests) << "pinch started after" << pinchStoleGrab << "moves; ended with scale" << pinch->scale() << "rot" << pinch->rotation(); - QTRY_VERIFY(pinch->rotation() > 8); + QTRY_VERIFY(pinch->rotation() > 4); QVERIFY(pinch->scale() > 1); // Press one more point (pinkie finger) -- cgit v1.2.3 From 22bb2f5b68dc9e3c3608629629460513bf213938 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Wed, 25 Apr 2018 15:04:38 +0200 Subject: Add handling of device pixel ratio to animated sprites MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I472f61241d1875daf0de0a597bf27c019314f48f Task-number: QTBUG-50119 Reviewed-by: Mitch Curtis Reviewed-by: Morten Johan Sørvig --- src/particles/qquickimageparticle.cpp | 2 +- src/quick/items/qquickanimatedsprite.cpp | 4 +- src/quick/items/qquickimagebase_p.h | 2 +- src/quick/items/qquicksprite.cpp | 7 ++- src/quick/items/qquicksprite_p.h | 12 ++++++ src/quick/items/qquickspriteengine.cpp | 50 ++++++++++++++-------- src/quick/items/qquickspritesequence.cpp | 2 +- .../adaptations/software/qsgsoftwarespritenode.cpp | 2 +- 8 files changed, 56 insertions(+), 25 deletions(-) diff --git a/src/particles/qquickimageparticle.cpp b/src/particles/qquickimageparticle.cpp index d2fb78d72a..abd7793a74 100644 --- a/src/particles/qquickimageparticle.cpp +++ b/src/particles/qquickimageparticle.cpp @@ -1321,7 +1321,7 @@ void QQuickImageParticle::finishBuildParticleNodes(QSGNode** node) m_material = SpriteMaterial::createMaterial(); if (imageLoaded) getState(m_material)->texture = QSGPlainTexture::fromImage(image); - getState(m_material)->animSheetSize = QSizeF(image.size()); + getState(m_material)->animSheetSize = QSizeF(image.size() / image.devicePixelRatioF()); if (m_spriteEngine) m_spriteEngine->setCount(m_count); Q_FALLTHROUGH(); diff --git a/src/quick/items/qquickanimatedsprite.cpp b/src/quick/items/qquickanimatedsprite.cpp index 190c48ac88..887c30f999 100644 --- a/src/quick/items/qquickanimatedsprite.cpp +++ b/src/quick/items/qquickanimatedsprite.cpp @@ -527,6 +527,8 @@ void QQuickAnimatedSprite::setSource(QUrl arg) Q_D(QQuickAnimatedSprite); if (d->m_sprite->m_source != arg) { + const qreal targetDevicePixelRatio = (window() ? window()->effectiveDevicePixelRatio() : qApp->devicePixelRatio()); + d->m_sprite->setDevicePixelRatio(targetDevicePixelRatio); d->m_sprite->setSource(arg); Q_EMIT sourceChanged(arg); reloadImage(); @@ -713,7 +715,7 @@ QSGSpriteNode* QQuickAnimatedSprite::initNode() QSGSpriteNode *node = d->sceneGraphContext()->createSpriteNode(); - d->m_sheetSize = QSize(image.size()); + d->m_sheetSize = QSize(image.size() / image.devicePixelRatioF()); node->setTexture(window()->createTextureFromImage(image)); d->m_spriteEngine->start(0); node->setTime(0.0f); diff --git a/src/quick/items/qquickimagebase_p.h b/src/quick/items/qquickimagebase_p.h index eb04a1d162..d8d0be9b8c 100644 --- a/src/quick/items/qquickimagebase_p.h +++ b/src/quick/items/qquickimagebase_p.h @@ -98,7 +98,7 @@ public: virtual void setAutoTransform(bool transform); bool autoTransform() const; - void resolve2xLocalFile(const QUrl &url, qreal targetDevicePixelRatio, QUrl *sourceUrl, qreal *sourceDevicePixelRatio); + static void resolve2xLocalFile(const QUrl &url, qreal targetDevicePixelRatio, QUrl *sourceUrl, qreal *sourceDevicePixelRatio); // Use a virtual rather than a signal->signal to avoid the huge // connect/conneciton overhead for this rare case. diff --git a/src/quick/items/qquicksprite.cpp b/src/quick/items/qquicksprite.cpp index 6b8567439b..8c59a68982 100644 --- a/src/quick/items/qquicksprite.cpp +++ b/src/quick/items/qquicksprite.cpp @@ -38,6 +38,7 @@ ****************************************************************************/ #include "qquicksprite_p.h" +#include "qquickimagebase_p.h" #include #include #include @@ -222,6 +223,7 @@ QQuickSprite::QQuickSprite(QObject *parent) , m_frameDuration(unsetDuration) , m_frameDurationVariation(0) , m_frameSync(false) + , m_devicePixelRatio(1.0) { } @@ -265,7 +267,10 @@ void QQuickSprite::startImageLoading() if (!e) qWarning() << "QQuickSprite: Cannot find QQmlEngine - this class is only for use in QML and may not work"; } - m_pix.load(e, m_source); + QUrl loadUrl = m_source; + QQuickImageBase::resolve2xLocalFile(m_source, m_devicePixelRatio, &loadUrl, &m_devicePixelRatio); + + m_pix.load(e, loadUrl); } } diff --git a/src/quick/items/qquicksprite_p.h b/src/quick/items/qquicksprite_p.h index 8e119a80a9..fab9e75190 100644 --- a/src/quick/items/qquicksprite_p.h +++ b/src/quick/items/qquicksprite_p.h @@ -168,6 +168,16 @@ public: return m_frameSync; } + void setDevicePixelRatio(qreal dpr) + { + m_devicePixelRatio = dpr; + } + + qreal devicePixelRatio() const + { + return m_devicePixelRatio; + } + Q_SIGNALS: void sourceChanged(QUrl arg); @@ -308,6 +318,7 @@ private: friend class QQuickAnimatedSprite; friend class QQuickSpriteEngine; friend class QQuickStochasticEngine; + int m_generatedCount; int m_framesPerRow; int m_rowY; @@ -325,6 +336,7 @@ private: int m_frameDuration; int m_frameDurationVariation; bool m_frameSync; + qreal m_devicePixelRatio; QQuickPixmap m_pix; }; diff --git a/src/quick/items/qquickspriteengine.cpp b/src/quick/items/qquickspriteengine.cpp index 1fd15e61e3..03f0fa94a4 100644 --- a/src/quick/items/qquickspriteengine.cpp +++ b/src/quick/items/qquickspriteengine.cpp @@ -390,6 +390,7 @@ QImage QQuickSpriteEngine::assembledImage(int maxSize) int w = 0; m_maxFrames = 0; m_imageStateCount = 0; + qreal pixelRatio = 1.0; for (QQuickSprite* state : qAsConst(m_sprites)) { if (state->frames() > m_maxFrames) @@ -413,6 +414,8 @@ QImage QQuickSpriteEngine::assembledImage(int maxSize) if (!state->m_frameHeight) state->m_frameHeight = img.height(); + pixelRatio = qMax(pixelRatio, state->devicePixelRatio()); + if (state->frames() * state->frameWidth() > maxSize){ struct helper{ static int divRoundUp(int a, int b){return (a+b-1)/b;} @@ -437,43 +440,58 @@ QImage QQuickSpriteEngine::assembledImage(int maxSize) } } + if (h > maxSize){ + qWarning() << "SpriteEngine: Too many animations to fit in one texture..."; + qWarning() << "SpriteEngine: Your texture max size today is " << maxSize; + return QImage(); + } + //maxFrames is max number in a line of the texture - QImage image(w, h, QImage::Format_ARGB32_Premultiplied); + QImage image(w * pixelRatio, h * pixelRatio, QImage::Format_ARGB32_Premultiplied); + image.setDevicePixelRatio(pixelRatio); image.fill(0); QPainter p(&image); int y = 0; for (QQuickSprite* state : qAsConst(m_sprites)) { QImage img(state->m_pix.image()); - int frameWidth = state->m_frameWidth; - int frameHeight = state->m_frameHeight; - if (img.height() == frameHeight && img.width() < maxSize){//Simple case - p.drawImage(0,y,img.copy(state->m_frameX,0,state->m_frames * frameWidth, frameHeight)); + const int frameWidth = state->m_frameWidth; + const int frameHeight = state->m_frameHeight; + const int imgHeight = img.height() / state->devicePixelRatio(); + const int imgWidth = img.width() / state->devicePixelRatio(); + if (imgHeight == frameHeight && imgWidth < maxSize){ //Simple case + p.drawImage(QRect(0, y, state->m_frames * frameWidth, frameHeight), + img, + QRect(state->m_frameX * state->devicePixelRatio(), 0, state->m_frames * frameWidth * state->devicePixelRatio(), frameHeight * state->devicePixelRatio())); state->m_rowStartX = 0; state->m_rowY = y; y += frameHeight; - }else{//Chopping up image case - state->m_framesPerRow = image.width()/frameWidth; + } else { //Chopping up image case + state->m_framesPerRow = w/frameWidth; state->m_rowY = y; int x = 0; int curX = state->m_frameX; int curY = state->m_frameY; int framesLeft = state->frames(); while (framesLeft > 0){ - if (image.width() - x + curX <= img.width()){//finish a row in image (dest) - int copied = image.width() - x; + if (w - x + curX <= imgWidth){//finish a row in image (dest) + int copied = w - x; framesLeft -= copied/frameWidth; - p.drawImage(x,y,img.copy(curX,curY,copied,frameHeight)); + p.drawImage(QRect(x, y, copied, frameHeight), + img, + QRect(curX * state->devicePixelRatio(), curY * state->devicePixelRatio(), copied * state->devicePixelRatio(), frameHeight * state->devicePixelRatio())); y += frameHeight; curX += copied; x = 0; - if (curX == img.width()){ + if (curX == imgWidth){ curX = 0; curY += frameHeight; } }else{//finish a row in img (src) - int copied = img.width() - curX; + int copied = imgWidth - curX; framesLeft -= copied/frameWidth; - p.drawImage(x,y,img.copy(curX,curY,copied,frameHeight)); + p.drawImage(QRect(x, y, copied, frameHeight), + img, + QRect(curX * state->devicePixelRatio(), curY * state->devicePixelRatio(), copied * state->devicePixelRatio(), frameHeight * state->devicePixelRatio())); curY += frameHeight; x += copied; curX = 0; @@ -484,12 +502,6 @@ QImage QQuickSpriteEngine::assembledImage(int maxSize) } } - if (image.height() > maxSize){ - qWarning() << "SpriteEngine: Too many animations to fit in one texture..."; - qWarning() << "SpriteEngine: Your texture max size today is " << maxSize; - return QImage(); - } - #ifdef SPRITE_IMAGE_DEBUG QString fPath = QDir::tempPath() + "/SpriteImage.%1.png"; int acc = 0; diff --git a/src/quick/items/qquickspritesequence.cpp b/src/quick/items/qquickspritesequence.cpp index 72761ab82b..df6a6e336e 100644 --- a/src/quick/items/qquickspritesequence.cpp +++ b/src/quick/items/qquickspritesequence.cpp @@ -226,7 +226,7 @@ QSGSpriteNode *QQuickSpriteSequence::initNode() QSGSpriteNode *node = d->sceneGraphContext()->createSpriteNode(); - d->m_sheetSize = QSize(image.size()); + d->m_sheetSize = QSize(image.size() / image.devicePixelRatioF()); node->setTexture(window()->createTextureFromImage(image)); d->m_spriteEngine->start(0); node->setTime(0.0f); diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwarespritenode.cpp b/src/quick/scenegraph/adaptations/software/qsgsoftwarespritenode.cpp index ba7bbc2d11..d4e5e98d68 100644 --- a/src/quick/scenegraph/adaptations/software/qsgsoftwarespritenode.cpp +++ b/src/quick/scenegraph/adaptations/software/qsgsoftwarespritenode.cpp @@ -123,7 +123,7 @@ void QSGSoftwareSpriteNode::paint(QPainter *painter) // XXX try to do some kind of interpolation between sourceA and sourceB using time painter->drawPixmap(QRectF(0, 0, m_size.width(), m_size.height()), pixmap, - QRectF(m_sourceA, m_spriteSize)); + QRectF(m_sourceA * pixmap.devicePixelRatioF(), m_spriteSize * pixmap.devicePixelRatioF())); } bool QSGSoftwareSpriteNode::isOpaque() const -- cgit v1.2.3 From dd1b13a50b55652253cc04cc3fa52d2280f1da56 Mon Sep 17 00:00:00 2001 From: Kimmo Ollila Date: Wed, 25 Apr 2018 12:57:55 +0300 Subject: Enable JIT on INTEGRITY ARM64 This patch enables JIT on INTEGRITY s820Am and other ARM64 builds Change-Id: I2fa130f41a6c5bc6aa86bcfd5a01c2d431300561 Reviewed-by: Simon Hausmann Reviewed-by: Nikola Velinov --- src/3rdparty/masm/assembler/ARM64Assembler.h | 6 ++++++ src/3rdparty/masm/stubs/ExecutableAllocator.h | 8 ++++++++ src/3rdparty/masm/wtf/OSAllocator.h | 4 ++++ src/3rdparty/masm/wtf/OSAllocatorIntegrity.cpp | 12 ++++++++++++ src/3rdparty/masm/wtf/Platform.h | 5 +++++ src/qml/jsruntime/qv4global_p.h | 2 +- 6 files changed, 36 insertions(+), 1 deletion(-) diff --git a/src/3rdparty/masm/assembler/ARM64Assembler.h b/src/3rdparty/masm/assembler/ARM64Assembler.h index 008f03bccf..1787e921e8 100644 --- a/src/3rdparty/masm/assembler/ARM64Assembler.h +++ b/src/3rdparty/masm/assembler/ARM64Assembler.h @@ -39,6 +39,10 @@ #include #endif +#if OS(INTEGRITY) +#include +#endif + #define CHECK_DATASIZE_OF(datasize) ASSERT(datasize == 32 || datasize == 64) #define DATASIZE_OF(datasize) ((datasize == 64) ? Datasize_64 : Datasize_32) #define MEMOPSIZE_OF(datasize) ((datasize == 8 || datasize == 128) ? MemOpSize_8_or_128 : (datasize == 16) ? MemOpSize_16 : (datasize == 32) ? MemOpSize_32 : MemOpSize_64) @@ -3039,6 +3043,8 @@ public: UNUSED_PARAM(code); UNUSED_PARAM(size); #endif +#elif OS(INTEGRITY) + ManageCaches((Address)code, size, ACCESS_DST_COHERENT); #else #error "The cacheFlush support is missing on this platform." #endif diff --git a/src/3rdparty/masm/stubs/ExecutableAllocator.h b/src/3rdparty/masm/stubs/ExecutableAllocator.h index 3b84b5c986..1ab28588fb 100644 --- a/src/3rdparty/masm/stubs/ExecutableAllocator.h +++ b/src/3rdparty/masm/stubs/ExecutableAllocator.h @@ -45,6 +45,10 @@ #include +#if OS(INTEGRITY) +#include "OSAllocator.h" +#endif + #if OS(WINDOWS) #include #else @@ -118,6 +122,8 @@ struct ExecutableAllocator { Q_UNREACHABLE(); } # endif +# elif OS(INTEGRITY) + OSAllocator::setMemoryAttributes(addr, /*writable*/ true, /*executable*/ false); # else int mode = PROT_READ | PROT_WRITE; if (mprotect(addr, size, mode) != 0) { @@ -152,6 +158,8 @@ struct ExecutableAllocator { Q_UNREACHABLE(); } # endif +# elif OS(INTEGRITY) + OSAllocator::setMemoryAttributes(addr, /*writable*/ false, /*executable*/ true); # else int mode = PROT_READ | PROT_EXEC; if (mprotect(addr, size, mode) != 0) { diff --git a/src/3rdparty/masm/wtf/OSAllocator.h b/src/3rdparty/masm/wtf/OSAllocator.h index 933b3cda0a..366dd73993 100644 --- a/src/3rdparty/masm/wtf/OSAllocator.h +++ b/src/3rdparty/masm/wtf/OSAllocator.h @@ -73,6 +73,10 @@ public: static T* reallocateCommitted(T*, size_t oldSize, size_t newSize, Usage = UnknownUsage, bool writable = true, bool executable = false); static bool canAllocateExecutableMemory(); + +#if defined(Q_OS_INTEGRITY) + static void setMemoryAttributes(void* addr, bool writable, bool executable); +#endif }; inline void* OSAllocator::reserveAndCommit(size_t reserveSize, size_t commitSize, Usage usage, bool writable, bool executable) diff --git a/src/3rdparty/masm/wtf/OSAllocatorIntegrity.cpp b/src/3rdparty/masm/wtf/OSAllocatorIntegrity.cpp index 451ca147d1..7addf9e5c2 100644 --- a/src/3rdparty/masm/wtf/OSAllocatorIntegrity.cpp +++ b/src/3rdparty/masm/wtf/OSAllocatorIntegrity.cpp @@ -123,6 +123,12 @@ Error setAttributes(MemoryRegion mr, bool writable, bool executable) return SetMemoryRegionAttributes(mr, attributes); } +void OSAllocator::setMemoryAttributes(void* addr, bool writable, bool executable) +{ + const MRPair* pair = memoryRegionsContainer.getMRPair((Address)addr); + CheckSuccess(setAttributes(pair->vmr, writable, executable)); +} + void* OSAllocator::reserveUncommitted(size_t bytes, Usage usage, bool writable, bool executable) { MemoryRegion VMR; @@ -229,4 +235,10 @@ void OSAllocator::releaseDecommitted(void* address, size_t bytes) memoryRegionsContainer.deleteMRPair(pair); } } + +bool OSAllocator::canAllocateExecutableMemory() +{ + return true; +} + } // namespace WTF diff --git a/src/3rdparty/masm/wtf/Platform.h b/src/3rdparty/masm/wtf/Platform.h index 4f37245495..5905f42f45 100644 --- a/src/3rdparty/masm/wtf/Platform.h +++ b/src/3rdparty/masm/wtf/Platform.h @@ -171,6 +171,11 @@ #define WTF_CPU_ARM64 1 #endif +/* CPU(ARM64) - INTEGRITY */ +#if (defined(__ARM64__)) +#define WTF_CPU_ARM64 1 +#endif + /* CPU(ARM) - ARM, any version*/ #define WTF_ARM_ARCH_AT_LEAST(N) (CPU(ARM) && WTF_ARM_ARCH_VERSION >= N) diff --git a/src/qml/jsruntime/qv4global_p.h b/src/qml/jsruntime/qv4global_p.h index 9b13d4e341..1fa4bae049 100644 --- a/src/qml/jsruntime/qv4global_p.h +++ b/src/qml/jsruntime/qv4global_p.h @@ -101,7 +101,7 @@ inline double trunc(double d) { return d > 0 ? floor(d) : ceil(d); } # define V4_ENABLE_JIT # endif #elif defined(Q_PROCESSOR_ARM_64) && (QT_POINTER_SIZE == 8) -# if defined(Q_OS_LINUX) || defined(Q_OS_QNX) +# if defined(Q_OS_LINUX) || defined(Q_OS_QNX) || defined(Q_OS_INTEGRITY) # define V4_ENABLE_JIT # endif //#elif defined(Q_PROCESSOR_MIPS_32) && defined(Q_OS_LINUX) -- cgit v1.2.3 From 4b27062f5fae891850fd0f048f2a2421ca9b6c7c Mon Sep 17 00:00:00 2001 From: Kimmo Ollila Date: Wed, 25 Apr 2018 13:25:45 +0300 Subject: Fix JIT build on INTEGRITY ARM64 -typedef "Jump" may not be used in an elaborated type specifier -explicit specialization of function must precede its first use -"Value" is ambiguous Change-Id: Ic15c196f1b33211cd3f2f25a54ba478747336fe4 Reviewed-by: Simon Hausmann Reviewed-by: Janne Koskinen Reviewed-by: Nikola Velinov --- .../masm/assembler/AbstractMacroAssembler.h | 6 + src/3rdparty/masm/assembler/MacroAssemblerARM64.h | 203 ++++++++++++--------- src/qml/jsapi/qjsvalue.cpp | 8 +- src/qml/jsruntime/qv4qobjectwrapper.cpp | 10 +- src/qml/jsruntime/qv4stringobject.cpp | 4 +- src/qml/jsruntime/qv4vme_moth.cpp | 74 ++++---- 6 files changed, 173 insertions(+), 132 deletions(-) diff --git a/src/3rdparty/masm/assembler/AbstractMacroAssembler.h b/src/3rdparty/masm/assembler/AbstractMacroAssembler.h index 6fac27fdf1..1076384900 100644 --- a/src/3rdparty/masm/assembler/AbstractMacroAssembler.h +++ b/src/3rdparty/masm/assembler/AbstractMacroAssembler.h @@ -327,7 +327,13 @@ public: template friend class AbstractMacroAssembler; friend struct DFG::OSRExit; + +#if CPU(ARM_THUMB2) || CPU(ARM64) || defined(V4_BOOTSTRAP) + using Jump = typename AssemblerType::template Jump