Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qsgthreadedrenderloop_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
5#ifndef QSGTHREADEDRENDERLOOP_P_H
6#define QSGTHREADEDRENDERLOOP_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <QtCore/QThread>
20#include <QtCore/QElapsedTimer>
21#include <private/qsgcontext_p.h>
22
24
26
27class QSGRenderThread;
28
30{
32public:
35
36 void show(QQuickWindow *) override {}
37 void hide(QQuickWindow *) override;
38 void resize(QQuickWindow *window) override;
39
40 void windowDestroyed(QQuickWindow *window) override;
41 void exposureChanged(QQuickWindow *window) override;
42
43 QImage grab(QQuickWindow *) override;
44
45 void update(QQuickWindow *window) override;
46 void maybeUpdate(QQuickWindow *window) override;
47 void handleUpdateRequest(QQuickWindow *window) override;
48
49 QSGContext *sceneGraphContext() const override;
50 QSGRenderContext *createRenderContext(QSGContext *) const override;
51
52 QAnimationDriver *animationDriver() const override;
53
54 void releaseResources(QQuickWindow *window) override;
55
56 bool event(QEvent *) override;
57 void postJob(QQuickWindow *window, QRunnable *job) override;
58
59 bool interleaveIncubation() const override;
60
61public Q_SLOTS:
62 void animationStarted();
63 void animationStopped();
64
65private:
66 struct Window {
67 QQuickWindow *window;
68 QSGRenderThread *thread;
69 QSurfaceFormat actualWindowFormat;
70 QElapsedTimer timeBetweenPolishAndSyncs;
71 float psTimeAccumulator;
72 int psTimeSampleCount;
73 uint updateDuringSync : 1;
74 uint forceRenderPass : 1;
75 uint badVSync : 1;
76 };
77
78 friend class QSGRenderThread;
79
80
81 Window *windowFor(QQuickWindow *window);
82 void releaseResources(Window *window, bool inDestructor);
83 bool checkAndResetForceUpdate(QQuickWindow *window);
84
85 bool anyoneShowing() const;
86 void initialize();
87
88 void startOrStopAnimationTimer();
89 void postUpdateRequest(Window *w);
90 void waitForReleaseComplete();
91 void polishAndSync(Window *w, bool inExpose = false);
92 void maybeUpdate(Window *window);
93
94 void handleExposure(QQuickWindow *w);
95 void handleObscurity(Window *w);
96 void releaseSwapchain(QQuickWindow *window);
97
98 bool eventFilter(QObject *watched, QEvent *event) override;
99
100 QSGContext *sg;
101 // Set of contexts that have been created but are now owned by
102 // a rendering thread yet, as the window has never been exposed.
103 mutable QSet<QSGRenderContext*> pendingRenderContexts;
104 QAnimationDriver *m_animation_driver;
105 QList<Window> m_windows;
106
107 int m_animation_timer;
108
109 bool m_lockedForSync;
110 bool m_inPolish = false;
111};
112
113QT_END_NAMESPACE
114
115#endif // QSGTHREADEDRENDERLOOP_P_H
QAnimationDriver * animationDriver() const override
void update(QQuickWindow *window) override
void renderWindow(QQuickWindow *window)
void releaseSwapchain(QQuickWindow *window)
void show(QQuickWindow *window) override
bool eventFilter(QObject *watched, QEvent *event) override
Filters events if this object has been installed as an event filter for the watched object.
QSGRenderContext * createRenderContext(QSGContext *) const override
void windowDestroyed(QQuickWindow *window) override
bool ensureRhi(QQuickWindow *window, WindowData &data)
QOffscreenSurface * offscreenSurface
void releaseResources(QQuickWindow *) override
void exposureChanged(QQuickWindow *window) override
QSGContext * sceneGraphContext() const override
QHash< QQuickWindow *, WindowData > m_windows
QSet< QSGRenderContext * > pendingRenderContexts
void handleUpdateRequest(QQuickWindow *) override
void hide(QQuickWindow *window) override
QImage grab(QQuickWindow *window) override
void maybeUpdate(QQuickWindow *window) override
bool interleaveIncubation() const override
bool event(QEvent *) override
This virtual function receives events to an object and should return true if the event e was recogniz...
QImage grab(QQuickWindow *) override
QSGRenderContext * createRenderContext(QSGContext *) const override
void show(QQuickWindow *) override
bool eventFilter(QObject *watched, QEvent *event) override
Filters events if this object has been installed as an event filter for the watched object.
void postJob(QQuickWindow *window, QRunnable *job) override
QSGContext * sceneGraphContext() const override
void resize(QQuickWindow *window) override
void update(QQuickWindow *window) override
void handleUpdateRequest(QQuickWindow *window) override
QAnimationDriver * animationDriver() const override
void maybeUpdate(QQuickWindow *window) override
void exposureChanged(QQuickWindow *window) override
void releaseResources(QQuickWindow *window) override
void hide(QQuickWindow *) override
void windowDestroyed(QQuickWindow *window) override
Combined button and popup list for selecting options.
bool qsg_useConsistentTiming()
#define ENABLE_DEFAULT_BACKEND
QSGRenderLoopType
@ BasicRenderLoop
@ ThreadedRenderLoop
QSGCustomEvents
@ WM_Exposed
@ WM_Obscure
@ WM_Grab
@ WM_PostJob
@ WM_TryRelease
@ WM_ReleaseSwapchain
@ WM_RequestSync
DEFINE_BOOL_CONFIG_OPTION(forceDiskCache, QML_FORCE_DISK_CACHE)