kwin/renderloop_p.h
Vlad Zahorodnii ee3515680a platforms/drm: Make frame scheduling robust
If there is a pending frame, the RenderLoop will delay all schedule
repaint requests to the next vblank event. This means that the render
loop needs to be notified when a frame has been presented or failed.

At the moment, the RenderLoop is notified only about successfully
presented frames. If some frame fails, no repaints will be scheduled
on that output.

In order to make frame scheduling robust, the RenderLoop has to be
notified if a frame has failed.
2021-01-06 16:59:30 +00:00

45 lines
1 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;
};
} // namespace KWin