Skip to content

Commit 1a1f764

Browse files
committed
Add public constructors for renderer::utils::wayland::Buffer
1 parent 6435291 commit 1a1f764

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

src/backend/renderer/utils/wayland.rs

+23
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,29 @@ pub struct Buffer {
8383
}
8484

8585
impl Buffer {
86+
/// Create a buffer with implicit sync
87+
pub fn with_implicit(buffer: WlBuffer) -> Self {
88+
Self {
89+
inner: Arc::new(InnerBuffer {
90+
buffer,
91+
acquire_point: None,
92+
release_point: None,
93+
}),
94+
}
95+
}
96+
97+
/// Create a buffer with explicit acquire and release sync points
98+
#[cfg(feature = "backend_drm")]
99+
pub fn with_explicit(buffer: WlBuffer, acquire_point: DrmSyncPoint, release_point: DrmSyncPoint) -> Self {
100+
Self {
101+
inner: Arc::new(InnerBuffer {
102+
buffer,
103+
acquire_point: Some(acquire_point),
104+
release_point: Some(release_point),
105+
}),
106+
}
107+
}
108+
86109
#[cfg(feature = "backend_drm")]
87110
#[allow(dead_code)]
88111
pub(crate) fn acquire_point(&self) -> Option<&DrmSyncPoint> {

0 commit comments

Comments
 (0)