diff --git a/backends/hwcomposer/hwcomposer_backend.cpp b/backends/hwcomposer/hwcomposer_backend.cpp index 87f6a2f5e0..691749e6f4 100644 --- a/backends/hwcomposer/hwcomposer_backend.cpp +++ b/backends/hwcomposer/hwcomposer_backend.cpp @@ -28,6 +28,8 @@ along with this program. If not, see . #include #include #include +// Qt +#include // hybris/android #include #include @@ -41,8 +43,12 @@ namespace KWin HwcomposerBackend::HwcomposerBackend(QObject *parent) : AbstractBackend(parent) + , m_vsyncFailSafeTimer(new QTimer(this)) { handleOutputs(); + m_vsyncFailSafeTimer->setSingleShot(true); + m_vsyncFailSafeTimer->setInterval(1000); + connect(m_vsyncFailSafeTimer, &QTimer::timeout, this, &HwcomposerBackend::vsync); } HwcomposerBackend::~HwcomposerBackend() @@ -192,12 +198,14 @@ void HwcomposerBackend::present() } m_pageFlipPending = true; if (Compositor::self()) { + m_vsyncFailSafeTimer->start(); Compositor::self()->aboutToSwapBuffers(); } } void HwcomposerBackend::vsync() { + m_vsyncFailSafeTimer->stop(); if (m_pageFlipPending) { m_pageFlipPending = false; if (Compositor::self()) { diff --git a/backends/hwcomposer/hwcomposer_backend.h b/backends/hwcomposer/hwcomposer_backend.h index 2e1633aef4..ca3da143ac 100644 --- a/backends/hwcomposer/hwcomposer_backend.h +++ b/backends/hwcomposer/hwcomposer_backend.h @@ -32,6 +32,8 @@ typedef struct hwc_composer_device_1 hwc_composer_device_1_t; class HWComposerNativeWindowBuffer; +class QTimer; + namespace KWin { @@ -76,6 +78,7 @@ private: bool m_outputBlank = true; bool m_pageFlipPending = false; int m_refreshRate = 60000; + QTimer *m_vsyncFailSafeTimer; }; class HwcomposerWindow : public HWComposerNativeWindow