From fafa22d0c60487639b01f06dc82aa73e2e7654ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Tue, 24 Feb 2015 11:50:01 +0100 Subject: [PATCH] [wayland] Invoke frame rendered callback on damaged windows Introduces a new time counter on Compositor to indicate the elapsed time sine the compositor started. --- composite.cpp | 16 ++++++++++++++++ composite.h | 1 + 2 files changed, 17 insertions(+) diff --git a/composite.cpp b/composite.cpp index 7c67b12700..a448ec5738 100644 --- a/composite.cpp +++ b/composite.cpp @@ -42,6 +42,10 @@ along with this program. If not, see . #endif #include "decorations/decoratedclient.h" +#if HAVE_WAYLAND +#include +#endif + #include #include @@ -667,6 +671,7 @@ void Compositor::performCompositing() if (repaints_region.isEmpty() && !windowRepaintsPending()) { m_scene->idle(); m_timeSinceLastVBlank = fpsInterval - (options->vBlankTime() + 1); // means "start now" + m_timeSinceStart += m_timeSinceLastVBlank; // Note: It would seem here we should undo suspended unredirect, but when scenes need // it for some reason, e.g. transformations or translucency, the next pass that does not // need this anymore and paints normally will also reset the suspended unredirect. @@ -688,6 +693,17 @@ void Compositor::performCompositing() repaints_region = QRegion(); m_timeSinceLastVBlank = m_scene->paint(repaints, windows); + m_timeSinceStart += m_timeSinceLastVBlank; + +#if HAVE_WAYLAND + if (kwinApp()->shouldUseWaylandForCompositing()) { + for (Toplevel *win : damaged) { + if (auto surface = win->surface()) { + surface->frameRendered(m_timeSinceStart); + } + } + } +#endif compositeTimer.stop(); // stop here to ensure *we* cause the next repaint schedule - not some effect through m_scene->paint() diff --git a/composite.h b/composite.h index c9fb99286f..3daab16034 100644 --- a/composite.h +++ b/composite.h @@ -239,6 +239,7 @@ private: bool m_finishing; // finish() sets this variable while shutting down bool m_starting; // start() sets this variable while starting qint64 m_timeSinceLastVBlank; + qint64 m_timeSinceStart = 0; Scene *m_scene; bool m_bufferSwapPending; bool m_composeAtSwapCompletion;