[Debug Trait] General cleanup and small fixes
This commit is contained in:
parent
e9eb698dd0
commit
de3dfacee0
|
@ -60,7 +60,7 @@ pub struct AtomicDrmDevice<A: AsRawFd + 'static> {
|
||||||
logger: ::slog::Logger,
|
logger: ::slog::Logger,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<A: AsRawFd + 'static> fmt::Debug for AtomicDrmDevice<A> {
|
impl<A: AsRawFd + fmt::Debug + 'static> fmt::Debug for AtomicDrmDevice<A> {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
let mut debug = f.debug_struct("AtomicDrmDevice");
|
let mut debug = f.debug_struct("AtomicDrmDevice");
|
||||||
|
|
||||||
|
@ -68,7 +68,8 @@ impl<A: AsRawFd + 'static> fmt::Debug for AtomicDrmDevice<A> {
|
||||||
.field("dev", &self.dev)
|
.field("dev", &self.dev)
|
||||||
.field("dev_id", &self.dev_id)
|
.field("dev_id", &self.dev_id)
|
||||||
.field("active", &self.active)
|
.field("active", &self.active)
|
||||||
.field("backends", &self.backends);
|
.field("backends", &self.backends)
|
||||||
|
.field("handler", &"...");
|
||||||
|
|
||||||
#[cfg(feature = "backend_session")]
|
#[cfg(feature = "backend_session")]
|
||||||
debug.field("links", &self.links);
|
debug.field("links", &self.links);
|
||||||
|
@ -100,9 +101,10 @@ pub(in crate::backend::drm) struct Dev<A: AsRawFd + 'static> {
|
||||||
logger: ::slog::Logger,
|
logger: ::slog::Logger,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<A: AsRawFd + 'static> fmt::Debug for Dev<A> {
|
impl<A: AsRawFd + fmt::Debug + 'static> fmt::Debug for Dev<A> {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
f.debug_struct("Dev")
|
f.debug_struct("Dev")
|
||||||
|
.field("fd", &self.fd)
|
||||||
.field("privileged", &self.privileged)
|
.field("privileged", &self.privileged)
|
||||||
.field("active", &self.active)
|
.field("active", &self.active)
|
||||||
.field("old_state", &self.old_state)
|
.field("old_state", &self.old_state)
|
||||||
|
|
|
@ -48,9 +48,10 @@ pub(in crate::backend::drm) struct AtomicDrmSurfaceInternal<A: AsRawFd + 'static
|
||||||
pub(super) test_buffer: Mutex<Option<(DumbBuffer, framebuffer::Handle)>>,
|
pub(super) test_buffer: Mutex<Option<(DumbBuffer, framebuffer::Handle)>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<A: AsRawFd + 'static> fmt::Debug for AtomicDrmSurfaceInternal<A> {
|
impl<A: AsRawFd + fmt::Debug + 'static> fmt::Debug for AtomicDrmSurfaceInternal<A> {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
f.debug_struct("AtomicDrmSurfaceInternal")
|
f.debug_struct("AtomicDrmSurfaceInternal")
|
||||||
|
.field("dev", &self.dev)
|
||||||
.field("crtc", &self.crtc)
|
.field("crtc", &self.crtc)
|
||||||
.field("cursor", &self.cursor)
|
.field("cursor", &self.cursor)
|
||||||
.field("planse", &self.planes)
|
.field("planse", &self.planes)
|
||||||
|
|
|
@ -73,17 +73,20 @@ where
|
||||||
impl<B, D> fmt::Debug for EglDevice<B, D>
|
impl<B, D> fmt::Debug for EglDevice<B, D>
|
||||||
where
|
where
|
||||||
B: Backend<Surface = <D as Device>::Surface, Error = <<D as Device>::Surface as Surface>::Error>
|
B: Backend<Surface = <D as Device>::Surface, Error = <<D as Device>::Surface as Surface>::Error>
|
||||||
|
+ fmt::Debug
|
||||||
+ 'static,
|
+ 'static,
|
||||||
D: Device + NativeDisplay<B, Arguments = Arguments> + 'static,
|
D: Device + NativeDisplay<B, Arguments = Arguments> + fmt::Debug + 'static,
|
||||||
<D as Device>::Surface: NativeSurface<Error = <<D as Device>::Surface as Surface>::Error>,
|
<D as Device>::Surface: NativeSurface<Error = <<D as Device>::Surface as Surface>::Error>,
|
||||||
{
|
{
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
let mut debug = f.debug_struct("EglDevice");
|
let mut debug = f.debug_struct("EglDevice");
|
||||||
|
|
||||||
debug
|
debug
|
||||||
|
.field("dev", &self.dev)
|
||||||
.field("logger", &self.logger)
|
.field("logger", &self.logger)
|
||||||
.field("default_attributes", &self.default_attributes)
|
.field("default_attributes", &self.default_attributes)
|
||||||
.field("default_requirements", &self.default_requirements);
|
.field("default_requirements", &self.default_requirements)
|
||||||
|
.field("backends", &"...");
|
||||||
|
|
||||||
#[cfg(feature = "backend_session")]
|
#[cfg(feature = "backend_session")]
|
||||||
debug.field("links", &self.links);
|
debug.field("links", &self.links);
|
||||||
|
|
|
@ -91,10 +91,15 @@ pub struct EglStreamDevice<D: RawDevice + ControlDevice + 'static> {
|
||||||
links: Vec<crate::signaling::SignalToken>,
|
links: Vec<crate::signaling::SignalToken>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<D: RawDevice + ControlDevice + 'static> fmt::Debug for EglStreamDevice<D> {
|
impl<D: RawDevice + ControlDevice + fmt::Debug + 'static> fmt::Debug for EglStreamDevice<D> {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
let mut debug = f.debug_struct("EglStreamDevice");
|
let mut debug = f.debug_struct("EglStreamDevice");
|
||||||
debug.field("dev", &self.dev).field("logger", &self.logger);
|
debug
|
||||||
|
.field("dev", &self.dev)
|
||||||
|
.field("raw", &self.raw)
|
||||||
|
.field("backends", &"...")
|
||||||
|
.field("logger", &self.logger);
|
||||||
|
|
||||||
#[cfg(feature = "backend_session")]
|
#[cfg(feature = "backend_session")]
|
||||||
debug.field("links", &self.links);
|
debug.field("links", &self.links);
|
||||||
debug.finish()
|
debug.finish()
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
//! OpenGL rendering types
|
//! OpenGL rendering types
|
||||||
|
|
||||||
use nix::libc::c_void;
|
use nix::libc::c_void;
|
||||||
use std::fmt;
|
|
||||||
|
|
||||||
use super::{PixelFormat, SwapBuffersError};
|
use super::{PixelFormat, SwapBuffersError};
|
||||||
|
|
||||||
|
@ -40,15 +39,6 @@ pub trait GLGraphicsBackend {
|
||||||
|
|
||||||
/// Returns the pixel format of the main framebuffer of the context.
|
/// Returns the pixel format of the main framebuffer of the context.
|
||||||
fn get_pixel_format(&self) -> PixelFormat;
|
fn get_pixel_format(&self) -> PixelFormat;
|
||||||
|
|
||||||
/// Formats the debug value using the given formatter.
|
|
||||||
fn debug_fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|
||||||
f.debug_struct("GLGraphicsBackend")
|
|
||||||
.field("framebuffer_dimensions", &self.get_framebuffer_dimensions())
|
|
||||||
.field("is_current", &self.is_current())
|
|
||||||
.field("pixel_format", &self.get_pixel_format())
|
|
||||||
.finish()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Loads a Raw GLES Interface for a given [`GLGraphicsBackend`]
|
/// Loads a Raw GLES Interface for a given [`GLGraphicsBackend`]
|
||||||
|
|
|
@ -25,10 +25,22 @@ pub struct GliumGraphicsBackend<T: GLGraphicsBackend> {
|
||||||
|
|
||||||
impl<T: GLGraphicsBackend> fmt::Debug for GliumGraphicsBackend<T> {
|
impl<T: GLGraphicsBackend> fmt::Debug for GliumGraphicsBackend<T> {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
let backend = &self.backend.0.borrow().debug_fmt(f);
|
struct BackendDebug<'a, T: GLGraphicsBackend>(&'a Rc<InternalBackend<T>>);
|
||||||
|
impl<'a, T: GLGraphicsBackend> fmt::Debug for BackendDebug<'a, T> {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
|
let b = &self.0 .0.borrow();
|
||||||
|
f.debug_struct("GLGraphicsBackend")
|
||||||
|
.field("framebuffer_dimensions", &b.get_framebuffer_dimensions())
|
||||||
|
.field("is_current", &b.is_current())
|
||||||
|
.field("pixel_format", &b.get_pixel_format())
|
||||||
|
.finish()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
f.debug_struct("GliumGraphicsBackend")
|
f.debug_struct("GliumGraphicsBackend")
|
||||||
.field("backend", backend)
|
.field("context", &"...")
|
||||||
|
.field("backend", &BackendDebug(&self.backend))
|
||||||
|
.field("error_channel", &"...")
|
||||||
.finish()
|
.finish()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -430,13 +430,19 @@ pub struct LibinputSessionInterface<S: Session>(S);
|
||||||
#[cfg(feature = "backend_session")]
|
#[cfg(feature = "backend_session")]
|
||||||
impl<S: Session> fmt::Debug for LibinputSessionInterface<S> {
|
impl<S: Session> fmt::Debug for LibinputSessionInterface<S> {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
let sesion = &f
|
struct SessionDebug<'a, S: Session>(&'a S);
|
||||||
.debug_struct("Session")
|
impl<'a, S: Session> fmt::Debug for SessionDebug<'a, S> {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
|
f.debug_struct("Session")
|
||||||
.field("is_active", &self.0.is_active())
|
.field("is_active", &self.0.is_active())
|
||||||
.field("seat", &self.0.seat())
|
.field("seat", &self.0.seat())
|
||||||
.finish();
|
.finish()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
f.debug_tuple("LibinputSessionInterface").field(sesion).finish()
|
f.debug_tuple("LibinputSessionInterface")
|
||||||
|
.field(&SessionDebug(&self.0))
|
||||||
|
.finish()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -75,7 +75,7 @@ impl fmt::Debug for LogindSessionImpl {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
f.debug_struct("LogindSessionImpl ")
|
f.debug_struct("LogindSessionImpl ")
|
||||||
.field("session_id", &self.session_id)
|
.field("session_id", &self.session_id)
|
||||||
.field("conn", &"..")
|
.field("conn", &"...")
|
||||||
.field("session_path", &self.session_path)
|
.field("session_path", &self.session_path)
|
||||||
.field("active", &self.active)
|
.field("active", &self.active)
|
||||||
.field("signaler", &self.signaler)
|
.field("signaler", &self.signaler)
|
||||||
|
|
|
@ -69,10 +69,23 @@ enum Window {
|
||||||
impl fmt::Debug for Window {
|
impl fmt::Debug for Window {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
match self {
|
match self {
|
||||||
Window::Wayland { .. } => f.debug_tuple("Window::Wayland"),
|
Window::Wayland { display, context, .. } => f
|
||||||
Window::X11 { .. } => f.debug_tuple("Window::X11"),
|
.debug_struct("Window::Wayland")
|
||||||
|
.field("display", &display)
|
||||||
|
.field("context", &context)
|
||||||
|
.field("surface", &"...")
|
||||||
|
.finish(),
|
||||||
|
Window::X11 {
|
||||||
|
display,
|
||||||
|
context,
|
||||||
|
surface,
|
||||||
|
} => f
|
||||||
|
.debug_struct("Window::X11")
|
||||||
|
.field("display", &display)
|
||||||
|
.field("context", &context)
|
||||||
|
.field("surface", &surface)
|
||||||
|
.finish(),
|
||||||
}
|
}
|
||||||
.finish()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue