mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 22:01:30 +00:00
Bug 1591524 - Clean up native compositor surfaces that are not retained. r=kvark
Differential Revision: https://phabricator.services.mozilla.com/D50773 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
9c93bb3a7a
commit
7f20e257e6
@ -233,7 +233,12 @@ pub trait Compositor {
|
||||
size: DeviceIntSize,
|
||||
);
|
||||
|
||||
/// Destroy the surface with the specified id.
|
||||
/// Destroy the surface with the specified id. WR may call this
|
||||
/// at any time the surface is no longer required (including during
|
||||
/// renderer deinit). It's the responsibility of the embedder
|
||||
/// to ensure that the surface is only freed once the GPU is
|
||||
/// no longer using the surface (if this isn't already handled
|
||||
/// by the operating system).
|
||||
fn destroy_surface(
|
||||
&mut self,
|
||||
id: NativeSurfaceId,
|
||||
|
@ -349,6 +349,22 @@ impl FrameBuilder {
|
||||
&visibility_context,
|
||||
&mut visibility_state,
|
||||
);
|
||||
|
||||
// When a new display list is processed by WR, the existing tiles from
|
||||
// any picture cache are stored in the `retained_tiles` field above. This
|
||||
// allows the first frame of a new display list to reuse any existing tiles
|
||||
// and surfaces that match. Once the `update_visibility` call above is
|
||||
// complete, any tiles that are left remaining in the `retained_tiles`
|
||||
// map are not needed and will be dropped. For simple compositing mode,
|
||||
// this is fine, since texture cache handles are garbage collected at
|
||||
// the end of each frame. However, if we're in native compositor mode,
|
||||
// we need to manually clean up any native compositor surfaces that were
|
||||
// allocated by these tiles.
|
||||
for (_, cache_state) in visibility_state.retained_tiles.caches.drain() {
|
||||
visibility_state.composite_state.destroy_native_surfaces(
|
||||
cache_state.tiles.values(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
let mut frame_state = FrameBuildingState {
|
||||
|
@ -4656,7 +4656,7 @@ impl TileNode {
|
||||
|
||||
impl CompositeState {
|
||||
// A helper function to destroy all native surfaces for a given list of tiles
|
||||
fn destroy_native_surfaces<'a, I: Iterator<Item = &'a Tile>>(
|
||||
pub fn destroy_native_surfaces<'a, I: Iterator<Item = &'a Tile>>(
|
||||
&mut self,
|
||||
tiles_iter: I,
|
||||
) {
|
||||
|
Loading…
Reference in New Issue
Block a user