From 36e62cc8780af619d1d9bc3fc544308569f226b5 Mon Sep 17 00:00:00 2001 From: Christian Duerr Date: Wed, 4 Sep 2024 11:30:14 +0200 Subject: [PATCH 1/2] Add Clone for dmabuf feedback structs The `DmabufHandler::dmabuf_feedback` handler provides access to DMA buffer feedback, however working with this feedback becomes difficult when it needs to be stored in multiple places due to missing derives. So this patch adds the automatic `Clone` derive so the existing types in SCTK can be reused downstream. The `DmabufFeedback` itself does not implement `Clones` since it relies on the `Mmap` type, which is not cloneable. --- src/dmabuf.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/dmabuf.rs b/src/dmabuf.rs index a947b58ca..6661e8a4a 100644 --- a/src/dmabuf.rs +++ b/src/dmabuf.rs @@ -19,7 +19,7 @@ type dev_t = u64; use libc::dev_t; /// A preference tranche of dmabuf formats -#[derive(Debug)] +#[derive(Clone, Debug)] pub struct DmabufFeedbackTranche { /// `dev_t` value for preferred target device. May be scan-out or /// renderer device. @@ -43,6 +43,7 @@ impl Default for DmabufFeedbackTranche { /// A single dmabuf format/modifier pair // Must have correct representation to be able to mmap format table #[repr(C)] +#[derive(Copy, Clone)] pub struct DmabufFormat { /// Fourcc format pub format: u32, From c1312a64f2e07e360507111cebdbcf25bd7936ac Mon Sep 17 00:00:00 2001 From: Christian Duerr Date: Wed, 4 Sep 2024 11:37:14 +0200 Subject: [PATCH 2/2] Fix clippy warnings --- src/globals.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/globals.rs b/src/globals.rs index 6b16c6d5d..bb9f5648b 100644 --- a/src/globals.rs +++ b/src/globals.rs @@ -7,13 +7,13 @@ use wayland_client::Proxy; /// argument. For example: /// /// - A global that binds to `wl_compositor` with maximum version 4 could implement -/// `ProvidesBoundGlobal`, `ProvidesBoundGlobal`, -/// `ProvidesBoundGlobal`, and `ProvidesBoundGlobal` because -/// versions 2-4 only add additional requests to the `wl_surface` API. +/// `ProvidesBoundGlobal`, `ProvidesBoundGlobal`, +/// `ProvidesBoundGlobal`, and `ProvidesBoundGlobal` because +/// versions 2-4 only add additional requests to the `wl_surface` API. /// - A global that binds to `wl_compositor` with maximum version 5 may only implement -/// `ProvidesBoundGlobal` because version 5 makes using `wl_surface::attach` with -/// a nonzero offset a protocol error. A caller who is only aware of the version 4 API risks -/// causing these protocol errors if it uses surfaces created by such a global. +/// `ProvidesBoundGlobal` because version 5 makes using `wl_surface::attach` with +/// a nonzero offset a protocol error. A caller who is only aware of the version 4 API risks +/// causing these protocol errors if it uses surfaces created by such a global. /// /// Changes that cause compatibility breaks include: ///