kwin/src/renderloop_p.h
Xaver Hugl 75863454a0 RenderLoop: restrict repaint scheduling with fullscreen windows
With an opaque fullscreen window we can be sure that items under it don't
actually require us to repaint. This should yield some small efficiency
improvements and resolves stutter with adaptive sync.

BUG: 443872
FIXED-IN: 5.23.3
2021-11-07 00:41:38 +01:00

53 lines
1.2 KiB
C++

/*
SPDX-FileCopyrightText: 2020 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#pragma once
#include "renderloop.h"
#include "renderjournal.h"
#include <QTimer>
namespace KWin
{
class KWIN_EXPORT RenderLoopPrivate
{
public:
static RenderLoopPrivate *get(RenderLoop *loop);
explicit RenderLoopPrivate(RenderLoop *q);
void dispatch();
void invalidate();
void delayScheduleRepaint();
void scheduleRepaint();
void maybeScheduleRepaint();
void notifyFrameFailed();
void notifyFrameCompleted(std::chrono::nanoseconds timestamp);
RenderLoop *q;
std::chrono::nanoseconds lastPresentationTimestamp = std::chrono::nanoseconds::zero();
std::chrono::nanoseconds nextPresentationTimestamp = std::chrono::nanoseconds::zero();
QTimer compositeTimer;
RenderJournal renderJournal;
int refreshRate = 60000;
int pendingFrameCount = 0;
int inhibitCount = 0;
bool pendingReschedule = false;
bool pendingRepaint = false;
RenderLoop::VrrPolicy vrrPolicy = RenderLoop::VrrPolicy::Never;
Item *fullscreenItem = nullptr;
enum class SyncMode {
Fixed,
Adaptive,
};
SyncMode presentMode = SyncMode::Fixed;
};
} // namespace KWin