diff --git a/src/backend/allocator/dmabuf.rs b/src/backend/allocator/dmabuf.rs index 6a0c51e..df2e119 100644 --- a/src/backend/allocator/dmabuf.rs +++ b/src/backend/allocator/dmabuf.rs @@ -124,6 +124,7 @@ impl Buffer for Dmabuf { } /// Builder for Dmabufs +#[derive(Debug)] pub struct DmabufBuilder { internal: DmabufInternal, } diff --git a/src/backend/allocator/swapchain.rs b/src/backend/allocator/swapchain.rs index 904b2cf..e5b1339 100644 --- a/src/backend/allocator/swapchain.rs +++ b/src/backend/allocator/swapchain.rs @@ -35,6 +35,7 @@ pub const SLOT_CAP: usize = 4; /// If you have associated resources for each buffer that can be reused (e.g. framebuffer `Handle`s for a `DrmDevice`), /// you can store then in the `Slot`s userdata field. If a buffer is re-used, its userdata is preserved for the next time /// it is returned by `acquire()`. +#[derive(Debug)] pub struct Swapchain, B: Buffer, U: 'static> { /// Allocator used by the swapchain pub allocator: A, @@ -52,8 +53,10 @@ pub struct Swapchain, B: Buffer, U: 'static> { /// Can be cloned and passed around freely, the buffer is marked for re-use /// once all copies are dropped. Holding on to this struct will block the /// buffer in the swapchain. +#[derive(Debug)] pub struct Slot(Arc>); +#[derive(Debug)] struct InternalSlot { buffer: Option, acquired: AtomicBool, diff --git a/src/backend/drm/device/atomic.rs b/src/backend/drm/device/atomic.rs index 25af6e3..12bc495 100644 --- a/src/backend/drm/device/atomic.rs +++ b/src/backend/drm/device/atomic.rs @@ -29,7 +29,7 @@ pub type Mapping = ( HashMap>, HashMap>, ); - +#[derive(Debug)] pub struct AtomicDrmDevice { pub(crate) fd: Arc>, pub(crate) active: Arc, diff --git a/src/backend/drm/device/legacy.rs b/src/backend/drm/device/legacy.rs index b41c450..0a85de7 100644 --- a/src/backend/drm/device/legacy.rs +++ b/src/backend/drm/device/legacy.rs @@ -12,6 +12,7 @@ use crate::backend::drm::error::Error; use slog::{error, info, o}; +#[derive(Debug)] pub struct LegacyDrmDevice { pub(crate) fd: Arc>, pub(crate) active: Arc, diff --git a/src/backend/drm/device/mod.rs b/src/backend/drm/device/mod.rs index c776b09..8d40510 100644 --- a/src/backend/drm/device/mod.rs +++ b/src/backend/drm/device/mod.rs @@ -20,6 +20,7 @@ use legacy::LegacyDrmDevice; use slog::{error, info, o, trace, warn}; /// An open drm device +#[derive(Debug)] pub struct DrmDevice { pub(super) dev_id: dev_t, pub(crate) internal: Arc>, @@ -42,6 +43,7 @@ impl AsRawFd for DrmDevice { impl BasicDevice for DrmDevice {} impl ControlDevice for DrmDevice {} +#[derive(Debug)] pub struct FdWrapper { fd: A, pub(super) privileged: bool, @@ -67,6 +69,7 @@ impl Drop for FdWrapper { } } +#[derive(Debug)] pub enum DrmDeviceInternal { Atomic(AtomicDrmDevice), Legacy(LegacyDrmDevice), @@ -301,6 +304,7 @@ impl DevPath for A { } /// Events that can be generated by a DrmDevice +#[derive(Debug)] pub enum DrmEvent { /// A vblank blank event on the provided crtc has happend VBlank(crtc::Handle), diff --git a/src/backend/drm/mod.rs b/src/backend/drm/mod.rs index 36076cf..37d79ea 100644 --- a/src/backend/drm/mod.rs +++ b/src/backend/drm/mod.rs @@ -75,6 +75,7 @@ pub use surface::DrmSurface; use drm::control::{crtc, plane, Device as ControlDevice, PlaneType}; /// A set of planes as supported by a crtc +#[derive(Debug)] pub struct Planes { /// The primary plane of the crtc (automatically selected for [DrmDevice::create_surface]) pub primary: plane::Handle, diff --git a/src/backend/drm/surface/atomic.rs b/src/backend/drm/surface/atomic.rs index c3214e4..6221ed5 100644 --- a/src/backend/drm/surface/atomic.rs +++ b/src/backend/drm/surface/atomic.rs @@ -107,6 +107,7 @@ pub struct PlaneInfo { h: u32, } +#[derive(Debug)] pub struct AtomicDrmSurface { pub(super) fd: Arc>, pub(super) active: Arc, diff --git a/src/backend/drm/surface/gbm.rs b/src/backend/drm/surface/gbm.rs index eb780be..30ed390 100644 --- a/src/backend/drm/surface/gbm.rs +++ b/src/backend/drm/surface/gbm.rs @@ -29,6 +29,16 @@ pub struct GbmBufferedSurface { drm: Arc>, } +// TODO: Replace with #[derive(Debug)] once gbm::BufferObject implements debug +impl std::fmt::Debug for GbmBufferedSurface { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.debug_struct("GbmBufferedSurface") + .field("buffers", &self.buffers) + .field("drm", &self.drm) + .finish_non_exhaustive() + } +} + impl GbmBufferedSurface where D: AsRawFd + 'static, @@ -266,6 +276,7 @@ where } } +#[derive(Debug)] struct FbHandle { drm: Arc>, fb: framebuffer::Handle, @@ -287,6 +298,15 @@ struct Buffers { next_fb: Option>, } +// TODO: Replace with #[derive(Debug)] once gbm::BufferObject implements debug +impl std::fmt::Debug for Buffers { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.debug_struct("Buffers") + .field("drm", &self.drm) + .finish_non_exhaustive() + } +} + impl Buffers where D: AsRawFd + 'static, diff --git a/src/backend/drm/surface/legacy.rs b/src/backend/drm/surface/legacy.rs index 4f2e2db..fcf37ce 100644 --- a/src/backend/drm/surface/legacy.rs +++ b/src/backend/drm/surface/legacy.rs @@ -70,6 +70,7 @@ impl State { } } +#[derive(Debug)] pub struct LegacyDrmSurface { pub(super) fd: Arc>, pub(super) active: Arc, diff --git a/src/backend/drm/surface/mod.rs b/src/backend/drm/surface/mod.rs index e46b1b1..e60879c 100644 --- a/src/backend/drm/surface/mod.rs +++ b/src/backend/drm/surface/mod.rs @@ -22,6 +22,7 @@ use legacy::LegacyDrmSurface; use slog::trace; /// An open crtc + plane combination that can be used for scan-out +#[derive(Debug)] pub struct DrmSurface { // This field is only read when 'backend_session' is enabled #[allow(dead_code)] @@ -34,6 +35,7 @@ pub struct DrmSurface { pub(super) links: RefCell>, } +#[derive(Debug)] pub enum DrmSurfaceInternal { Atomic(AtomicDrmSurface), Legacy(LegacyDrmSurface), diff --git a/src/backend/egl/ffi.rs b/src/backend/egl/ffi.rs index bac6206..caa7c94 100644 --- a/src/backend/egl/ffi.rs +++ b/src/backend/egl/ffi.rs @@ -42,7 +42,7 @@ pub fn make_sure_egl_is_loaded() { }); } -#[allow(clippy::all)] +#[allow(clippy::all, missing_debug_implementations)] pub mod egl { use super::*; use libloading::Library; diff --git a/src/backend/egl/native.rs b/src/backend/egl/native.rs index e7fb302..af1a91b 100644 --- a/src/backend/egl/native.rs +++ b/src/backend/egl/native.rs @@ -227,6 +227,7 @@ pub unsafe trait EGLNativeSurface: Send + Sync { #[cfg(feature = "backend_winit")] /// Typed Xlib window for the `X11` backend +#[derive(Debug)] pub struct XlibWindow(pub raw::c_ulong); #[cfg(feature = "backend_winit")] diff --git a/src/backend/renderer/gles2/mod.rs b/src/backend/renderer/gles2/mod.rs index 4f6e9d6..1187782 100644 --- a/src/backend/renderer/gles2/mod.rs +++ b/src/backend/renderer/gles2/mod.rs @@ -40,7 +40,7 @@ use wayland_server::protocol::{wl_buffer, wl_shm}; use slog::{debug, error, info, o, trace, warn}; -#[allow(clippy::all, missing_docs)] +#[allow(clippy::all, missing_docs, missing_debug_implementations)] pub mod ffi { include!(concat!(env!("OUT_DIR"), "/gl_bindings.rs")); } @@ -172,6 +172,15 @@ pub struct Gles2Frame { programs: [Gles2Program; shaders::FRAGMENT_COUNT], } +impl fmt::Debug for Gles2Frame { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("Gles2Frame") + .field("current_projection", &self.current_projection) + .field("programs", &self.programs) + .finish_non_exhaustive() + } +} + impl fmt::Debug for Gles2Renderer { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("Gles2Renderer") diff --git a/src/backend/renderer/mod.rs b/src/backend/renderer/mod.rs index 7c58a91..462e248 100644 --- a/src/backend/renderer/mod.rs +++ b/src/backend/renderer/mod.rs @@ -453,6 +453,7 @@ impl ImportAll for R { #[cfg(feature = "wayland_frontend")] #[non_exhaustive] /// Buffer type of a given wl_buffer, if managed by smithay +#[derive(Debug)] pub enum BufferType { /// Buffer is managed by the [`crate::wayland::shm`] global Shm, diff --git a/src/backend/winit.rs b/src/backend/winit.rs index 847484c..adee697 100644 --- a/src/backend/winit.rs +++ b/src/backend/winit.rs @@ -270,7 +270,7 @@ impl WinitGraphicsBackend { } /// Virtual input device used by the backend to associate input events -#[derive(PartialEq, Eq, Hash)] +#[derive(PartialEq, Eq, Hash, Debug)] pub struct WinitVirtualDevice; impl Device for WinitVirtualDevice { diff --git a/src/lib.rs b/src/lib.rs index ede46f6..8d0cdbd 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,4 +1,4 @@ -#![warn(missing_docs, rust_2018_idioms)] +#![warn(missing_docs, missing_debug_implementations, rust_2018_idioms)] // Allow acronyms like EGL #![allow(clippy::upper_case_acronyms)] diff --git a/src/wayland/compositor/cache.rs b/src/wayland/compositor/cache.rs index 25aa0a0..99845d7 100644 --- a/src/wayland/compositor/cache.rs +++ b/src/wayland/compositor/cache.rs @@ -136,6 +136,12 @@ pub struct MultiCache { caches: appendlist::AppendList>, } +impl std::fmt::Debug for MultiCache { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.debug_struct("MultiCache").finish_non_exhaustive() + } +} + impl MultiCache { pub(crate) fn new() -> MultiCache { MultiCache { diff --git a/src/wayland/compositor/handlers.rs b/src/wayland/compositor/handlers.rs index af3edfe..f0ba2e6 100644 --- a/src/wayland/compositor/handlers.rs +++ b/src/wayland/compositor/handlers.rs @@ -277,6 +277,7 @@ pub(crate) fn implement_subcompositor( */ /// The cached state associated with a subsurface +#[derive(Debug)] pub struct SubsurfaceCachedState { /// Location of the top-left corner of this subsurface /// relative to its parent coordinate space diff --git a/src/wayland/compositor/mod.rs b/src/wayland/compositor/mod.rs index 2576cc8..35d6840 100644 --- a/src/wayland/compositor/mod.rs +++ b/src/wayland/compositor/mod.rs @@ -133,6 +133,7 @@ struct Marker { /// /// By default, all surfaces have a [`SurfaceAttributes`] cached state, /// and subsurface also have a [`SubsurfaceCachedState`] state as well. +#[derive(Debug)] pub struct SurfaceData { /// The current role of the surface. /// diff --git a/src/wayland/shell/xdg/mod.rs b/src/wayland/shell/xdg/mod.rs index c63253c..333ad09 100644 --- a/src/wayland/shell/xdg/mod.rs +++ b/src/wayland/shell/xdg/mod.rs @@ -197,6 +197,7 @@ xdg_role!( /// xdg_surface description). /// /// Attaching a null buffer to a toplevel unmaps the surface. + #[derive(Debug)] XdgToplevelSurfaceRoleAttributes { /// The parent field of a toplevel should be used /// by the compositor to determine which toplevel @@ -272,6 +273,7 @@ xdg_role!( /// /// The client must call wl_surface.commit on the corresponding wl_surface /// for the xdg_popup state to take effect. + #[derive(Debug)] XdgPopupSurfaceRoleAttributes { /// Holds the parent for the xdg_popup. /// diff --git a/src/xwayland/x11_sockets.rs b/src/xwayland/x11_sockets.rs index c4d3a2a..ca6db2f 100644 --- a/src/xwayland/x11_sockets.rs +++ b/src/xwayland/x11_sockets.rs @@ -26,6 +26,7 @@ pub(crate) fn prepare_x11_sockets(log: ::slog::Logger) -> Result<(X11Lock, [Unix )) } +#[derive(Debug)] pub(crate) struct X11Lock { display: u32, log: ::slog::Logger, diff --git a/src/xwayland/xserver.rs b/src/xwayland/xserver.rs index 9dea03a..75a14d0 100644 --- a/src/xwayland/xserver.rs +++ b/src/xwayland/xserver.rs @@ -68,6 +68,7 @@ use wayland_server::{Client, Display, Filter}; use super::x11_sockets::{prepare_x11_sockets, X11Lock}; /// The XWayland handle +#[derive(Debug)] pub struct XWayland { inner: Rc>>, } @@ -143,6 +144,7 @@ impl Drop for XWayland { } } +#[derive(Debug)] struct XWaylandInstance { display_lock: X11Lock, wayland_client: Option, @@ -151,6 +153,7 @@ struct XWaylandInstance { } // Inner implementation of the XWayland manager +#[derive(Debug)] struct Inner { sender: SyncSender, handle: LoopHandle<'static, Data>, @@ -227,6 +230,7 @@ fn launch(inner: &Rc>>) -> std::io::Result<()> { Ok(()) } +#[derive(Debug)] pub struct XWaylandSource { channel: Channel, }