From c7db81a76d7cf04d783d8a84d365a8aa182cefa9 Mon Sep 17 00:00:00 2001 From: Christian Meissl Date: Fri, 13 Dec 2024 23:42:30 +0100 Subject: [PATCH] fix compilation without fd_for_plane --- src/backend/allocator/gbm.rs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/backend/allocator/gbm.rs b/src/backend/allocator/gbm.rs index 603bbc1994d4..19e0a25c8d2e 100644 --- a/src/backend/allocator/gbm.rs +++ b/src/backend/allocator/gbm.rs @@ -282,16 +282,14 @@ impl AsDmabuf for GbmBuffer { #[cfg(not(feature = "backend_gbm_has_fd_for_plane"))] #[profiling::function] fn export(&self) -> Result { - let planes = self.plane_count()? as i32; + let planes = self.plane_count() as i32; let mut iter = (0i32..planes).map(|i| self.handle_for_plane(i)); let first = iter.next().expect("Encountered a buffer with zero planes"); // check that all handles are the same let handle = iter.try_fold(first, |first, next| { - if let (Ok(next), Ok(first)) = (next, first) { - if unsafe { next.u64_ == first.u64_ } { - return Some(Ok(first)); - } + if unsafe { next.u64_ == first.u64_ } { + return Some(first); } None }); @@ -311,13 +309,13 @@ impl AsDmabuf for GbmBuffer { // SAFETY: `gbm_bo_get_fd` returns a new fd owned by the caller. fd, idx as u32, - self.offset(idx)?, - self.stride_for_plane(idx)?, + self.offset(idx), + self.stride_for_plane(idx), ); } #[cfg(feature = "backend_drm")] - if let Some(node) = self.device_fd().ok().and_then(|fd| DrmNode::from_file(fd).ok()) { + if let Ok(node) = DrmNode::from_file(self.device_fd()) { builder.set_node(node); }