diff --git a/src/backend/renderer/utils/wayland.rs b/src/backend/renderer/utils/wayland.rs index b88e6b10601f..28de7037c8f0 100644 --- a/src/backend/renderer/utils/wayland.rs +++ b/src/backend/renderer/utils/wayland.rs @@ -1,3 +1,5 @@ +#[cfg(feature = "backend_drm")] +use crate::wayland::drm_syncobj::{DrmSyncPoint, DrmSyncobjCachedState}; use crate::{ backend::renderer::{buffer_dimensions, buffer_has_alpha, element::RenderElement, ImportAll, Renderer}, utils::{Buffer as BufferCoord, Coordinate, Logical, Physical, Point, Rectangle, Scale, Size, Transform}, @@ -7,7 +9,6 @@ use crate::{ with_surface_tree_upward, BufferAssignment, Damage, RectangleKind, SubsurfaceCachedState, SurfaceAttributes, SurfaceData, TraversalAction, }, - drm_syncobj::{DrmSyncPoint, DrmSyncobjCachedState}, viewporter, }, }; @@ -53,6 +54,7 @@ pub struct RendererSurfaceState { #[derive(Debug)] struct InnerBuffer { buffer: WlBuffer, + #[cfg(feature = "backend_drm")] release_point: Option, } @@ -60,6 +62,7 @@ impl Drop for InnerBuffer { #[inline] fn drop(&mut self) { self.buffer.release(); + #[cfg(feature = "backend_drm")] if let Some(release_point) = &self.release_point { if let Err(err) = release_point.signal() { tracing::error!("Failed to signal syncobj release point: {}", err); @@ -75,10 +78,11 @@ pub struct Buffer { } impl Buffer { - fn new(buffer: WlBuffer, release_point: Option) -> Self { + fn new(buffer: WlBuffer, #[cfg(feature = "backend_drm")] release_point: Option) -> Self { Buffer { inner: Arc::new(InnerBuffer { buffer, + #[cfg(feature = "backend_drm")] release_point, }), } @@ -111,6 +115,7 @@ impl PartialEq for &Buffer { impl RendererSurfaceState { #[profiling::function] pub(crate) fn update_buffer(&mut self, states: &SurfaceData) { + #[cfg(feature = "backend_drm")] let mut syncobj_state = states.cached_state.pending::(); let mut attrs = states.cached_state.current::(); @@ -135,7 +140,11 @@ impl RendererSurfaceState { self.buffer_transform = attrs.buffer_transform.into(); if !self.buffer.as_ref().map_or(false, |b| b == buffer) { - self.buffer = Some(Buffer::new(buffer, syncobj_state.release_point.take())); + self.buffer = Some(Buffer::new( + buffer, + #[cfg(feature = "backend_drm")] + syncobj_state.release_point.take(), + )); } self.textures.clear(); diff --git a/src/wayland/compositor/tree.rs b/src/wayland/compositor/tree.rs index b6a160b60dc5..6c9300921b1b 100644 --- a/src/wayland/compositor/tree.rs +++ b/src/wayland/compositor/tree.rs @@ -1,7 +1,6 @@ -use crate::{ - utils::Serial, - wayland::{compositor::SUBSURFACE_ROLE, drm_syncobj::DrmSyncobjCachedState}, -}; +#[cfg(feature = "backend_drm")] +use crate::wayland::drm_syncobj::DrmSyncobjCachedState; +use crate::{utils::Serial, wayland::compositor::SUBSURFACE_ROLE}; use super::{ cache::MultiCache, @@ -159,6 +158,7 @@ impl PrivateSurfaceData { { buffer.release(); }; + #[cfg(feature = "backend_drm")] if let Some(release_point) = &my_data .public_data .cached_state @@ -169,6 +169,7 @@ impl PrivateSurfaceData { tracing::error!("Failed to signal syncobj release point: {}", err); } } + #[cfg(feature = "backend_drm")] if let Some(release_point) = &my_data .public_data .cached_state