Always enable graphical_debug

We already gracefully handle a missing framebuffer.
This commit is contained in:
bjorn3
2025-09-11 21:41:30 +02:00
parent 9a2203076a
commit f9a4178898
10 changed files with 26 additions and 52 deletions
-2
View File
@@ -53,7 +53,6 @@ default = [
#TODO: issues with Alder Lake and newer CPUs:
#This may be because of mismatch between cpu id and apic id
#"multi_core",
"graphical_debug",
"serial_debug",
"self_modifying",
"x86_kvm_pv",
@@ -64,7 +63,6 @@ default = [
self_modifying = []
acpi = []
graphical_debug = []
lpss_debug = []
multi_core = ["acpi"]
profiling = []
+6 -10
View File
@@ -1,16 +1,16 @@
use core::fmt;
use spin::MutexGuard;
use crate::log::{Log, LOG};
use crate::{
devices::graphical_debug::{DebugDisplay, DEBUG_DISPLAY},
log::{Log, LOG},
};
#[cfg(feature = "serial_debug")]
use super::device::serial::{SerialKind, COM1};
#[cfg(feature = "graphical_debug")]
use crate::devices::graphical_debug::{DebugDisplay, DEBUG_DISPLAY};
pub struct Writer<'a> {
log: MutexGuard<'a, Option<Log>>,
#[cfg(feature = "graphical_debug")]
display: MutexGuard<'a, Option<DebugDisplay>>,
#[cfg(feature = "serial_debug")]
serial: MutexGuard<'a, Option<SerialKind>>,
@@ -20,7 +20,6 @@ impl<'a> Writer<'a> {
pub fn new() -> Writer<'a> {
Writer {
log: LOG.lock(),
#[cfg(feature = "graphical_debug")]
display: DEBUG_DISPLAY.lock(),
#[cfg(feature = "serial_debug")]
serial: COM1.lock(),
@@ -34,11 +33,8 @@ impl<'a> Writer<'a> {
}
}
#[cfg(feature = "graphical_debug")]
{
if let Some(ref mut display) = *self.display {
let _ = display.write(buf);
}
if let Some(ref mut display) = *self.display {
let _ = display.write(buf);
}
#[cfg(feature = "serial_debug")]
+3 -6
View File
@@ -5,16 +5,15 @@
use core::slice;
use core::sync::atomic::{AtomicBool, AtomicU32, AtomicUsize, Ordering};
#[cfg(feature = "graphical_debug")]
use crate::devices::graphical_debug;
use fdt::Fdt;
use log::info;
use crate::{
allocator,
arch::interrupt,
device, dtb,
device,
devices::graphical_debug,
dtb,
dtb::register_dev_memory_ranges,
paging,
startup::memory::{register_bootloader_areas, register_memory_region, BootloaderMemoryKind},
@@ -74,7 +73,6 @@ pub unsafe extern "C" fn kstart(args_ptr: *const KernelArgs) -> ! {
);
// Set up graphical debug
#[cfg(feature = "graphical_debug")]
graphical_debug::init(env);
// Get hardware descriptor data
@@ -201,7 +199,6 @@ pub unsafe extern "C" fn kstart(args_ptr: *const KernelArgs) -> ! {
allocator::init();
// Set up double buffer for graphical debug now that heap is available
#[cfg(feature = "graphical_debug")]
graphical_debug::init_heap();
// Activate memory logging
+6 -11
View File
@@ -1,18 +1,17 @@
use crate::log::{Log, LOG};
use core::fmt;
use spin::MutexGuard;
#[cfg(feature = "serial_debug")]
use super::device::serial::{SerialPort, COM1};
#[cfg(feature = "graphical_debug")]
use crate::devices::graphical_debug::{DebugDisplay, DEBUG_DISPLAY};
use crate::{
devices::graphical_debug::{DebugDisplay, DEBUG_DISPLAY},
log::{Log, LOG},
};
pub struct Writer<'a> {
log: MutexGuard<'a, Option<Log>>,
#[cfg(feature = "serial_debug")]
serial: MutexGuard<'a, Option<SerialPort>>,
#[cfg(feature = "graphical_debug")]
display: MutexGuard<'a, Option<DebugDisplay>>,
}
@@ -20,7 +19,6 @@ impl<'a> Writer<'a> {
pub fn new() -> Writer<'a> {
Writer {
log: LOG.lock(),
#[cfg(feature = "graphical_debug")]
display: DEBUG_DISPLAY.lock(),
#[cfg(feature = "serial_debug")]
serial: COM1.lock(),
@@ -34,11 +32,8 @@ impl<'a> Writer<'a> {
}
}
#[cfg(feature = "graphical_debug")]
{
if let Some(ref mut display) = *self.display {
let _ = display.write(buf);
}
if let Some(ref mut display) = *self.display {
let _ = display.write(buf);
}
#[cfg(feature = "serial_debug")]
+2 -5
View File
@@ -15,13 +15,11 @@ use crate::{
use crate::{
arch::{device::serial::init_early, interrupt, paging},
device,
devices::graphical_debug,
dtb::register_dev_memory_ranges,
startup::memory::{register_bootloader_areas, register_memory_region, BootloaderMemoryKind},
};
#[cfg(feature = "graphical_debug")]
use crate::devices::graphical_debug;
use crate::dtb::register_dev_memory_ranges;
/// Test of zero values in BSS.
static mut BSS_TEST_ZERO: usize = 0;
/// Test of non-zero values in data.
@@ -101,7 +99,6 @@ pub unsafe extern "C" fn kstart(args_ptr: *const KernelArgs) -> ! {
.map(|(base, size)| unsafe { slice::from_raw_parts(base as *const u8, size) })
.and_then(|data| Fdt::new(data).ok());
#[cfg(feature = "graphical_debug")]
graphical_debug::init(env);
#[cfg(feature = "serial_debug")]
+6 -10
View File
@@ -5,11 +5,14 @@ use spin::MutexGuard;
#[cfg(any(feature = "lpss_debug", feature = "serial_debug"))]
use crate::devices::uart_16550::SerialPort;
use crate::log::{Log, LOG};
#[cfg(feature = "lpss_debug")]
use crate::syscall::io::Mmio;
#[cfg(any(feature = "qemu_debug", feature = "serial_debug"))]
use crate::syscall::io::Pio;
use crate::{
devices::graphical_debug::{DebugDisplay, DEBUG_DISPLAY},
log::{Log, LOG},
};
#[cfg(feature = "qemu_debug")]
use syscall::io::Io;
@@ -19,15 +22,12 @@ use super::device::serial::COM1;
use super::device::serial::LPSS;
#[cfg(feature = "system76_ec_debug")]
use super::device::system76_ec::{System76Ec, SYSTEM76_EC};
#[cfg(feature = "graphical_debug")]
use crate::devices::graphical_debug::{DebugDisplay, DEBUG_DISPLAY};
#[cfg(feature = "qemu_debug")]
pub static QEMU: Mutex<Pio<u8>> = Mutex::new(Pio::<u8>::new(0x402));
pub struct Writer<'a> {
log: MutexGuard<'a, Option<Log>>,
#[cfg(feature = "graphical_debug")]
display: MutexGuard<'a, Option<DebugDisplay>>,
#[cfg(feature = "lpss_debug")]
lpss: MutexGuard<'a, Option<&'static mut SerialPort<Mmio<u32>>>>,
@@ -43,7 +43,6 @@ impl<'a> Writer<'a> {
pub fn new() -> Writer<'a> {
Writer {
log: LOG.lock(),
#[cfg(feature = "graphical_debug")]
display: DEBUG_DISPLAY.lock(),
#[cfg(feature = "lpss_debug")]
lpss: LPSS.lock(),
@@ -63,11 +62,8 @@ impl<'a> Writer<'a> {
}
}
#[cfg(feature = "graphical_debug")]
{
if let Some(ref mut display) = *self.display {
display.write(buf);
}
if let Some(ref mut display) = *self.display {
display.write(buf);
}
#[cfg(feature = "lpss_debug")]
+3 -5
View File
@@ -13,12 +13,12 @@ use log::info;
#[cfg(feature = "acpi")]
use crate::acpi;
#[cfg(feature = "graphical_debug")]
use crate::devices::graphical_debug;
use crate::{
allocator,
cpu_set::LogicalCpuId,
device, gdt, idt, interrupt,
device,
devices::graphical_debug,
gdt, idt, interrupt,
paging::{self, PhysicalAddress, RmmA, RmmArch, TableKind},
startup::memory::{register_bootloader_areas, register_memory_region, BootloaderMemoryKind},
};
@@ -91,7 +91,6 @@ pub unsafe extern "C" fn kstart(args_ptr: *const KernelArgs) -> ! {
device::serial::init();
// Set up graphical debug
#[cfg(feature = "graphical_debug")]
graphical_debug::init(env);
#[cfg(feature = "system76_ec_debug")]
@@ -209,7 +208,6 @@ pub unsafe extern "C" fn kstart(args_ptr: *const KernelArgs) -> ! {
crate::profiling::init();
// Set up double buffer for graphical debug now that heap is available
#[cfg(feature = "graphical_debug")]
graphical_debug::init_heap();
idt::init_paging_post_heap(LogicalCpuId::BSP);
-1
View File
@@ -1,3 +1,2 @@
#[cfg(feature = "graphical_debug")]
pub mod graphical_debug;
pub mod uart_16550;
-1
View File
@@ -161,7 +161,6 @@ impl KernelScheme for DebugScheme {
}
if handle.num == SpecialFds::DisableGraphicalDebug as usize {
#[cfg(feature = "graphical_debug")]
graphical_debug::fini();
return Ok(0);
-1
View File
@@ -362,7 +362,6 @@ unsafe fn map_memory<A: Arch>(areas: &[MemoryArea], mut bump_allocator: &mut Bum
}
// Ensure graphical debug region remains paged
#[cfg(feature = "graphical_debug")]
{
use crate::devices::graphical_debug::FRAMEBUFFER;