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 11, 2024
1 parent 0d2ccd5 commit 6f78c1f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "jay-compositor"
version = "1.0.2"
version = "1.0.3"
edition = "2021"
build = "build/build.rs"
license = "GPL-3.0-only"
Expand Down
5 changes: 4 additions & 1 deletion src/backends/metal/video.rs
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,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 @@ -783,6 +782,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 @@ -2403,6 +2405,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 6f78c1f

Please sign in to comment.