graphics: Move disable-graphical-debug to driver-graphics
This ensures it graphical debug gets disabled even when vesad never runs.
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
#![feature(slice_as_array)]
|
||||
|
||||
use std::collections::{BTreeMap, HashMap};
|
||||
use std::io;
|
||||
use std::fs::File;
|
||||
use std::io::{self, Write};
|
||||
use std::mem::transmute;
|
||||
use std::sync::Arc;
|
||||
|
||||
@@ -53,6 +54,7 @@ pub struct GraphicsScheme<T: GraphicsAdapter> {
|
||||
adapter: T,
|
||||
|
||||
scheme_name: String,
|
||||
disable_graphical_debug: Option<File>,
|
||||
socket: Socket,
|
||||
next_id: usize,
|
||||
handles: BTreeMap<usize, Handle<T>>,
|
||||
@@ -83,9 +85,15 @@ impl<T: GraphicsAdapter> GraphicsScheme<T> {
|
||||
assert!(scheme_name.starts_with("display"));
|
||||
let socket = Socket::nonblock(&scheme_name).expect("failed to create graphics scheme");
|
||||
|
||||
let disable_graphical_debug = Some(
|
||||
File::open("/scheme/debug/disable-graphical-debug")
|
||||
.expect("vesad: Failed to open /scheme/debug/disable-graphical-debug"),
|
||||
);
|
||||
|
||||
GraphicsScheme {
|
||||
adapter,
|
||||
scheme_name,
|
||||
disable_graphical_debug,
|
||||
socket,
|
||||
next_id: 0,
|
||||
handles: BTreeMap::new(),
|
||||
@@ -111,6 +119,14 @@ impl<T: GraphicsAdapter> GraphicsScheme<T> {
|
||||
VtEventKind::Activate => {
|
||||
log::info!("activate {}", vt_event.vt);
|
||||
|
||||
// Disable the kernel graphical debug writing once switching vt's for the
|
||||
// first time. This way the kernel graphical debug remains enabled if the
|
||||
// userspace logging infrastructure doesn't start up because for example a
|
||||
// kernel panic happened prior to it starting up or logd crashed.
|
||||
if let Some(mut disable_graphical_debug) = self.disable_graphical_debug.take() {
|
||||
let _ = disable_graphical_debug.write(&[1]);
|
||||
}
|
||||
|
||||
self.active_vt = vt_event.vt;
|
||||
|
||||
let vt_state =
|
||||
|
||||
@@ -3,10 +3,8 @@ extern crate syscall;
|
||||
|
||||
use driver_graphics::GraphicsScheme;
|
||||
use event::{user_data, EventQueue};
|
||||
use inputd::{DisplayHandle, VtEventKind};
|
||||
use inputd::DisplayHandle;
|
||||
use std::env;
|
||||
use std::fs::File;
|
||||
use std::io::Write;
|
||||
use std::os::fd::AsRawFd;
|
||||
|
||||
use crate::scheme::{FbAdapter, FrameBuffer};
|
||||
@@ -103,11 +101,6 @@ fn inner(daemon: redox_daemon::Daemon, framebuffers: Vec<FrameBuffer>) -> ! {
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
let mut disable_graphical_debug = Some(
|
||||
File::open("/scheme/debug/disable-graphical-debug")
|
||||
.expect("vesad: Failed to open /scheme/debug/disable-graphical-debug"),
|
||||
);
|
||||
|
||||
libredox::call::setrens(0, 0).expect("vesad: failed to enter null namespace");
|
||||
|
||||
daemon.ready().expect("failed to notify parent");
|
||||
@@ -123,16 +116,6 @@ fn inner(daemon: redox_daemon::Daemon, framebuffers: Vec<FrameBuffer>) -> ! {
|
||||
.read_vt_event()
|
||||
.expect("vesad: failed to read display handle")
|
||||
{
|
||||
if let VtEventKind::Activate = vt_event.kind {
|
||||
// Disable the kernel graphical debug writing once switching vt's for the
|
||||
// first time. This way the kernel graphical debug remains enabled if the
|
||||
// userspace logging infrastructure doesn't start up because for example a
|
||||
// kernel panic happened prior to it starting up or logd crashed.
|
||||
if let Some(mut disable_graphical_debug) = disable_graphical_debug.take() {
|
||||
let _ = disable_graphical_debug.write(&[1]);
|
||||
}
|
||||
}
|
||||
|
||||
scheme.handle_vt_event(vt_event);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user