Changeset View
Changeset View
Standalone View
Standalone View
composite.cpp
Show First 20 Lines • Show All 129 Lines • ▼ Show 20 Line(s) | 97 | { | |||
---|---|---|---|---|---|
130 | ); | 130 | ); | ||
131 | connect(kwinApp(), &Application::x11ConnectionAboutToBeDestroyed, this, | 131 | connect(kwinApp(), &Application::x11ConnectionAboutToBeDestroyed, this, | ||
132 | [this] { | 132 | [this] { | ||
133 | delete cm_selection; | 133 | delete cm_selection; | ||
134 | cm_selection = nullptr; | 134 | cm_selection = nullptr; | ||
135 | } | 135 | } | ||
136 | ); | 136 | ); | ||
137 | 137 | | |||
138 | if (qEnvironmentVariableIsSet("KWIN_MAX_FRAMES_TESTED")) | ||||
139 | m_framesToTestForSafety = qEnvironmentVariableIntValue("KWIN_MAX_FRAMES_TESTED"); | ||||
140 | | ||||
138 | // register DBus | 141 | // register DBus | ||
139 | new CompositorDBusInterface(this); | 142 | new CompositorDBusInterface(this); | ||
140 | } | 143 | } | ||
141 | 144 | | |||
142 | Compositor::~Compositor() | 145 | Compositor::~Compositor() | ||
143 | { | 146 | { | ||
144 | emit aboutToDestroy(); | 147 | emit aboutToDestroy(); | ||
145 | AbstractEglBackend::unbindWaylandDisplay(); | 148 | AbstractEglBackend::unbindWaylandDisplay(); | ||
▲ Show 20 Lines • Show All 53 Lines • ▼ Show 20 Line(s) | 191 | { | |||
199 | case OpenGLCompositing: { | 202 | case OpenGLCompositing: { | ||
200 | qCDebug(KWIN_CORE) << "Initializing OpenGL compositing"; | 203 | qCDebug(KWIN_CORE) << "Initializing OpenGL compositing"; | ||
201 | 204 | | |||
202 | // Some broken drivers crash on glXQuery() so to prevent constant KWin crashes: | 205 | // Some broken drivers crash on glXQuery() so to prevent constant KWin crashes: | ||
203 | if (kwinApp()->platform()->openGLCompositingIsBroken()) | 206 | if (kwinApp()->platform()->openGLCompositingIsBroken()) | ||
204 | qCWarning(KWIN_CORE) << "KWin has detected that your OpenGL library is unsafe to use"; | 207 | qCWarning(KWIN_CORE) << "KWin has detected that your OpenGL library is unsafe to use"; | ||
205 | else { | 208 | else { | ||
206 | kwinApp()->platform()->createOpenGLSafePoint(Platform::OpenGLSafePoint::PreInit); | 209 | kwinApp()->platform()->createOpenGLSafePoint(Platform::OpenGLSafePoint::PreInit); | ||
207 | 210 | | |||
208 | m_scene = SceneOpenGL::createScene(this); | 211 | m_scene = SceneOpenGL::createScene(this); | ||
209 | 212 | | |||
210 | // TODO: Add 30 second delay to protect against screen freezes as well | | |||
211 | kwinApp()->platform()->createOpenGLSafePoint(Platform::OpenGLSafePoint::PostInit); | 213 | kwinApp()->platform()->createOpenGLSafePoint(Platform::OpenGLSafePoint::PostInit); | ||
212 | 214 | | |||
graesslin: why is the scene creation also guarded with PreFrame and PostLastFrame? Contextual that doesn't… | |||||
213 | if (m_scene && !m_scene->initFailed()) { | 215 | if (m_scene && !m_scene->initFailed()) { | ||
214 | connect(static_cast<SceneOpenGL*>(m_scene), &SceneOpenGL::resetCompositing, this, &Compositor::restart); | 216 | connect(static_cast<SceneOpenGL*>(m_scene), &SceneOpenGL::resetCompositing, this, &Compositor::restart); | ||
215 | break; // --> | 217 | break; // --> | ||
216 | } | 218 | } | ||
217 | delete m_scene; | 219 | delete m_scene; | ||
218 | m_scene = NULL; | 220 | m_scene = NULL; | ||
219 | } | 221 | } | ||
220 | 222 | | |||
▲ Show 20 Lines • Show All 508 Lines • ▼ Show 20 Line(s) | 728 | if (waylandServer() && waylandServer()->isScreenLocked()) { | |||
729 | } | 731 | } | ||
730 | } | 732 | } | ||
731 | } | 733 | } | ||
732 | 734 | | |||
733 | QRegion repaints = repaints_region; | 735 | QRegion repaints = repaints_region; | ||
734 | // clear all repaints, so that post-pass can add repaints for the next repaint | 736 | // clear all repaints, so that post-pass can add repaints for the next repaint | ||
735 | repaints_region = QRegion(); | 737 | repaints_region = QRegion(); | ||
736 | 738 | | |||
739 | if (m_framesToTestForSafety > 0 && (m_scene->compositingType() & OpenGLCompositing)) { | ||||
740 | kwinApp()->platform()->createOpenGLSafePoint(Platform::OpenGLSafePoint::PreFrame); | ||||
741 | } | ||||
737 | m_timeSinceLastVBlank = m_scene->paint(repaints, windows); | 742 | m_timeSinceLastVBlank = m_scene->paint(repaints, windows); | ||
743 | if (m_framesToTestForSafety > 0) { | ||||
744 | if (m_scene->compositingType() & OpenGLCompositing) { | ||||
745 | kwinApp()->platform()->createOpenGLSafePoint(Platform::OpenGLSafePoint::PostFrame); | ||||
746 | } | ||||
747 | m_framesToTestForSafety--; | ||||
748 | if (m_framesToTestForSafety == 0 && (m_scene->compositingType() & OpenGLCompositing)) { | ||||
graesslin: this misses the
if (m_scene->compositingType() & OpenGLCompositing) | |||||
luebking: also indention. | |||||
749 | kwinApp()->platform()->createOpenGLSafePoint(Platform::OpenGLSafePoint::PostLastGuardedFrame); | ||||
750 | } | ||||
751 | } | ||||
738 | m_timeSinceStart += m_timeSinceLastVBlank; | 752 | m_timeSinceStart += m_timeSinceLastVBlank; | ||
739 | 753 | | |||
740 | if (waylandServer()) { | 754 | if (waylandServer()) { | ||
741 | for (Toplevel *win : damaged) { | 755 | for (Toplevel *win : damaged) { | ||
742 | if (auto surface = win->surface()) { | 756 | if (auto surface = win->surface()) { | ||
743 | surface->frameRendered(m_timeSinceStart); | 757 | surface->frameRendered(m_timeSinceStart); | ||
744 | } | 758 | } | ||
745 | } | 759 | } | ||
▲ Show 20 Lines • Show All 454 Lines • Show Last 20 Lines |
why is the scene creation also guarded with PreFrame and PostLastFrame? Contextual that doesn't make sense as createScene doesn't render any frames.