[scene] Discard pixmaps on buffer size change

The surface size is a logical size, which renders it unsuitable for
deciding whether the window pixmap needs to be discarded.

We need to discard window pixmaps when the buffer size changes. That
has a drawback though, discarding textures is kind of an overkill with
linux-dmabuf. However, fixing that would involve changes in kwayland
server that are far from being trivial.

BUG: 422459
This commit is contained in:
Vlad Zahorodnii 2020-06-30 09:33:45 +03:00 committed by Vlad Zahorodnii
parent f7a67e0edc
commit 617650d440
3 changed files with 10 additions and 1 deletions

View file

@ -406,9 +406,9 @@ void Scene::addToplevel(Toplevel *c)
// TODO(vlad): Is there a more efficient way to manage window pixmap trees?
connect(monitor, &SubSurfaceMonitor::subSurfaceAdded, w, &Window::discardPixmap);
connect(monitor, &SubSurfaceMonitor::subSurfaceRemoved, w, &Window::discardPixmap);
connect(monitor, &SubSurfaceMonitor::subSurfaceResized, w, &Window::discardPixmap);
connect(monitor, &SubSurfaceMonitor::subSurfaceMapped, w, &Window::discardPixmap);
connect(monitor, &SubSurfaceMonitor::subSurfaceUnmapped, w, &Window::discardPixmap);
connect(monitor, &SubSurfaceMonitor::subSurfaceBufferSizeChanged, w, &Window::discardPixmap);
connect(monitor, &SubSurfaceMonitor::subSurfaceAdded, w, &Window::discardQuads);
connect(monitor, &SubSurfaceMonitor::subSurfaceRemoved, w, &Window::discardQuads);
@ -418,6 +418,7 @@ void Scene::addToplevel(Toplevel *c)
connect(monitor, &SubSurfaceMonitor::subSurfaceUnmapped, w, &Window::discardQuads);
connect(monitor, &SubSurfaceMonitor::subSurfaceSurfaceToBufferMatrixChanged, w, &Window::discardQuads);
connect(c->surface(), &KWaylandServer::SurfaceInterface::bufferSizeChanged, w, &Window::discardPixmap);
connect(c->surface(), &KWaylandServer::SurfaceInterface::surfaceToBufferMatrixChanged, w, &Window::discardQuads);
}

View file

@ -48,6 +48,8 @@ void SubSurfaceMonitor::registerSubSurface(SubSurfaceInterface *subSurface)
this, &SubSurfaceMonitor::subSurfaceUnmapped);
connect(surface, &SurfaceInterface::surfaceToBufferMatrixChanged,
this, &SubSurfaceMonitor::subSurfaceSurfaceToBufferMatrixChanged);
connect(surface, &SurfaceInterface::bufferSizeChanged,
this, &SubSurfaceMonitor::subSurfaceBufferSizeChanged);
registerSurface(surface);
}
@ -68,6 +70,8 @@ void SubSurfaceMonitor::unregisterSubSurface(SubSurfaceInterface *subSurface)
this, &SubSurfaceMonitor::subSurfaceUnmapped);
disconnect(surface, &SurfaceInterface::surfaceToBufferMatrixChanged,
this, &SubSurfaceMonitor::subSurfaceSurfaceToBufferMatrixChanged);
disconnect(surface, &SurfaceInterface::bufferSizeChanged,
this, &SubSurfaceMonitor::subSurfaceBufferSizeChanged);
unregisterSurface(surface);
}

View file

@ -75,6 +75,10 @@ Q_SIGNALS:
* and the buffer coordinate space for a sub-surface has changed.
*/
void subSurfaceSurfaceToBufferMatrixChanged();
/**
* This signal is emitted when the buffer size of a subsurface has changed.
*/
void subSurfaceBufferSizeChanged();
private:
void registerSubSurface(KWaylandServer::SubSurfaceInterface *subSurface);