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_wallClock.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 601 Lines • ▼ Show 20 Line(s) | 706 | foreach (Toplevel *win, damaged) { | |||
714 | } | 714 | } | ||
715 | 715 | | |||
716 | win->getDamageRegionReply(); | 716 | win->getDamageRegionReply(); | ||
717 | } | 717 | } | ||
718 | 718 | | |||
719 | if (repaints_region.isEmpty() && !windowRepaintsPending()) { | 719 | if (repaints_region.isEmpty() && !windowRepaintsPending()) { | ||
720 | m_scene->idle(); | 720 | m_scene->idle(); | ||
721 | m_timeSinceLastVBlank = fpsInterval - (options->vBlankTime() + 1); // means "start now" | 721 | m_timeSinceLastVBlank = fpsInterval - (options->vBlankTime() + 1); // means "start now" | ||
722 | m_timeSinceStart += m_timeSinceLastVBlank; | | |||
723 | // Note: It would seem here we should undo suspended unredirect, but when scenes need | 722 | // Note: It would seem here we should undo suspended unredirect, but when scenes need | ||
724 | // it for some reason, e.g. transformations or translucency, the next pass that does not | 723 | // it for some reason, e.g. transformations or translucency, the next pass that does not | ||
725 | // need this anymore and paints normally will also reset the suspended unredirect. | 724 | // need this anymore and paints normally will also reset the suspended unredirect. | ||
726 | // Otherwise the window would not be painted normally anyway. | 725 | // Otherwise the window would not be painted normally anyway. | ||
727 | compositeTimer.stop(); | 726 | compositeTimer.stop(); | ||
728 | return; | 727 | return; | ||
729 | } | 728 | } | ||
730 | 729 | | |||
Show All 25 Lines | 754 | if (m_framesToTestForSafety > 0) { | |||
756 | if (m_scene->compositingType() & OpenGLCompositing) { | 755 | if (m_scene->compositingType() & OpenGLCompositing) { | ||
757 | kwinApp()->platform()->createOpenGLSafePoint(Platform::OpenGLSafePoint::PostFrame); | 756 | kwinApp()->platform()->createOpenGLSafePoint(Platform::OpenGLSafePoint::PostFrame); | ||
758 | } | 757 | } | ||
759 | m_framesToTestForSafety--; | 758 | m_framesToTestForSafety--; | ||
760 | if (m_framesToTestForSafety == 0 && (m_scene->compositingType() & OpenGLCompositing)) { | 759 | if (m_framesToTestForSafety == 0 && (m_scene->compositingType() & OpenGLCompositing)) { | ||
761 | kwinApp()->platform()->createOpenGLSafePoint(Platform::OpenGLSafePoint::PostLastGuardedFrame); | 760 | kwinApp()->platform()->createOpenGLSafePoint(Platform::OpenGLSafePoint::PostLastGuardedFrame); | ||
762 | } | 761 | } | ||
763 | } | 762 | } | ||
764 | m_timeSinceStart += m_timeSinceLastVBlank; | | |||
765 | 763 | | |||
766 | if (waylandServer()) { | 764 | if (waylandServer()) { | ||
765 | const auto currentTime = static_cast<quint32>(m_wallClock.elapsed()); | ||||
767 | for (Toplevel *win : qAsConst(windows)) { | 766 | for (Toplevel *win : qAsConst(windows)) { | ||
768 | if (auto surface = win->surface()) { | 767 | if (auto surface = win->surface()) { | ||
769 | surface->frameRendered(m_timeSinceStart); | 768 | surface->frameRendered(currentTime); | ||
770 | } | 769 | } | ||
771 | } | 770 | } | ||
772 | } | 771 | } | ||
773 | 772 | | |||
774 | compositeTimer.stop(); // stop here to ensure *we* cause the next repaint schedule - not some effect through m_scene->paint() | 773 | compositeTimer.stop(); // stop here to ensure *we* cause the next repaint schedule - not some effect through m_scene->paint() | ||
775 | 774 | | |||
776 | // Trigger at least one more pass even if there would be nothing to paint, so that scene->idle() | 775 | // Trigger at least one more pass even if there would be nothing to paint, so that scene->idle() | ||
777 | // is called the next time. If there would be nothing pending, it will not restart the timer and | 776 | // is called the next time. If there would be nothing pending, it will not restart the timer and | ||
▲ Show 20 Lines • Show All 438 Lines • Show Last 20 Lines |