Commit 617650d4 authored by Vlad Zahorodnii's avatar Vlad Zahorodnii Committed by Vlad Zahorodnii
Browse files

[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
parent f7a67e0e
...@@ -406,9 +406,9 @@ void Scene::addToplevel(Toplevel *c) ...@@ -406,9 +406,9 @@ void Scene::addToplevel(Toplevel *c)
// TODO(vlad): Is there a more efficient way to manage window pixmap trees? // TODO(vlad): Is there a more efficient way to manage window pixmap trees?
connect(monitor, &SubSurfaceMonitor::subSurfaceAdded, w, &Window::discardPixmap); connect(monitor, &SubSurfaceMonitor::subSurfaceAdded, w, &Window::discardPixmap);
connect(monitor, &SubSurfaceMonitor::subSurfaceRemoved, 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::subSurfaceMapped, w, &Window::discardPixmap);
connect(monitor, &SubSurfaceMonitor::subSurfaceUnmapped, 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::subSurfaceAdded, w, &Window::discardQuads);
connect(monitor, &SubSurfaceMonitor::subSurfaceRemoved, w, &Window::discardQuads); connect(monitor, &SubSurfaceMonitor::subSurfaceRemoved, w, &Window::discardQuads);
...@@ -418,6 +418,7 @@ void Scene::addToplevel(Toplevel *c) ...@@ -418,6 +418,7 @@ void Scene::addToplevel(Toplevel *c)
connect(monitor, &SubSurfaceMonitor::subSurfaceUnmapped, w, &Window::discardQuads); connect(monitor, &SubSurfaceMonitor::subSurfaceUnmapped, w, &Window::discardQuads);
connect(monitor, &SubSurfaceMonitor::subSurfaceSurfaceToBufferMatrixChanged, 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); connect(c->surface(), &KWaylandServer::SurfaceInterface::surfaceToBufferMatrixChanged, w, &Window::discardQuads);
} }
......
...@@ -48,6 +48,8 @@ void SubSurfaceMonitor::registerSubSurface(SubSurfaceInterface *subSurface) ...@@ -48,6 +48,8 @@ void SubSurfaceMonitor::registerSubSurface(SubSurfaceInterface *subSurface)
this, &SubSurfaceMonitor::subSurfaceUnmapped); this, &SubSurfaceMonitor::subSurfaceUnmapped);
connect(surface, &SurfaceInterface::surfaceToBufferMatrixChanged, connect(surface, &SurfaceInterface::surfaceToBufferMatrixChanged,
this, &SubSurfaceMonitor::subSurfaceSurfaceToBufferMatrixChanged); this, &SubSurfaceMonitor::subSurfaceSurfaceToBufferMatrixChanged);
connect(surface, &SurfaceInterface::bufferSizeChanged,
this, &SubSurfaceMonitor::subSurfaceBufferSizeChanged);
registerSurface(surface); registerSurface(surface);
} }
...@@ -68,6 +70,8 @@ void SubSurfaceMonitor::unregisterSubSurface(SubSurfaceInterface *subSurface) ...@@ -68,6 +70,8 @@ void SubSurfaceMonitor::unregisterSubSurface(SubSurfaceInterface *subSurface)
this, &SubSurfaceMonitor::subSurfaceUnmapped); this, &SubSurfaceMonitor::subSurfaceUnmapped);
disconnect(surface, &SurfaceInterface::surfaceToBufferMatrixChanged, disconnect(surface, &SurfaceInterface::surfaceToBufferMatrixChanged,
this, &SubSurfaceMonitor::subSurfaceSurfaceToBufferMatrixChanged); this, &SubSurfaceMonitor::subSurfaceSurfaceToBufferMatrixChanged);
disconnect(surface, &SurfaceInterface::bufferSizeChanged,
this, &SubSurfaceMonitor::subSurfaceBufferSizeChanged);
unregisterSurface(surface); unregisterSurface(surface);
} }
......
...@@ -75,6 +75,10 @@ Q_SIGNALS: ...@@ -75,6 +75,10 @@ Q_SIGNALS:
* and the buffer coordinate space for a sub-surface has changed. * and the buffer coordinate space for a sub-surface has changed.
*/ */
void subSurfaceSurfaceToBufferMatrixChanged(); void subSurfaceSurfaceToBufferMatrixChanged();
/**
* This signal is emitted when the buffer size of a subsurface has changed.
*/
void subSurfaceBufferSizeChanged();
private: private:
void registerSubSurface(KWaylandServer::SubSurfaceInterface *subSurface); void registerSubSurface(KWaylandServer::SubSurfaceInterface *subSurface);
......
Markdown is supported
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