Changeset View
Changeset View
Standalone View
Standalone View
composite.cpp
Show First 20 Lines • Show All 95 Lines • ▼ Show 20 Line(s) | 86 | Compositor::Compositor(QObject* workspace) | |||
---|---|---|---|---|---|
96 | , m_scene(NULL) | 96 | , m_scene(NULL) | ||
97 | , m_bufferSwapPending(false) | 97 | , m_bufferSwapPending(false) | ||
98 | , m_composeAtSwapCompletion(false) | 98 | , m_composeAtSwapCompletion(false) | ||
99 | { | 99 | { | ||
100 | qRegisterMetaType<Compositor::SuspendReason>("Compositor::SuspendReason"); | 100 | qRegisterMetaType<Compositor::SuspendReason>("Compositor::SuspendReason"); | ||
101 | connect(&compositeResetTimer, SIGNAL(timeout()), SLOT(restart())); | 101 | connect(&compositeResetTimer, SIGNAL(timeout()), SLOT(restart())); | ||
102 | connect(options, &Options::configChanged, this, &Compositor::slotConfigChanged); | 102 | connect(options, &Options::configChanged, this, &Compositor::slotConfigChanged); | ||
103 | compositeResetTimer.setSingleShot(true); | 103 | compositeResetTimer.setSingleShot(true); | ||
104 | nextPaintReference.invalidate(); // Initialize the timer | 104 | m_monotonicClock.start(); | ||
105 | 105 | | |||
106 | // 2 sec which should be enough to restart the compositor | 106 | // 2 sec which should be enough to restart the compositor | ||
107 | static const int compositorLostMessageDelay = 2000; | 107 | static const int compositorLostMessageDelay = 2000; | ||
108 | 108 | | |||
109 | m_releaseSelectionTimer.setSingleShot(true); | 109 | m_releaseSelectionTimer.setSingleShot(true); | ||
110 | m_releaseSelectionTimer.setInterval(compositorLostMessageDelay); | 110 | m_releaseSelectionTimer.setInterval(compositorLostMessageDelay); | ||
111 | connect(&m_releaseSelectionTimer, SIGNAL(timeout()), SLOT(releaseCompositorSelection())); | 111 | connect(&m_releaseSelectionTimer, SIGNAL(timeout()), SLOT(releaseCompositorSelection())); | ||
112 | 112 | | |||
▲ Show 20 Lines • Show All 609 Lines • ▼ Show 20 Line(s) | 714 | foreach (Toplevel *win, damaged) { | |||
722 | } | 722 | } | ||
723 | 723 | | |||
724 | win->getDamageRegionReply(); | 724 | win->getDamageRegionReply(); | ||
725 | } | 725 | } | ||
726 | 726 | | |||
727 | if (repaints_region.isEmpty() && !windowRepaintsPending()) { | 727 | if (repaints_region.isEmpty() && !windowRepaintsPending()) { | ||
728 | m_scene->idle(); | 728 | m_scene->idle(); | ||
729 | m_timeSinceLastVBlank = fpsInterval - (options->vBlankTime() + 1); // means "start now" | 729 | m_timeSinceLastVBlank = fpsInterval - (options->vBlankTime() + 1); // means "start now" | ||
730 | m_timeSinceStart += m_timeSinceLastVBlank; | | |||
731 | // Note: It would seem here we should undo suspended unredirect, but when scenes need | 730 | // Note: It would seem here we should undo suspended unredirect, but when scenes need | ||
732 | // it for some reason, e.g. transformations or translucency, the next pass that does not | 731 | // it for some reason, e.g. transformations or translucency, the next pass that does not | ||
733 | // need this anymore and paints normally will also reset the suspended unredirect. | 732 | // need this anymore and paints normally will also reset the suspended unredirect. | ||
734 | // Otherwise the window would not be painted normally anyway. | 733 | // Otherwise the window would not be painted normally anyway. | ||
735 | compositeTimer.stop(); | 734 | compositeTimer.stop(); | ||
736 | return; | 735 | return; | ||
737 | } | 736 | } | ||
738 | 737 | | |||
Show All 25 Lines | 762 | if (m_framesToTestForSafety > 0) { | |||
764 | if (m_scene->compositingType() & OpenGLCompositing) { | 763 | if (m_scene->compositingType() & OpenGLCompositing) { | ||
765 | kwinApp()->platform()->createOpenGLSafePoint(Platform::OpenGLSafePoint::PostFrame); | 764 | kwinApp()->platform()->createOpenGLSafePoint(Platform::OpenGLSafePoint::PostFrame); | ||
766 | } | 765 | } | ||
767 | m_framesToTestForSafety--; | 766 | m_framesToTestForSafety--; | ||
768 | if (m_framesToTestForSafety == 0 && (m_scene->compositingType() & OpenGLCompositing)) { | 767 | if (m_framesToTestForSafety == 0 && (m_scene->compositingType() & OpenGLCompositing)) { | ||
769 | kwinApp()->platform()->createOpenGLSafePoint(Platform::OpenGLSafePoint::PostLastGuardedFrame); | 768 | kwinApp()->platform()->createOpenGLSafePoint(Platform::OpenGLSafePoint::PostLastGuardedFrame); | ||
770 | } | 769 | } | ||
771 | } | 770 | } | ||
772 | m_timeSinceStart += m_timeSinceLastVBlank; | | |||
773 | 771 | | |||
774 | if (waylandServer()) { | 772 | if (waylandServer()) { | ||
773 | const auto currentTime = static_cast<quint32>(m_monotonicClock.elapsed()); | ||||
775 | for (Toplevel *win : qAsConst(windows)) { | 774 | for (Toplevel *win : qAsConst(windows)) { | ||
776 | if (auto surface = win->surface()) { | 775 | if (auto surface = win->surface()) { | ||
777 | surface->frameRendered(m_timeSinceStart); | 776 | surface->frameRendered(currentTime); | ||
778 | } | 777 | } | ||
779 | } | 778 | } | ||
780 | } | 779 | } | ||
781 | 780 | | |||
782 | compositeTimer.stop(); // stop here to ensure *we* cause the next repaint schedule - not some effect through m_scene->paint() | 781 | compositeTimer.stop(); // stop here to ensure *we* cause the next repaint schedule - not some effect through m_scene->paint() | ||
783 | 782 | | |||
784 | // Trigger at least one more pass even if there would be nothing to paint, so that scene->idle() | 783 | // Trigger at least one more pass even if there would be nothing to paint, so that scene->idle() | ||
785 | // is called the next time. If there would be nothing pending, it will not restart the timer and | 784 | // is called the next time. If there would be nothing pending, it will not restart the timer and | ||
▲ Show 20 Lines • Show All 430 Lines • Show Last 20 Lines |