Perform compositing even if there is nothing to repaint

In rare cases, the Compositor has to perform a compositing if there is
nothing to repaint. For example, if a client has committed a frame
callback to get notified about the next vblank event without damaging
the surface.
This commit is contained in:
Vlad Zahorodnii 2020-11-28 13:26:24 +02:00
parent fc60e8f1e3
commit 992e88de50
6 changed files with 0 additions and 70 deletions

View file

@ -649,17 +649,6 @@ void Compositor::performCompositing()
win->getDamageRegionReply();
}
if (repaints_region.isEmpty() && !windowRepaintsPending()) {
m_scene->idle();
m_timeSinceLastVBlank = fpsInterval - (options->vBlankTime() + 1); // means "start now"
// Note: It would seem here we should undo suspended unredirect, but when scenes need
// it for some reason, e.g. transformations or translucency, the next pass that does not
// need this anymore and paints normally will also reset the suspended unredirect.
// Otherwise the window would not be painted normally anyway.
compositeTimer.stop();
return;
}
// Skip windows that are not yet ready for being painted and if screen is locked skip windows
// that are neither lockscreen nor inputmethod windows.
//
@ -735,43 +724,6 @@ void Compositor::performCompositing()
}
}
template <class T>
static bool repaintsPending(const QList<T*> &windows)
{
return std::any_of(windows.begin(), windows.end(),
[](const T *t) { return t->wantsRepaint(); });
}
bool Compositor::windowRepaintsPending() const
{
if (repaintsPending(Workspace::self()->clientList())) {
return true;
}
if (repaintsPending(Workspace::self()->unmanagedList())) {
return true;
}
if (repaintsPending(Workspace::self()->deletedList())) {
return true;
}
if (auto *server = waylandServer()) {
const auto &clients = server->clients();
auto test = [](const AbstractClient *c) {
return c->readyForPainting() && c->wantsRepaint();
};
if (std::any_of(clients.begin(), clients.end(), test)) {
return true;
}
}
const auto &internalClients = workspace()->internalClients();
auto internalTest = [] (const InternalClient *client) {
return client->isShown(true) && client->wantsRepaint();
};
if (std::any_of(internalClients.begin(), internalClients.end(), internalTest)) {
return true;
}
return false;
}
void Compositor::setCompositeTimer()
{
if (m_state != State::On) {

View file

@ -134,7 +134,6 @@ private:
void cleanupX11();
void setCompositeTimer();
bool windowRepaintsPending() const;
void releaseCompositorSelection();
void deleteUnusedSupportProperties();

View file

@ -1173,17 +1173,6 @@ void Scene::Window::reallocRepaints()
m_layerRepaints.fill(infiniteRegion());
}
static bool wantsRepaint_test(const QRegion &region)
{
return !region.isEmpty();
}
bool Scene::Window::wantsRepaint() const
{
return std::any_of(m_repaints.begin(), m_repaints.end(), wantsRepaint_test) ||
std::any_of(m_layerRepaints.begin(), m_layerRepaints.end(), wantsRepaint_test);
}
//****************************************
// WindowPixmap
//****************************************

View file

@ -358,7 +358,6 @@ public:
void addLayerRepaint(const QRegion &region);
QRegion repaints(int screen) const;
void resetRepaints(int screen);
bool wantsRepaint() const;
virtual QSharedPointer<GLTexture> windowTexture() {
return {};

View file

@ -489,14 +489,6 @@ void Toplevel::addWorkspaceRepaint(const QRegion &region)
}
}
bool Toplevel::wantsRepaint() const
{
if (!effectWindow() || !effectWindow()->sceneWindow()) {
return false;
}
return effectWindow()->sceneWindow()->wantsRepaint();
}
void Toplevel::setReadyForPainting()
{
if (!ready_for_painting) {

View file

@ -463,7 +463,6 @@ public:
void addWorkspaceRepaint(const QRect& r);
void addWorkspaceRepaint(int x, int y, int w, int h);
void addWorkspaceRepaint(const QRegion &region);
bool wantsRepaint() const;
QRegion damage() const;
void resetDamage();
EffectWindowImpl* effectWindow();