drivers/graphics: Require Debug to be implemented for Buffer

This commit is contained in:
bjorn3
2026-03-13 22:53:41 +01:00
parent f6a7c194b2
commit 977e13077d
4 changed files with 14 additions and 1 deletions
+1 -1
View File
@@ -77,7 +77,7 @@ pub trait GraphicsAdapter: Sized + Debug {
fn handle_cursor(&mut self, cursor: Option<&CursorPlane<Self::Buffer>>, dirty_fb: bool);
}
pub trait Buffer {
pub trait Buffer: Debug {
fn width(&self) -> u32;
fn height(&self) -> u32;
}
@@ -146,6 +146,7 @@ impl DeviceFb {
}
}
#[derive(Debug)]
pub struct DumbFb {
width: usize,
height: usize,
+1
View File
@@ -179,6 +179,7 @@ impl FrameBuffer {
}
}
#[derive(Debug)]
pub struct GraphicScreen {
width: usize,
height: usize,
@@ -42,6 +42,17 @@ pub struct VirtGpuFramebuffer<'a> {
height: u32,
}
impl<'a> fmt::Debug for VirtGpuFramebuffer<'a> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("VirtGpuFramebuffer")
.field("id", &self.id)
.field("sgl", &self.sgl)
.field("width", &self.width)
.field("height", &self.height)
.finish_non_exhaustive()
}
}
impl DrmBuffer for VirtGpuFramebuffer<'_> {
fn width(&self) -> u32 {
self.width