Skip to content

Commit

Permalink
Add public constructors for renderer::utils::wayland::Buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
ids1024 committed Sep 20, 2024
1 parent 6435291 commit 078a420
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/backend/renderer/utils/wayland.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,31 @@ pub struct Buffer {
}

impl Buffer {
/// Create a buffer with implicit sync
pub fn with_implicit(buffer: WlBuffer) -> Self {
Self {
inner: Arc::new(InnerBuffer {
buffer,
#[cfg(feature = "backend_drm")]
acquire_point: None,
#[cfg(feature = "backend_drm")]
release_point: None,
}),
}
}

/// Create a buffer with explicit acquire and release sync points
#[cfg(feature = "backend_drm")]
pub fn with_explicit(buffer: WlBuffer, acquire_point: DrmSyncPoint, release_point: DrmSyncPoint) -> Self {
Self {
inner: Arc::new(InnerBuffer {
buffer,
acquire_point: Some(acquire_point),
release_point: Some(release_point),
}),
}
}

#[cfg(feature = "backend_drm")]
#[allow(dead_code)]
pub(crate) fn acquire_point(&self) -> Option<&DrmSyncPoint> {
Expand Down

0 comments on commit 078a420

Please sign in to comment.