misterdownloadmanager: The ultimate open-source, clean-room download manager written from scratch in pure Rust for Windows, Mac, and Linux
Rust bittorrent-clientdebriddownload-acceleratordownload-managerdownloadmanagereguifile-downloadergallery-dlidmidm-alternativeinternet-download-managerm3u8-downloadermagnetplaylist-downloaderreal-debridrusttorrent-clientvideo-downloaderyoutube-downloaderyt-dlp
Direct3D's first-frame limit counts only Direct3D's time; reports say what drew and why (part of #280) (#288)
Ahmed Nefzaoui7943f9b2a286
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 8230be71..57c19bbf 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -616,6 +616,14 @@ choose. And Linux, checked on a real desktop with every change.### Fixed+- **Windows: a slow start no longer turns Direct3D off** (part of+ [#280](https://github.com/anefzaoui/misterdownloadmanager/issues/280)): MDM gives Direct3D 10+ seconds to show its first frame, and goes back to OpenGL when it doesn't. Those 10 seconds+ counted MDM's own loading too (the list, the fonts, the icons), which can take that long by+ itself on a busy computer just after it starts, so Direct3D was taken for failing and OpenGL drew+ from then on. Only Direct3D's own time counts now. Crash and freeze reports say what drew, on+ which graphics card and driver (OpenGL's too), and why, near their top, where a report cut to fit+ still has it.- **Linux: torrents work on a system without CA certificates too** (part of[#264](https://github.com/anefzaoui/misterdownloadmanager/issues/264)): the torrent engine builtits own connection for the trackers, which can't be made without them, so no torrent or magnetdiff --git a/ROADMAP.md b/ROADMAP.mdindex 7bea9749..ac7c5adb 100644--- a/ROADMAP.md+++ b/ROADMAP.md@@ -408,6 +408,10 @@ Everything below ships together, in the next release.([#208](https://github.com/anefzaoui/misterdownloadmanager/issues/208)): menus are plain pop-upwindows now, as Windows' own are, and the reporter confirmed them fixed; the drop target is onetoo, its test build is with the reporter+- π A freeze inside a graphics card's OpenGL driver on Windows+ ([#280](https://github.com/anefzaoui/misterdownloadmanager/issues/280)): a slow start no longer+ turns Direct3D off (its first-frame limit counted MDM's own loading), and reports now say what+ drew, on which card and driver, and why; waiting to hear which one drew there- π Menus opening as the pointer crosses the menu bar on a tiling window manager([#277](https://github.com/anefzaoui/misterdownloadmanager/issues/277)): after a command thebar waits for a click, as before the first one (now tested on Windows and Linux); once a menu isdiff --git a/crates/app/src/app.rs b/crates/app/src/app.rsindex 78943b81..e16b60dc 100644--- a/crates/app/src/app.rs+++ b/crates/app/src/app.rs@@ -8070,7 +8070,10 @@ impl eframe::App for App {/// (#162). A command that opens a window gets the UI pass that creates it, minimized or not/// (no window is raised or focused for it beyond what the command itself does).fn logic(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) {+ // MDM's own work: not counted as the graphics API's time to its first frame (#280).+ crate::renderer::own_work_begin();self.tick(ctx);+ crate::renderer::own_work_end();}fn ui(&mut self, ui: &mut Ui, frame: &mut eframe::Frame) {diff --git a/crates/app/src/main.rs b/crates/app/src/main.rsindex 714633c5..5186a2b5 100644--- a/crates/app/src/main.rs+++ b/crates/app/src/main.rs@@ -399,6 +399,7 @@ fn app() -> eframe::Result {let result = renderer::run("misterdownloadmanager", &plan, options, move |cc| {scale::start(&cc.egui_ctx, z);let _ = window.set(cc.egui_ctx.clone());+ renderer::test_slow_start();app::App::new(&cc.egui_ctx, handle, commands, sink, loaded, start)});crash::clean_exit();diff --git a/crates/app/src/renderer.rs b/crates/app/src/renderer.rsindex 36f4ee3d..a91a9d78 100644--- a/crates/app/src/renderer.rs+++ b/crates/app/src/renderer.rs@@ -168,6 +168,42 @@ fn parse(name: &str) -> Option<Attempt> {pub struct Plan {pub attempts: Vec<Attempt>,pub watched: bool,+ /// Why the first way is the one tried first, for the log and the crash reports.+ pub because: Because,+}++/// Why a plan's first way is tried first (#280: a report drawn with OpenGL where Direct3D is the+/// default must say why).+#[derive(Clone, Copy, Debug, PartialEq, Eq)]+pub enum Because {+ /// Chosen in View β Draw with.+ Chosen,+ /// Nothing chosen (or another system's API): this system's default.+ Default,+ /// `/renderer` or `MDM_RENDERER`.+ Override,+ /// The system's API is the choice, but it failed here before: OpenGL until it is chosen+ /// again.+ FailedBefore,+}++impl Because {+ /// Its words after "Drawing with: β¦" (`api`: the system's API's name).+ fn words(self, api: &str) -> String {+ match self {+ Because::Chosen => "chosen in View β Draw with".into(),+ Because::Default => "the default here".into(),+ Because::Override => "the testing override (/renderer, MDM_RENDERER)".into(),+ Because::FailedBefore => format!(+ "{api} failed here before: {}",+ FAILED_DETAILS+ .lock()+ .ok()+ .and_then(|d| d.clone())+ .unwrap_or_default()+ ),+ }+ }}/// What to try: the override if any, else the setting (or [`DEFAULT`]) unless the system's API@@ -186,10 +222,23 @@ pub fn plan(setting: Option<Api>, overridden: Option<&str>, failed_before: bool)}a});- let first = match forced {- Some(a) => a,- None if Some(chosen(setting)) == GPU && !failed_before => Attempt::Gpu(Adapters::Hardware),- None => Attempt::OpenGl,+ let wants_gpu = Some(chosen(setting)) == GPU;+ let (first, because) = match forced {+ Some(a) => (a, Because::Override),+ None if wants_gpu && failed_before => (Attempt::OpenGl, Because::FailedBefore),+ None => (+ if wants_gpu {+ Attempt::Gpu(Adapters::Hardware)+ } else {+ Attempt::OpenGl+ },+ // Only this system's own choices count as chosen (chosen()).+ if setting.is_some_and(|s| s == chosen(setting)) {+ Because::Chosen+ } else {+ Because::Default+ },+ ),};let then: &[Attempt] = match first {Attempt::OpenGl => &[Attempt::Gpu(Adapters::Any)],@@ -205,6 +254,7 @@ pub fn plan(setting: Option<Api>, overridden: Option<&str>, failed_before: bool)Plan {watched: forced.is_none() && attempts.first() == Some(&Attempt::Gpu(Adapters::Hardware)),attempts,+ because,}}@@ -279,6 +329,9 @@ impl Why {/// why.static GPU_FAILED: Mutex<Option<Why>> = Mutex::new(None);+/// The details of that failure, as its file has them (for the crash reports).+static FAILED_DETAILS: Mutex<Option<String>> = Mutex::new(None);+fn set_failed(why: Option<Why>) {if let Ok(mut f) = GPU_FAILED.lock() {*f = why;@@ -313,6 +366,9 @@ pub fn failed_before() -> Option<String> {let (why, details) = Why::read(&text);tracing::info!("{api} failed here before ({why:?}: {details})");set_failed(Some(why));+ if let Ok(mut d) = FAILED_DETAILS.lock() {+ *d = Some(details.to_owned());+ }Some(details.to_owned())}@@ -348,8 +404,23 @@ fn testing(name: &str) -> bool {crate::offscreen() && std::env::var_os(name).is_some_and(|v| v == "1")}+/// MDM_TEST_SLOW_START=<ms> (off-screen test copies): making the app takes that much longer, as+/// on a slow computer just after it starts (#280, the first frame's clock).+pub fn test_slow_start() {+ let ms = std::env::var("MDM_TEST_SLOW_START")+ .ok()+ .and_then(|v| v.trim().parse::<u64>().ok())+ .filter(|_| crate::offscreen());+ if let Some(ms) = ms {+ tracing::info!("testing: making the app {ms} ms slower");+ std::thread::sleep(std::time::Duration::from_millis(ms));+ }+}+/// The start of every main-window pass: the system's API's device checked (see `gpu::poll`).+/// The pass itself is MDM's own work, not the API's (see [`FirstFrameClock`]).pub fn frame_begin() {+ own_work_begin();#[cfg(gpu)]gpu::poll();}@@ -361,6 +432,7 @@ static DRAWN: AtomicBool = AtomicBool::new(false);/// frame count, not its passes: a first frame can run two), the first was drawn: a watched/// start made it.pub fn frame_done(ctx: &egui::Context) {+ own_work_end();if DRAWN.load(Ordering::Relaxed) || ctx.cumulative_frame_nr() == 0 {return;}@@ -370,12 +442,88 @@ pub fn frame_done(ctx: &egui::Context) {return;}DRAWN.store(true, Ordering::Relaxed);- tracing::info!("first frame drawn, {} ms after start", since_start());+ let api = clock_counted().map_or(String::new(), |d| {+ format!(" ({} ms of it counted for the API)", d.as_millis())+ });+ tracing::info!("first frame drawn, {} ms after start{api}", since_start());if let Some(f) = file(STARTING) {let _ = std::fs::remove_file(f);}}+// ---- The first frame's clock ----------------------------------------------------------------++/// How long a watched start has been the graphics API's to bring its first frame: the time from+/// the start of [`run`] to the first frame, less MDM's own work meanwhile (making the app:+/// loading the list, the fonts, the icons; and its passes' logic and layout), which isn't the+/// API's. A slow computer just after it starts can spend more than [`FIRST_FRAME_WITHIN`] there+/// alone, and that was counted as Direct3D drawing no first frame: MDM started again with OpenGL+/// and kept it (#280).+#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]+struct FirstFrameClock {+ /// Counted before the stretch now running.+ counted: std::time::Duration,+ /// Since when it runs; None while MDM's own work pauses it.+ since: Option<std::time::Instant>,+}++impl FirstFrameClock {+ fn started(now: std::time::Instant) -> Self {+ FirstFrameClock {+ counted: std::time::Duration::ZERO,+ since: Some(now),+ }+ }++ /// MDM's own work begins: not counted.+ fn pause(&mut self, now: std::time::Instant) {+ if let Some(since) = self.since.take() {+ self.counted += now.saturating_duration_since(since);+ }+ }++ /// MDM's own work is done: the API's turn again.+ fn resume(&mut self, now: std::time::Instant) {+ self.since.get_or_insert(now);+ }++ fn counted(&self, now: std::time::Instant) -> std::time::Duration {+ self.counted+ + self.since.map_or(std::time::Duration::ZERO, |s| {+ now.saturating_duration_since(s)+ })+ }+}++/// The watched start's clock (None when no start is watched).+static CLOCK: Mutex<Option<FirstFrameClock>> = Mutex::new(None);++fn with_clock<R>(f: impl FnOnce(&mut FirstFrameClock, std::time::Instant) -> R) -> Option<R> {+ let mut c = CLOCK.lock().ok()?;+ let now = std::time::Instant::now();+ c.as_mut().map(|c| f(c, now))+}++/// MDM's own work begins (the app being made, a pass's logic and layout): the first-frame clock+/// stops until [`own_work_end`].+pub fn own_work_begin() {+ if !DRAWN.load(Ordering::Relaxed) {+ with_clock(|c, now| c.pause(now));+ }+}++/// MDM's own work is done: the first-frame clock runs again.+pub fn own_work_end() {+ if !DRAWN.load(Ordering::Relaxed) {+ with_clock(|c, now| c.resume(now));+ }+}++/// The time counted for the API so far (a watched start only).+fn clock_counted() -> Option<std::time::Duration> {+ with_clock(|c, now| c.counted(now))+}+// ---- What draws now ---------------------------------------------------------------------------static START: OnceLock<std::time::Instant> = OnceLock::new();@@ -439,6 +587,9 @@ pub fn run<A: eframe::App + 'static>(// A watched start must show its first frame in time, or MDM starts again.#[cfg(gpu)]if n == 0 && plan.watched {+ if let Ok(mut c) = CLOCK.lock() {+ *c = Some(FirstFrameClock::started(std::time::Instant::now()));+ }gpu::watch_first_frame();}#[cfg(gpu)]@@ -447,14 +598,22 @@ pub fn run<A: eframe::App + 'static>(configure(&mut opts, attempt);tracing::info!("drawing with {}", attempt.name());let make = creator.clone();- let why_not = instead.clone();+ // Why this way: the plan's reason for its first, the last one's failure for another.+ let why_not = match &instead {+ Some(w) => w.clone(),+ None => plan.because.words(GPU.map_or("", |g| g.name())),+ };result = eframe::run_native(name,opts,Box::new(move |cc| {let make = make.borrow_mut().take().ok_or("the app was already made")?;started(cc, attempt, why_not);- Ok(Box::new(make(cc)))+ // Making the app is MDM's own work, not the API's: off the first frame's clock.+ own_work_begin();+ let app = make(cc);+ own_work_end();+ Ok(Box::new(app))}),);// A failure after the app was made is the app's own (or a later one): no retry.@@ -504,27 +663,35 @@ fn configure(opts: &mut eframe::NativeOptions, attempt: Attempt) {}/// The app is being made: what draws is known.-fn started(cc: &eframe::CreationContext<'_>, attempt: Attempt, instead: Option<String>) {+/// `why`: why this way (the plan's reason, or why the way before it didn't start).+fn started(cc: &eframe::CreationContext<'_>, attempt: Attempt, why: String) {#[cfg(gpu)]- let detail = match &cc.wgpu_render_state {- Some(rs) => gpu::describe(&rs.adapter.get_info()),- None => attempt.name().to_owned(),- };+ let gpu = cc+ .wgpu_render_state+ .as_ref()+ .map(|rs| gpu::describe(&rs.adapter.get_info()));#[cfg(not(gpu))]- let detail = {- let _ = cc;- attempt.name().to_owned()- };+ let gpu: Option<String> = None;+ // OpenGL names its card and driver too (#280: a freeze inside Intel's OpenGL driver came+ // with "OpenGL" alone).+ #[cfg(unix)]+ use crate::unix::gl_driver;+ #[cfg(windows)]+ use crate::win32::gl_driver;+ let detail = gpu+ .or_else(|| {+ cc.gl+ .as_ref()+ .map(|gl| format!("{} on {}", attempt.name(), gl_driver(gl)))+ })+ .unwrap_or_else(|| attempt.name().to_owned());tracing::info!(- "drawing with {detail}, {} ms after start{}",- since_start(),- instead- .as_deref()- .map(|w| format!(" ({w})"))- .unwrap_or_default()+ "drawing with {detail}, {} ms after start ({why})",+ since_start());- // The crash reports say it ("Direct3D 12 on Intel(R) UHD Graphics 620 (driver β¦)").- crate::crash::renderer(&detail);+ // The crash reports say it, and why ("OpenGL on Intel(R) UHD Graphics 620 (4.6.0 - Build β¦)+ // β Direct3D 12 failed here before: β¦").+ crate::crash::renderer(&format!("{detail} β {why}"));// Errors are logged, not panics, and a lost graphics card starts MDM again.#[cfg(gpu)]if let Some(rs) = &cc.wgpu_render_state {@@ -543,12 +710,15 @@ pub fn test_device_lost() {/// eframe's wgpu set up for the system's API only: Direct3D 12, Vulkan or Metal.#[cfg(gpu)]mod gpu {- use super::{Adapters, DRAWN, FIRST_FRAME_WITHIN, GPU, Why, file, remember_failure, testing};+ use super::{+ Adapters, DRAWN, FIRST_FRAME_WITHIN, GPU, Why, clock_counted, file, remember_failure,+ testing,+ };use eframe::egui_wgpu::{WgpuConfiguration, WgpuSetup, WgpuSetupCreateNew};use eframe::wgpu;use std::sync::Arc;use std::sync::atomic::{AtomicBool, Ordering};- use std::time::{Duration, Instant, SystemTime};+ use std::time::{Duration, SystemTime};/// The API's name in the log and the crash reports.fn api() -> &'static str {@@ -566,8 +736,9 @@ mod gpu {let _ = std::thread::Builder::new().name("first frame watch".into()).spawn(|| {- let until = Instant::now() + FIRST_FRAME_WITHIN;- while Instant::now() < until {+ // The API's time only: MDM's own work meanwhile isn't counted (#280).+ let over = || clock_counted().is_some_and(|d| d >= FIRST_FRAME_WITHIN);+ while !over() {if DRAWN.load(Ordering::Relaxed) || !TRYING.load(Ordering::Relaxed) {return;}@@ -577,9 +748,10 @@ mod gpu {return;}let why = format!(- "{} drew no first frame within {} s",+ "{} drew no first frame within {} s ({} s after start)",api(),- FIRST_FRAME_WITHIN.as_secs()+ FIRST_FRAME_WITHIN.as_secs(),+ super::since_start() / 1000);remember_failure(Why::NoFirstFrame, &why);// Remembered as this reason, not as a start that ended before its first frame.@@ -981,4 +1153,75 @@ mod tests {assert_eq!(choose(&l, Adapters::Hardware, true), Some(1));assert_eq!(choose(&[(VirtualGpu, true)], Adapters::Any, true), Some(0));}++ /// The first frame's clock counts the API's time only: MDM's own work (making the app, its+ /// passes) is left out, so a slow start of MDM's isn't taken for Direct3D failing (#280: 10.7+ /// s from OpenGL's context to the first frame on the reporter's computer, at the 10 s limit).+ #[test]+ fn the_first_frame_clock_leaves_out_mdms_own_work() {+ use std::time::{Duration, Instant};+ let s = |n: u64| Duration::from_secs(n);+ let t0 = Instant::now();+ let mut c = FirstFrameClock::started(t0);+ // The window and the device: 2 s, the API's.+ assert_eq!(c.counted(t0 + s(2)), s(2));+ // The app made in 12 s: not counted, however long.+ c.pause(t0 + s(2));+ assert_eq!(c.counted(t0 + s(14)), s(2));+ c.resume(t0 + s(14));+ // Its first pass, 3 s of MDM's, then 1 s of painting and presenting.+ c.pause(t0 + s(14));+ c.resume(t0 + s(17));+ assert_eq!(c.counted(t0 + s(18)), s(3));+ assert!(c.counted(t0 + s(18)) < FIRST_FRAME_WITHIN);+ // A driver stuck in its first present is still caught: only its time runs.+ assert!(c.counted(t0 + s(25)) >= FIRST_FRAME_WITHIN);+ // Pausing twice, or resuming a running clock, changes nothing.+ let mut d = FirstFrameClock::started(t0);+ d.pause(t0 + s(1));+ d.pause(t0 + s(5));+ d.resume(t0 + s(6));+ d.resume(t0 + s(8));+ assert_eq!(d.counted(t0 + s(9)), s(4));+ }++ /// Why the first way is tried, for the log and the crash reports (#280).+ #[test]+ fn a_plan_says_why() {+ let Some(api) = GPU else {+ assert_eq!(+ plan(Some(Api::OpenGl), None, false).because,+ Because::Chosen+ );+ return;+ };+ assert_eq!(plan(None, None, false).because, Because::Default);+ assert_eq!(plan(Some(api), None, false).because, Because::Chosen);+ assert_eq!(+ plan(Some(Api::OpenGl), None, false).because,+ Because::Chosen+ );+ assert_eq!(plan(Some(Api::OpenGl), None, true).because, Because::Chosen);+ assert_eq!(plan(Some(api), None, true).because, Because::FailedBefore);+ assert_eq!(+ plan(Some(api), Some("opengl"), true).because,+ Because::Override+ );+ // The default fails like a choice where the default is the system's API (Windows).+ let failed_default = plan(None, None, true).because;+ if DEFAULT == api {+ assert_eq!(failed_default, Because::FailedBefore);+ } else {+ assert_eq!(failed_default, Because::Default);+ }+ assert_eq!(+ Because::Chosen.words("Direct3D 12"),+ "chosen in View β Draw with"+ );+ assert!(+ Because::FailedBefore+ .words("Direct3D 12")+ .starts_with("Direct3D 12 failed here before: ")+ );+ }}diff --git a/crates/app/src/unix.rs b/crates/app/src/unix.rsindex 3d409e48..eb0f31e9 100644--- a/crates/app/src/unix.rs+++ b/crates/app/src/unix.rs@@ -1717,6 +1717,23 @@ pub fn process_alive(pid: u32) -> bool {unsafe { libc::kill(pid as libc::pid_t, 0) == 0 }}+/// The OpenGL driver in its own words, for the log and the crash reports (#280): its renderer+/// (the graphics card) and version (Mesa's carries its own: "4.6 (Core Profile) Mesa 24.0.5").+/// Windows: win32.rs.+#[allow(unsafe_code)]+pub fn gl_driver(gl: &eframe::glow::Context) -> String {+ use eframe::glow::{self, HasContext as _};+ // SAFETY: called while eframe makes the app, with its context current on this thread;+ // glGetString only reads the driver's strings.+ let (renderer, version) = unsafe {+ (+ gl.get_parameter_string(glow::RENDERER),+ gl.get_parameter_string(glow::VERSION),+ )+ };+ format!("{renderer} ({version})")+}+/// End process `pid` (a frozen MDM the user chose to close from the crash report).#[allow(unsafe_code)]pub fn end_process(pid: u32) -> bool {diff --git a/crates/app/src/win32.rs b/crates/app/src/win32.rsindex 120ec2cb..b4f7e67f 100644--- a/crates/app/src/win32.rs+++ b/crates/app/src/win32.rs@@ -2848,6 +2848,22 @@ pub fn cli_console(launcher: Option<u32>) {}}+/// The OpenGL driver in its own words, for the log and the crash reports (#280): its renderer+/// (the graphics card) and version, which on Windows carries the driver's build (Intel's+/// "4.6.0 - Build 31.0.101.β¦", NVIDIA's "4.6.0 NVIDIA 5xx.xx"). Linux and macOS: unix.rs.+pub fn gl_driver(gl: &eframe::glow::Context) -> String {+ use eframe::glow::{self, HasContext as _};+ // SAFETY: called while eframe makes the app, with its context current on this thread;+ // glGetString only reads the driver's strings.+ let (renderer, version) = unsafe {+ (+ gl.get_parameter_string(glow::RENDERER),+ gl.get_parameter_string(glow::VERSION),+ )+ };+ format!("{renderer} ({version})")+}+/// End process `pid` (a frozen MDM the user chose to close from the crash report).pub fn end_process(pid: u32) -> bool {use windows_sys::Win32::Foundation::CloseHandle;diff --git a/crates/crash/src/report.rs b/crates/crash/src/report.rsindex b0949c16..93c399ef 100644--- a/crates/crash/src/report.rs+++ b/crates/crash/src/report.rs@@ -50,6 +50,13 @@ pub fn text(input: &Input, home: Option<&Path>) -> String {if let Some(d) = &input.dump {let _ = writeln!(s, "Dump: {d}");}+ // What draws, and why, at the top: a freeze or a crash inside a graphics driver is read from+ // it, and the end of a long report is what a size limit cuts (#280).+ if let Some(r) = input.notes.session.as_ref().map(|ss| &ss.renderer)+ && !r.is_empty()+ {+ let _ = writeln!(s, "Drawing with: {r}");+ }let _ = writeln!(s);// What went wrong.@@ -170,9 +177,6 @@ pub fn text(input: &Input, home: Option<&Path>) -> String {let _ = writeln!(s, "System: {} ({})", ss.os_version, ss.arch);let _ = writeln!(s, "Language: {}", ss.language);let _ = writeln!(s, "Theme: {}", if ss.dark { "dark" } else { "light" });- if !ss.renderer.is_empty() {- let _ = writeln!(s, "Drawing with: {}", ss.renderer);- }let _ = writeln!(s, "Program: {}", ss.exe);if let Ok(now) = chrono::DateTime::parse_from_rfc3339(&input.time) {let up = now.timestamp() - ss.started;@@ -705,6 +709,38 @@ mod tests {assert!(t.contains("-- Thread watchdog (2) --"));}+ /// What drew, and why, is in the report's head, before the stack and the log: a report cut+ /// to fit an issue still says it (#280, a freeze inside Intel's OpenGL driver).+ #[test]+ fn the_renderer_is_named_at_the_top() {+ let a = frozen();+ let drawing = "OpenGL on Intel(R) UHD Graphics 620 (4.6.0 - Build 31.0.101.2125) β Direct3D 12 failed here before: Direct3D 12 drew no first frame within 10 s";+ let input = Input {+ kind: Some(Kind::Freeze),+ time: "2026-11-07T15:13:03Z".into(),+ notes: Notes {+ session: Some(Session {+ renderer: drawing.into(),+ ..Default::default()+ }),+ ..Default::default()+ },+ analysis: Some(&a),+ log_tail: vec!["a log line".into()],+ dump: Some("x-freeze.dmp".into()),+ };+ let t = text(&input, None);+ let line = format!("Drawing with: {drawing}");+ let at = t.find(&line).expect("named");+ assert_eq!(t.matches(&line).count(), 1, "once");+ assert!(at < t.find("a log line").unwrap());+ assert!(at < t.find("-- System details --").unwrap());+ // Nothing to say when the window never started.+ let mut none = input.clone();+ none.notes.session = Some(Session::default());+ assert!(!text(&none, None).contains("Drawing with"));+ }+fn freeze_with(a: &Analysis, cpu_ms: u64) -> Input<'_> {Input {kind: Some(Kind::Freeze),diff --git a/docs/troubleshooting.md b/docs/troubleshooting.mdindex 099dfd75..9728842a 100644--- a/docs/troubleshooting.md+++ b/docs/troubleshooting.md@@ -80,12 +80,13 @@ On Windows, MDM draws its windows with Direct3D 12; on Linux and macOS, with Ope*View β Draw with: the other way of drawing.*-- If Direct3D, Vulkan or Metal can't start on your computer (no driver for it, some virtual machines), or its first window doesn't show within 10 seconds, MDM draws with OpenGL, and **View β Draw with** says so and why. Choosing it again tries it again at the next start.+- If Direct3D, Vulkan or Metal can't start on your computer (no driver for it, some virtual machines), or its first window doesn't show within 10 seconds of its own (the time MDM spends loading your list and its icons doesn't count, however slow the computer is just after it starts), MDM draws with OpenGL, and **View β Draw with** says so and why. Choosing it again tries it again at the next start.- On Linux, Vulkan needs your graphics card's Vulkan driver: Mesa's (`mesa-vulkan-drivers` on Ubuntu and Debian, `vulkan-radeon` or `vulkan-intel` on Arch) for AMD and Intel, NVIDIA's own driver for NVIDIA.- If neither can start, MDM draws with a software renderer (Microsoft's on Windows, Mesa's on Linux), so the window still opens (Remote Desktop, a virtual machine without a graphics driver). It works, but keeps the processor busier.- If the graphics card is reset while MDM runs (a driver update), MDM starts again by itself. Lost twice in 10 minutes, it goes back to OpenGL, and **View β Draw with** says why.- Updating the graphics driver from the card maker's site (Intel, AMD or NVIDIA) fixes many of these problems.-- A freeze or crash report says which one was drawing: include it when you report a problem. A freeze report also says whether MDM was busy, waiting, or hardly ran at all (a computer too busy to run it); see [Crash reports](crash-reports.md).+- A freeze whose report shows the window thread inside the graphics driver as it shows a frame (`ig4icd64.dll` or `ig9icd64.dll` for Intel, `nvoglv64.dll` for NVIDIA, `atio6axx.dll` for AMD, under `opengl32.dll`) is the driver's OpenGL stuck, not MDM: on Windows, choose **View β Draw with β Direct3D** (the default) and restart MDM, and update the graphics driver. If **Draw with** says Direct3D didn't start there, the line under it says why.+- A freeze or crash report says which one was drawing, on which graphics card and driver, and why that one (chosen, the default, or the other one failing), on its `Drawing with:` line near the top: include it when you report a problem. A freeze report also says whether MDM was busy, waiting, or hardly ran at all (a computer too busy to run it); see [Crash reports](crash-reports.md).## The setup or MDM won't start