Changeset View
Changeset View
Standalone View
Standalone View
composite.cpp
Show First 20 Lines • Show All 201 Lines • ▼ Show 20 Line(s) | 199 | case OpenGLCompositing: { | |||
---|---|---|---|---|---|
202 | // Some broken drivers crash on glXQuery() so to prevent constant KWin crashes: | 202 | // Some broken drivers crash on glXQuery() so to prevent constant KWin crashes: | ||
203 | if (kwinApp()->platform()->openGLCompositingIsBroken()) | 203 | if (kwinApp()->platform()->openGLCompositingIsBroken()) | ||
204 | qCWarning(KWIN_CORE) << "KWin has detected that your OpenGL library is unsafe to use"; | 204 | qCWarning(KWIN_CORE) << "KWin has detected that your OpenGL library is unsafe to use"; | ||
205 | else { | 205 | else { | ||
206 | kwinApp()->platform()->createOpenGLSafePoint(Platform::OpenGLSafePoint::PreInit); | 206 | kwinApp()->platform()->createOpenGLSafePoint(Platform::OpenGLSafePoint::PreInit); | ||
207 | 207 | | |||
208 | m_scene = SceneOpenGL::createScene(this); | 208 | m_scene = SceneOpenGL::createScene(this); | ||
209 | 209 | | |||
210 | // TODO: Add 30 second delay to protect against screen freezes as well | | |||
211 | kwinApp()->platform()->createOpenGLSafePoint(Platform::OpenGLSafePoint::PostInit); | 210 | kwinApp()->platform()->createOpenGLSafePoint(Platform::OpenGLSafePoint::PostInit); | ||
212 | 211 | | |||
213 | if (m_scene && !m_scene->initFailed()) { | 212 | if (m_scene && !m_scene->initFailed()) { | ||
214 | connect(static_cast<SceneOpenGL*>(m_scene), &SceneOpenGL::resetCompositing, this, &Compositor::restart); | 213 | connect(static_cast<SceneOpenGL*>(m_scene), &SceneOpenGL::resetCompositing, this, &Compositor::restart); | ||
215 | break; // --> | 214 | break; // --> | ||
216 | } | 215 | } | ||
217 | delete m_scene; | 216 | delete m_scene; | ||
218 | m_scene = NULL; | 217 | m_scene = NULL; | ||
▲ Show 20 Lines • Show All 70 Lines • ▼ Show 20 Line(s) | |||||
289 | } | 288 | } | ||
290 | 289 | | |||
291 | void Compositor::startupWithWorkspace() | 290 | void Compositor::startupWithWorkspace() | ||
292 | { | 291 | { | ||
293 | if (!m_starting) { | 292 | if (!m_starting) { | ||
294 | return; | 293 | return; | ||
295 | } | 294 | } | ||
296 | Q_ASSERT(m_scene); | 295 | Q_ASSERT(m_scene); | ||
296 | m_firstFrame = true; | ||||
297 | connect(workspace(), &Workspace::destroyed, this, [this] { compositeTimer.stop(); }); | 297 | connect(workspace(), &Workspace::destroyed, this, [this] { compositeTimer.stop(); }); | ||
298 | claimCompositorSelection(); | 298 | claimCompositorSelection(); | ||
299 | m_xrrRefreshRate = KWin::currentRefreshRate(); | 299 | m_xrrRefreshRate = KWin::currentRefreshRate(); | ||
300 | fpsInterval = options->maxFpsInterval(); | 300 | fpsInterval = options->maxFpsInterval(); | ||
301 | if (m_scene->syncsToVBlank()) { // if we do vsync, set the fps to the next multiple of the vblank rate | 301 | if (m_scene->syncsToVBlank()) { // if we do vsync, set the fps to the next multiple of the vblank rate | ||
302 | vBlankInterval = milliToNano(1000) / m_xrrRefreshRate; | 302 | vBlankInterval = milliToNano(1000) / m_xrrRefreshRate; | ||
303 | fpsInterval = qMax((fpsInterval / vBlankInterval) * vBlankInterval, vBlankInterval); | 303 | fpsInterval = qMax((fpsInterval / vBlankInterval) * vBlankInterval, vBlankInterval); | ||
304 | } else | 304 | } else | ||
▲ Show 20 Lines • Show All 424 Lines • ▼ Show 20 Line(s) | 726 | if (waylandServer() && waylandServer()->isScreenLocked()) { | |||
729 | } | 729 | } | ||
730 | } | 730 | } | ||
731 | } | 731 | } | ||
732 | 732 | | |||
733 | QRegion repaints = repaints_region; | 733 | QRegion repaints = repaints_region; | ||
734 | // clear all repaints, so that post-pass can add repaints for the next repaint | 734 | // clear all repaints, so that post-pass can add repaints for the next repaint | ||
735 | repaints_region = QRegion(); | 735 | repaints_region = QRegion(); | ||
736 | 736 | | |||
737 | if (m_firstFrame && (m_scene->compositingType() & OpenGLCompositing)) { | ||||
738 | kwinApp()->platform()->createOpenGLSafePoint(Platform::OpenGLSafePoint::PreFirstFrame); | ||||
739 | } | ||||
737 | m_timeSinceLastVBlank = m_scene->paint(repaints, windows); | 740 | m_timeSinceLastVBlank = m_scene->paint(repaints, windows); | ||
741 | if (m_firstFrame) { | ||||
742 | if (m_scene->compositingType() & OpenGLCompositing) { | ||||
743 | kwinApp()->platform()->createOpenGLSafePoint(Platform::OpenGLSafePoint::PostFirstFrame); | ||||
744 | } | ||||
745 | m_firstFrame = false; | ||||
746 | } | ||||
738 | m_timeSinceStart += m_timeSinceLastVBlank; | 747 | m_timeSinceStart += m_timeSinceLastVBlank; | ||
739 | 748 | | |||
740 | if (waylandServer()) { | 749 | if (waylandServer()) { | ||
741 | for (Toplevel *win : damaged) { | 750 | for (Toplevel *win : damaged) { | ||
742 | if (auto surface = win->surface()) { | 751 | if (auto surface = win->surface()) { | ||
743 | surface->frameRendered(m_timeSinceStart); | 752 | surface->frameRendered(m_timeSinceStart); | ||
744 | } | 753 | } | ||
745 | } | 754 | } | ||
▲ Show 20 Lines • Show All 454 Lines • Show Last 20 Lines |