kms/surface: Call cleanup_texture_cache for each device at end of draw

Fixes an issue where a dual GPU system would keep allocating dGPU PBOs in
`cpu_copy()` every frame, but `cleanup()` was not being called, since the
surface thread for the builtin output was rendered on the
primary/integrated GPU, targeting the same GPU.

Even if a different monitor was compositing on the dGPU, That wouldn't
help since that thread has it's own `GpuManager` with it's own renderer
and cache.

Running cleanup at the end (or start) of each frame seems like a good
idea. Not sure if it would be best to avoid additional calls, or if
that's desirable/fine.
This commit is contained in:
Ian Douglas Scott 2025-05-28 11:27:50 -07:00 committed by Victoria Brekenfeld
parent 619e994955
commit f86cd933d4

View file

@ -45,7 +45,7 @@ use smithay::{
element::TextureShaderElement, GlesRenderbuffer, GlesRenderer, GlesTexture, Uniform,
},
glow::GlowRenderer,
multigpu::{Error as MultiError, GpuManager},
multigpu::{ApiDevice, Error as MultiError, GpuManager},
sync::SyncPoint,
utils::with_renderer_surface_state,
Bind, Blit, Frame, ImportDma, Offscreen, Renderer, RendererSuper, Texture,
@ -1751,6 +1751,10 @@ impl SurfaceThreadState {
}
}
for device in self.api.devices_mut()? {
device.renderer_mut().cleanup_texture_cache()?;
}
Ok(())
}