smithay/backend/renderer/sync/
egl.rs

1use std::{os::unix::io::OwnedFd, time::Duration};
2
3use crate::backend::{
4    egl::fence::EGLFence,
5    renderer::sync::{Fence, Interrupted},
6};
7
8impl Fence for EGLFence {
9    fn wait(&self) -> Result<(), Interrupted> {
10        self.client_wait(None, false).map(|_| ()).map_err(|err| {
11            tracing::warn!(?err, "Waiting for fence was interrupted");
12            Interrupted
13        })
14    }
15
16    fn is_exportable(&self) -> bool {
17        self.is_native()
18    }
19
20    fn export(&self) -> Option<OwnedFd> {
21        self.export().ok()
22    }
23
24    fn is_signaled(&self) -> bool {
25        self.client_wait(Some(Duration::ZERO), false).unwrap_or(false)
26    }
27}