Skip to content

shaped-texture: Only free mipmaps if they were unused in the previous frame

Daniel van Vugt requested to merge vanvugt/mutter:clear-mipmap-later into main

do_paint_content was naively assuming a ShapedTexture was only ever painted once per frame, and if that one paint didn't use mipmaps then they should be freed. But that assumption is incorrect in the gnome-shell overview where you see the same window twice; once in the tiny workspace preview (mipmapped) and once in the window spread (usually not mipmapped). So every frame we were deleting the mipmap and every frame having to regenerate it, even for unchanging windows.

Now we defer the decision about clearing the mipmap memory until after the stage paint and only clear when the mipmap is really unused (we're not in the overview anymore). And so we don't waste time regenerating the same mipmap every frame.

This reduces the render time of the overview (4K with one maximized window) by roughly 5%-10%.

Edited by Daniel van Vugt

Merge request reports