Commit d1b537b5 authored by Vlad Zahorodnii's avatar Vlad Zahorodnii
Browse files

Move insertion of safety points to X11Compositor

Safety points only work on X11. On Wayland, we gain nothing from them.
parent dcdca9be
......@@ -145,9 +145,6 @@ Compositor::Compositor(QObject* workspace)
}, Qt::QueuedConnection
);
if (qEnvironmentVariableIsSet("KWIN_MAX_FRAMES_TESTED"))
m_framesToTestForSafety = qEnvironmentVariableIntValue("KWIN_MAX_FRAMES_TESTED");
// register DBus
new CompositorDBusInterface(this);
FTraceLogger::create();
......@@ -629,26 +626,11 @@ void Compositor::composite(RenderLoop *renderLoop)
}
}
if (m_framesToTestForSafety > 0 && (m_scene->compositingType() & OpenGLCompositing)) {
kwinApp()->platform()->createOpenGLSafePoint(Platform::OpenGLSafePoint::PreFrame);
}
const QRegion repaints = m_scene->repaints(screenId);
m_scene->resetRepaints(screenId);
m_scene->paint(screenId, repaints, windows, renderLoop);
if (m_framesToTestForSafety > 0) {
if (m_scene->compositingType() & OpenGLCompositing) {
kwinApp()->platform()->createOpenGLSafePoint(Platform::OpenGLSafePoint::PostFrame);
}
m_framesToTestForSafety--;
if (m_framesToTestForSafety == 0 && (m_scene->compositingType() & OpenGLCompositing)) {
kwinApp()->platform()->createOpenGLSafePoint(
Platform::OpenGLSafePoint::PostLastGuardedFrame);
}
}
if (waylandServer()) {
const std::chrono::milliseconds frameTime =
std::chrono::duration_cast<std::chrono::milliseconds>(renderLoop->lastPresentationTimestamp());
......@@ -710,6 +692,9 @@ X11Compositor::X11Compositor(QObject *parent)
: Compositor(parent)
, m_suspended(options->isUseCompositing() ? NoReasonSuspend : UserSuspend)
{
if (qEnvironmentVariableIsSet("KWIN_MAX_FRAMES_TESTED")) {
m_framesToTestForSafety = qEnvironmentVariableIntValue("KWIN_MAX_FRAMES_TESTED");
}
}
void X11Compositor::toggleCompositing()
......@@ -822,7 +807,21 @@ void X11Compositor::composite(RenderLoop *renderLoop)
item->waitForDamage();
}
if (m_framesToTestForSafety > 0 && (scene()->compositingType() & OpenGLCompositing)) {
kwinApp()->platform()->createOpenGLSafePoint(Platform::OpenGLSafePoint::PreFrame);
}
Compositor::composite(renderLoop);
if (m_framesToTestForSafety > 0) {
if (scene()->compositingType() & OpenGLCompositing) {
kwinApp()->platform()->createOpenGLSafePoint(Platform::OpenGLSafePoint::PostFrame);
}
m_framesToTestForSafety--;
if (m_framesToTestForSafety == 0 && (scene()->compositingType() & OpenGLCompositing)) {
kwinApp()->platform()->createOpenGLSafePoint(Platform::OpenGLSafePoint::PostLastGuardedFrame);
}
}
}
bool X11Compositor::checkForOverlayWindow(WId w) const
......
......@@ -140,7 +140,6 @@ private:
QList<xcb_atom_t> m_unusedSupportProperties;
QTimer m_unusedSupportPropertyTimer;
Scene *m_scene;
int m_framesToTestForSafety = 3;
QMap<RenderLoop *, AbstractOutput *> m_renderLoops;
};
......@@ -236,6 +235,7 @@ private:
* Whether the Compositor is currently suspended, 8 bits encoding the reason
*/
SuspendReasons m_suspended;
int m_framesToTestForSafety = 3;
};
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment