Skip to content

Commit

Permalink
drm: clean up renderer texture cache
Browse files Browse the repository at this point in the history
  • Loading branch information
cmeissl committed Jul 3, 2023
1 parent 1bf208d commit 8ff2320
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/backend/drm/compositor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1952,6 +1952,13 @@ where

match render_res {
Ok(render_output_result) => {
if render_output_result.damage.is_none() {
// if we receive no damage we can assume no rendering took place
// and we should trigger a cleanup of the renderer texture cache
// to prevent holding textures longer then necessary
renderer.cleanup_texture_cache();
}

for (id, state) in render_output_result.states.states.into_iter() {
// Skip the state for our fake elements
if self.overlay_plane_element_ids.contains_plane_id(&id) {
Expand Down Expand Up @@ -2037,6 +2044,11 @@ where
return Err(RenderFrameError::from(err));
}
}
} else {
// if we are constantly doing direct scan-out on the primary plane
// we have to cleanup the renderer texture cache as this would
// only happen implicit during rendering otherwise
renderer.cleanup_texture_cache();
}

self.next_frame = Some(next_frame_state);
Expand Down

0 comments on commit 8ff2320

Please sign in to comment.