Skip to content

Commit

Permalink
metal: preserve front buffer if atomic commit fails
Browse files Browse the repository at this point in the history
  • Loading branch information
mahkoh committed Apr 10, 2024
1 parent ad83cfc commit b60fbf2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/backends/metal/video.rs
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,6 @@ impl MetalConnector {
.perform_render_pass(pass)
.map_err(MetalError::RenderFrame)?;
sync_file = buffer.copy_to_dev(sf)?;
self.next_buffer.fetch_add(1);
output.perform_screencopies(&buffer.render_tex, !render_hw_cursor, 0, 0, None);
fb = buffer.drm.clone();
}
Expand Down Expand Up @@ -787,6 +786,9 @@ impl MetalConnector {
Err(MetalError::Commit(e))
} else {
if let Some(fb) = new_fb {
if fb.direct_scanout_data.is_none() {
self.next_buffer.fetch_add(1);
}
self.next_framebuffer.set(Some(fb));
}
if cursor_swap_buffer {
Expand Down Expand Up @@ -2407,6 +2409,7 @@ impl MetalBackend {
if let Some(old) = connector.buffers.set(Some(buffers)) {
old_buffers.push(old);
}
connector.next_buffer.set(1);
connector.primary_plane.set(Some(primary_plane.clone()));
if let Some(cp) = &cursor_plane {
cp.assigned.set(true);
Expand Down

0 comments on commit b60fbf2

Please sign in to comment.