diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2021-12-22 11:18:03 +0100 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2022-01-04 23:00:24 +0100 |
commit | bb111c7d52eba2f74cefe31e8f3e87c3daca340e (patch) | |
tree | f0a3e1a7ebc6ebdd633915eeb94b070b68c61efe | |
parent | 146afc851d3c26bb029e879a0a04f29c28c81d44 (diff) |
scenegraph: Remove the experimental rhi profiler integration
This infrastructure is going away from QtGui.
Change-Id: I8231716c1fd053dbb25ca62ef0ade0963ad0f8a4
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
-rw-r--r-- | src/quick/scenegraph/qsgrenderloop.cpp | 6 | ||||
-rw-r--r-- | src/quick/scenegraph/qsgrhisupport.cpp | 58 | ||||
-rw-r--r-- | src/quick/scenegraph/qsgrhisupport_p.h | 29 | ||||
-rw-r--r-- | src/quick/scenegraph/qsgthreadedrenderloop.cpp | 4 |
4 files changed, 0 insertions, 97 deletions
diff --git a/src/quick/scenegraph/qsgrenderloop.cpp b/src/quick/scenegraph/qsgrenderloop.cpp index e591dad2f9..ca82f520e1 100644 --- a/src/quick/scenegraph/qsgrenderloop.cpp +++ b/src/quick/scenegraph/qsgrenderloop.cpp @@ -108,7 +108,6 @@ void QSGRenderLoop::cleanup() #ifdef ENABLE_DEFAULT_BACKEND QSGRhiSupport::cleanupDefaultVulkanInstance(); - QSGRhiProfileConnection::instance()->cleanup(); #endif } @@ -463,9 +462,6 @@ bool QSGGuiThreadRenderLoop::ensureRhi(QQuickWindow *window, WindowData &data) ownRhi = rhiResult.own; if (rhi) { - if (rhiSupport->isProfilingRequested()) - QSGRhiProfileConnection::instance()->initialize(rhi); - data.rhiDeviceLost = false; ok = true; @@ -719,8 +715,6 @@ void QSGGuiThreadRenderLoop::renderWindow(QQuickWindow *window) int(data.timeBetweenRenders.restart())); } - QSGRhiProfileConnection::instance()->send(rhi); - // Might have been set during syncSceneGraph() if (data.updatePending) maybeUpdate(window); diff --git a/src/quick/scenegraph/qsgrhisupport.cpp b/src/quick/scenegraph/qsgrhisupport.cpp index 530ecbb9d7..8f63a5ede0 100644 --- a/src/quick/scenegraph/qsgrhisupport.cpp +++ b/src/quick/scenegraph/qsgrhisupport.cpp @@ -52,8 +52,6 @@ #include <QOperatingSystemVersion> #include <QOffscreenSurface> -#include <QtQml/private/qqmlengine_p.h> - QT_BEGIN_NAMESPACE #if QT_CONFIG(vulkan) @@ -967,60 +965,4 @@ QImage QSGRhiSupport::grabOffscreenForProtectedContent(QQuickWindow *window) } #endif -QSGRhiProfileConnection *QSGRhiProfileConnection::instance() -{ - static QSGRhiProfileConnection inst; - return &inst; -} - -void QSGRhiProfileConnection::initialize(QRhi *rhi) -{ -#ifdef RHI_REMOTE_PROFILER - const QString profHost = qEnvironmentVariable("QSG_RHI_PROFILE_HOST"); - if (!profHost.isEmpty()) { - if (!QQmlEnginePrivate::qml_debugging_enabled) { - qWarning("RHI profiling cannot be enabled without QML debugging, for security reasons. " - "Set CONFIG+=qml_debug in the application project."); - return; - } - int profPort = qEnvironmentVariableIntValue("QSG_RHI_PROFILE_PORT"); - if (!profPort) - profPort = 30667; - qCDebug(QSG_LOG_INFO, "Sending RHI profiling output to %s:%d", qPrintable(profHost), profPort); - m_profConn.reset(new QTcpSocket); - QObject::connect(m_profConn.data(), &QAbstractSocket::errorOccurred, m_profConn.data(), - [this](QAbstractSocket::SocketError socketError) { qWarning(" RHI profiler error: %d (%s)", - socketError, qPrintable(m_profConn->errorString())); }); - m_profConn->connectToHost(profHost, profPort); - m_profConn->waitForConnected(); // blocking wait because we want to send stuff already from the init below - rhi->profiler()->setDevice(m_profConn.data()); - m_lastMemStatWrite.start(); - } -#else - Q_UNUSED(rhi); -#endif -} - -void QSGRhiProfileConnection::cleanup() -{ -#ifdef RHI_REMOTE_PROFILER - m_profConn.reset(); -#endif -} - -void QSGRhiProfileConnection::send(QRhi *rhi) -{ -#ifdef RHI_REMOTE_PROFILER - if (m_profConn) { - // do this every 5 sec at most - if (m_lastMemStatWrite.elapsed() >= 5000) { - rhi->profiler()->addVMemAllocatorStats(); - m_lastMemStatWrite.restart(); - } - } -#else - Q_UNUSED(rhi); -#endif -} - QT_END_NAMESPACE diff --git a/src/quick/scenegraph/qsgrhisupport_p.h b/src/quick/scenegraph/qsgrhisupport_p.h index 9e63b44917..28e94c9914 100644 --- a/src/quick/scenegraph/qsgrhisupport_p.h +++ b/src/quick/scenegraph/qsgrhisupport_p.h @@ -74,14 +74,6 @@ #include <QtGui/private/qrhimetal_p.h> #endif -#if QT_CONFIG(qml_network) -#define RHI_REMOTE_PROFILER -#include <QtCore/qelapsedtimer.h> -#include <QtCore/qscopedpointer.h> -#include <QtNetwork/qtcpsocket.h> -#include <QtGui/private/qrhiprofiler_p.h> -#endif - QT_BEGIN_NAMESPACE class QSGDefaultRenderContext; @@ -163,27 +155,6 @@ private: uint m_preferSoftwareRenderer : 1; }; -// Sends QRhi resource statistics over a QTcpSocket. To be initialized by the -// renderloop when QSGRhiSupport::isProfilingRequested() is true. From the -// applications' side this is enabled by setting the env.vars. QSG_RHI_PROFILE=1 -// and QSG_RHI_PROFILE_HOST=<address>. For security, this is also tied to -// CONFIG+=qml_debug in the application (just like QML debugging), so it won't -// be doing anything otherwise, even if the env vars are set. -class QSGRhiProfileConnection -{ -public: - static QSGRhiProfileConnection *instance(); - void initialize(QRhi *rhi); - void cleanup(); - void send(QRhi *rhi); - -private: -#ifdef RHI_REMOTE_PROFILER - QScopedPointer<QTcpSocket> m_profConn; - QElapsedTimer m_lastMemStatWrite; -#endif -}; - QT_END_NAMESPACE #endif // QSGRHISUPPORT_P_H diff --git a/src/quick/scenegraph/qsgthreadedrenderloop.cpp b/src/quick/scenegraph/qsgthreadedrenderloop.cpp index 07ce4806f1..985fd7fe0a 100644 --- a/src/quick/scenegraph/qsgthreadedrenderloop.cpp +++ b/src/quick/scenegraph/qsgthreadedrenderloop.cpp @@ -852,8 +852,6 @@ void QSGRenderThread::syncAndRender() Q_TRACE(QSG_swap_exit); Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphRenderLoopFrame, QQuickProfiler::SceneGraphRenderLoopSwap); - - QSGRhiProfileConnection::instance()->send(rhi); } @@ -900,8 +898,6 @@ void QSGRenderThread::ensureRhi() if (rhi) { rhiDeviceLost = false; rhiSampleCount = rhiSupport->chooseSampleCountForWindowWithRhi(window, rhi); - if (rhiSupport->isProfilingRequested()) - QSGRhiProfileConnection::instance()->initialize(rhi); // ### this breaks down with multiple windows } else { if (!rhiDeviceLost) { rhiDoomed = true; |