From fc89befdbb3c5d2186d11f3dcdb82a97b23543a4 Mon Sep 17 00:00:00 2001 From: Ian Douglas Scott Date: Tue, 23 Jul 2024 11:55:25 -0700 Subject: [PATCH] example --- src/wayland/drm_syncobj/mod.rs | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/wayland/drm_syncobj/mod.rs b/src/wayland/drm_syncobj/mod.rs index 067e926b3280..1f00f4dc2c5f 100644 --- a/src/wayland/drm_syncobj/mod.rs +++ b/src/wayland/drm_syncobj/mod.rs @@ -3,12 +3,33 @@ //! This module implement the `linux-drm-syncobj-v1` protocol, used to support //! explicit sync. //! -//! Currently, the implementation here assumes +//! Currently, the implementation here assumes acquire fences are already signalled +//! when the surface transaction is ready. Use [`DrmSyncPointBlocker`]. //! //! ```no_run +//! # use smithay::delegate_drm_syncobj; +//! # use smithay::wayland::drm_syncobj::*; +//! //! pub struct State { -//! syncobj_state: DrmSyncobjState, +//! syncobj_state: Option, +//! } +//! +//! impl DrmSyncobjHandler for State { +//! fn drm_syncobj_state(&mut self) -> &mut DrmSyncobjState { +//! self.syncobj_state.as_mut().unwrap() +//! } //! } +//! +//! # let mut display = wayland_server::Display::::new().unwrap(); +//! # let display_handle = display.handle(); +//! # let import_device = todo!(); +//! let syncobj_state = if supports_syncobj_eventfd(&import_device) { +//! Some(DrmSyncobjState::new::(&display_handle, import_device)) +//! } else { +//! None +//! }; +//! +//! delegate_drm_syncobj!(State); //! ``` use std::{cell::RefCell, os::unix::io::AsFd};