KWin
Loading...
Searching...
No Matches
softwarevsyncmonitor.h
Go to the documentation of this file.
1/*
2 SPDX-FileCopyrightText: 2020 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#pragma once
8
10
11#include <QTimer>
12#include <memory>
13
14namespace KWin
15{
16
25class KWIN_EXPORT SoftwareVsyncMonitor : public VsyncMonitor
26{
27 Q_OBJECT
28
29public:
30 static std::unique_ptr<SoftwareVsyncMonitor> create();
31
32 int refreshRate() const;
33 void setRefreshRate(int refreshRate);
34
35public Q_SLOTS:
36 void arm() override;
37
38private:
39 explicit SoftwareVsyncMonitor();
40 void handleSyntheticVsync();
41
42 QTimer m_softwareClock;
43 int m_refreshRate = 60000;
44 std::chrono::nanoseconds m_vblankTimestamp = std::chrono::nanoseconds::zero();
45};
46
47} // namespace KWin