Remove composite reset timer

Summary:
To streamline Compositor code more remove the composite reset timer. The two
times it was used we can either use a singleshot timer instead or connect the
call to a different signal in the X11 backend.

Long term goal is to have a well structured init of the Compositor such that
we can call directly instead.

Test Plan: Manually in X and Wayland nested session.

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: zzag, kwin

Tags: #kwin

Maniphest Tasks: T11071

Differential Revision: https://phabricator.kde.org/D22270
icc-effect-5.17.5
Roman Gilg 2019-07-03 00:57:53 +02:00
parent 8c047613c5
commit 09cfc2c0b4
3 changed files with 16 additions and 18 deletions

View File

@ -110,9 +110,8 @@ Compositor::Compositor(QObject* workspace)
, m_composeAtSwapCompletion(false)
{
qRegisterMetaType<Compositor::SuspendReason>("Compositor::SuspendReason");
connect(&compositeResetTimer, &QTimer::timeout, this, &Compositor::reinitialize);
connect(options, &Options::configChanged, this, &Compositor::slotConfigChanged);
compositeResetTimer.setSingleShot(true);
m_monotonicClock.start();
// 2 sec which should be enough to restart the compositor
@ -816,11 +815,6 @@ bool Compositor::windowRepaintsPending() const
return false;
}
void Compositor::setCompositeResetTimer(int msecs)
{
compositeResetTimer.start(msecs);
}
void Compositor::setCompositeTimer()
{
if (!hasScene()) // should not really happen, but there may be e.g. some damage events still pending

View File

@ -125,7 +125,6 @@ public:
int xrrRefreshRate() const {
return m_xrrRefreshRate;
}
void setCompositeResetTimer(int msecs);
bool hasScene() const {
return m_scene != NULL;
@ -219,7 +218,6 @@ private:
int m_xrrRefreshRate;
QRegion repaints_region;
QTimer compositeResetTimer; // for compressing composite resets
bool m_finishing; // finish() sets this variable while shutting down
bool m_starting; // start() sets this variable while starting
qint64 m_timeSinceLastVBlank;

View File

@ -47,6 +47,21 @@ void XRandRScreens::init()
m_backend->initOutputs();
setCount(m_backend->outputs().count());
emit changed();
#ifndef KWIN_UNIT_TEST
connect(this, &XRandRScreens::changed, this, [] {
if (!workspace()->compositing()) {
return;
}
if (Compositor::self()->xrrRefreshRate() == Options::currentRefreshRate()) {
return;
}
// desktopResized() should take care of when the size or
// shape of the desktop has changed, but we also want to
// catch refresh rate changes
Compositor::self()->reinitialize();
});
#endif
}
void XRandRScreens::updateCount()
@ -75,15 +90,6 @@ bool XRandRScreens::event(xcb_generic_event_t *event)
screen->width_in_millimeters = xrrEvent->mwidth;
screen->height_in_millimeters = xrrEvent->mheight;
}
#ifndef KWIN_UNIT_TEST
if (workspace()->compositing()) {
// desktopResized() should take care of when the size or
// shape of the desktop has changed, but we also want to
// catch refresh rate changes
if (Compositor::self()->xrrRefreshRate() != Options::currentRefreshRate())
Compositor::self()->setCompositeResetTimer(0);
}
#endif
return false;
}