From d341cb8b869f2e369db5df7d446e3bf619bb6579 Mon Sep 17 00:00:00 2001 From: Victoria Brekenfeld Date: Thu, 21 Mar 2024 17:49:06 +0100 Subject: [PATCH] debug: Drop puffin integration --- Cargo.lock | 82 ++---------------------------- Cargo.toml | 4 +- src/backend/kms/mod.rs | 3 -- src/backend/render/cursor.rs | 5 -- src/backend/render/mod.rs | 27 +--------- src/debug.rs | 25 --------- src/input/mod.rs | 1 - src/shell/grabs/moving.rs | 3 -- src/shell/layout/floating/mod.rs | 6 --- src/shell/layout/tiling/mod.rs | 9 ---- src/shell/mod.rs | 3 -- src/shell/workspace.rs | 6 --- src/wayland/handlers/screencopy.rs | 6 --- 13 files changed, 7 insertions(+), 173 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 32f837ca..33e01b51 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -423,15 +423,6 @@ version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" -[[package]] -name = "bincode" -version = "1.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" -dependencies = [ - "serde", -] - [[package]] name = "bit-set" version = "0.5.3" @@ -751,7 +742,7 @@ dependencies = [ "i18n-embed-fl", "iced_tiny_skia", "id_tree", - "indexmap 2.1.0", + "indexmap", "keyframe", "lazy_static", "libc", @@ -762,8 +753,6 @@ dependencies = [ "ordered-float", "png", "profiling", - "puffin", - "puffin_egui", "regex", "renderdoc", "ron", @@ -2461,17 +2450,6 @@ version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "029d73f573d8e8d63e6d5020011d3255b28c3ba85d6cf870a07184ed23de9284" -[[package]] -name = "indexmap" -version = "1.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" -dependencies = [ - "autocfg", - "hashbrown 0.12.3", - "serde", -] - [[package]] name = "indexmap" version = "2.1.0" @@ -2971,12 +2949,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "lz4_flex" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "912b45c753ff5f7f5208307e8ace7d2a2e30d024e26d3509f3dce546c044ce15" - [[package]] name = "malloc_buf" version = "0.0.6" @@ -3127,7 +3099,7 @@ dependencies = [ "bitflags 2.4.2", "codespan-reporting", "hexf-parse", - "indexmap 2.1.0", + "indexmap", "log", "num-traits", "rustc-hash", @@ -3146,12 +3118,6 @@ dependencies = [ "getrandom", ] -[[package]] -name = "natord" -version = "1.0.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "308d96db8debc727c3fd9744aac51751243420e46edf401010908da7f8d5e57c" - [[package]] name = "ndk" version = "0.8.0" @@ -3847,38 +3813,6 @@ dependencies = [ "syn 2.0.48", ] -[[package]] -name = "puffin" -version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39009d69b9d547c3ffa974a20648fa02f447c05bd0a664012b1ba5a5b06fb14e" -dependencies = [ - "anyhow", - "bincode", - "byteorder", - "cfg-if", - "lz4_flex", - "once_cell", - "parking_lot 0.12.1", - "serde", -] - -[[package]] -name = "puffin_egui" -version = "0.23.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5af236782d21bdd5a6eb2f8cc9a91f8d601c073b7f7d568c95c26604cc12b87" -dependencies = [ - "egui", - "indexmap 1.9.3", - "natord", - "once_cell", - "puffin", - "time", - "vec1", - "web-time", -] - [[package]] name = "qoi" version = "0.4.1" @@ -4495,7 +4429,7 @@ dependencies = [ "gbm", "gl_generator", "glow 0.12.3", - "indexmap 2.1.0", + "indexmap", "input", "lazy_static", "libc", @@ -4961,7 +4895,7 @@ version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ - "indexmap 2.1.0", + "indexmap", "toml_datetime", "winnow", ] @@ -4972,7 +4906,7 @@ version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d34d383cd00a163b4a5b85053df514d45bc330f6de7737edfe0a93311d1eaa03" dependencies = [ - "indexmap 2.1.0", + "indexmap", "serde", "serde_spanned", "toml_datetime", @@ -5325,12 +5259,6 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" -[[package]] -name = "vec1" -version = "1.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bda7c41ca331fe9a1c278a9e7ee055f4be7f5eb1c2b72f079b4ff8b5fce9d5c" - [[package]] name = "version_check" version = "0.9.4" diff --git a/Cargo.toml b/Cargo.toml index 968b72a1..4a3410a7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -35,8 +35,6 @@ log-panics = {version = "2", features = ["with-backtrace"]} once_cell = "1.18.0" ordered-float = "4.0" png = "0.17.5" -puffin = {version = "0.17.0", optional = true} -puffin_egui = {version = "0.23.0", optional = true} regex = "1" renderdoc = {version = "0.11.0", optional = true} ron = "0.8" @@ -94,7 +92,7 @@ optional = true rev = "cdc652e0" [features] -debug = ["egui", "egui_plot", "smithay-egui", "renderdoc", "puffin", "puffin_egui", "anyhow/backtrace"] +debug = ["egui", "egui_plot", "smithay-egui", "renderdoc", "anyhow/backtrace"] default = ["systemd"] systemd = ["libsystemd"] profile-with-tracy = ["profiling/profile-with-tracy"] diff --git a/src/backend/kms/mod.rs b/src/backend/kms/mod.rs index e5e57e42..3172a9e2 100644 --- a/src/backend/kms/mod.rs +++ b/src/backend/kms/mod.rs @@ -1162,9 +1162,6 @@ impl Surface { state: &mut Common, screencopy: Option<&[(ScreencopySession, BufferParams)]>, ) -> Result<()> { - #[cfg(feature = "debug")] - puffin::profile_function!(); - if self.surface.is_none() { return Ok(()); } diff --git a/src/backend/render/cursor.rs b/src/backend/render/cursor.rs index 2b62b412..ed585803 100644 --- a/src/backend/render/cursor.rs +++ b/src/backend/render/cursor.rs @@ -195,9 +195,6 @@ where R: Renderer + ImportAll, ::TextureId: 'static, { - #[cfg(feature = "debug")] - puffin::profile_function!(); - if get_role(&surface) != Some("dnd_icon") { warn!( ?surface, @@ -315,8 +312,6 @@ where R: Renderer + ImportMem + ImportAll, ::TextureId: Clone + 'static, { - #[cfg(feature = "debug")] - puffin::profile_function!(); // draw the cursor as relevant // reset the cursor if the surface is no longer alive let cursor_status = seat diff --git a/src/backend/render/mod.rs b/src/backend/render/mod.rs index df52ea12..e33da095 100644 --- a/src/backend/render/mod.rs +++ b/src/backend/render/mod.rs @@ -9,7 +9,7 @@ use std::{ }; #[cfg(feature = "debug")] -use crate::debug::{fps_ui, profiler_ui}; +use crate::debug::fps_ui; use crate::{ shell::{ focus::target::WindowGroup, @@ -402,9 +402,6 @@ where CosmicMappedRenderElement: RenderElement, E: From> + From>, { - #[cfg(feature = "debug")] - puffin::profile_function!(); - let scale = output.current_scale().fractional_scale(); let mut elements = Vec::new(); @@ -484,9 +481,6 @@ where CosmicMappedRenderElement: RenderElement, WorkspaceRenderElement: RenderElement, { - #[cfg(feature = "debug")] - puffin::profile_function!(); - let mut elements = cursor_elements(renderer, state, output, cursor_mode); #[cfg(feature = "debug")] @@ -510,20 +504,6 @@ where .map_err(RenderError::Rendering)?; elements.push(fps_overlay.into()); } - - if state.shell.outputs().next() == Some(output) { - if let Some(profiler_overlay) = profiler_ui( - state, - renderer.glow_renderer_mut(), - Rectangle::from_loc_and_size((0, 0), output_geo.size).as_logical(), - scale, - ) - .map_err(::Error::from) - .map_err(RenderError::Rendering)? - { - elements.push(profiler_overlay.into()); - } - } } // If session locked, only show session lock surfaces @@ -1056,9 +1036,6 @@ where WorkspaceRenderElement: RenderElement, Source: Clone, { - #[cfg(feature = "debug")] - puffin::profile_function!(); - if let Some(ref mut fps) = fps { fps.start(); #[cfg(feature = "debug")] @@ -1176,8 +1153,6 @@ where std::ptr::null(), ); } - - puffin::GlobalProfiler::lock().new_frame(); } res diff --git a/src/debug.rs b/src/debug.rs index ef8918aa..6a46fa8d 100644 --- a/src/debug.rs +++ b/src/debug.rs @@ -27,31 +27,6 @@ pub const RENDER_COLOR: Color32 = Color32::from_rgb(29, 114, 58); pub const SCREENCOPY_COLOR: Color32 = Color32::from_rgb(253, 178, 39); pub const DISPLAY_COLOR: Color32 = Color32::from_rgb(41, 184, 209); -pub fn profiler_ui( - state: &mut Common, - renderer: &mut GlowRenderer, - area: Rectangle, - scale: f64, -) -> Result>, GlesError> { - if !state.egui.active { - return Ok(None); - } - - state - .egui - .state - .render( - |ctx| { - puffin_egui::profiler_window(ctx); - }, - renderer, - area, - scale, - 0.8, - ) - .map(Some) -} - pub fn fps_ui( gpu: Option<&DrmNode>, state: &Common, diff --git a/src/input/mod.rs b/src/input/mod.rs index 282daab7..6f2b217a 100644 --- a/src/input/mod.rs +++ b/src/input/mod.rs @@ -1426,7 +1426,6 @@ impl State { #[cfg(feature = "debug")] Action::Debug => { self.common.egui.active = !self.common.egui.active; - puffin::set_scopes_on(self.common.egui.active); for mapped in self .common .shell diff --git a/src/shell/grabs/moving.rs b/src/shell/grabs/moving.rs index a6e3434b..9b22fad9 100644 --- a/src/shell/grabs/moving.rs +++ b/src/shell/grabs/moving.rs @@ -75,9 +75,6 @@ impl MoveGrabState { CosmicMappedRenderElement: RenderElement, I: From>, { - #[cfg(feature = "debug")] - puffin::profile_function!(); - let scale = if self.previous == ManagedLayer::Tiling { 0.6 + ((1.0 - (Instant::now().duration_since(self.start).as_millis() as f64 diff --git a/src/shell/layout/floating/mod.rs b/src/shell/layout/floating/mod.rs index f09fb25a..7cbad163 100644 --- a/src/shell/layout/floating/mod.rs +++ b/src/shell/layout/floating/mod.rs @@ -1097,9 +1097,6 @@ impl FloatingLayout { #[profiling::function] pub fn refresh(&mut self) { - #[cfg(feature = "debug")] - puffin::profile_function!(); - self.space.refresh(); if let Some(pos) = self.spawn_order.iter().position(|w| !w.alive()) { @@ -1171,9 +1168,6 @@ impl FloatingLayout { CosmicWindowRenderElement: RenderElement, CosmicStackRenderElement: RenderElement, { - #[cfg(feature = "debug")] - puffin::profile_function!(); - let output = self.space.outputs().next().unwrap(); let output_geometry = { let layers = layer_map_for_output(output); diff --git a/src/shell/layout/tiling/mod.rs b/src/shell/layout/tiling/mod.rs index 96ae33f4..f048af19 100644 --- a/src/shell/layout/tiling/mod.rs +++ b/src/shell/layout/tiling/mod.rs @@ -2305,9 +2305,6 @@ impl TilingLayout { #[profiling::function] pub fn refresh(&mut self) { - #[cfg(feature = "debug")] - puffin::profile_function!(); - let dead_windows = self .mapped() .map(|(w, _)| w.clone()) @@ -2941,9 +2938,6 @@ impl TilingLayout { tree: &mut Tree, gaps: (i32, i32), ) -> Option { - #[cfg(feature = "debug")] - puffin::profile_function!(); - if let Some(root_id) = tree.root_node_id() { let mut configures = Vec::new(); @@ -3827,9 +3821,6 @@ impl TilingLayout { CosmicWindowRenderElement: RenderElement, CosmicStackRenderElement: RenderElement, { - #[cfg(feature = "debug")] - puffin::profile_function!(); - let output_scale = self.output.current_scale().fractional_scale(); let (target_tree, duration, _) = if self.queue.animation_start.is_some() { diff --git a/src/shell/mod.rs b/src/shell/mod.rs index 8a156a93..53458187 100644 --- a/src/shell/mod.rs +++ b/src/shell/mod.rs @@ -1517,9 +1517,6 @@ impl Shell { #[profiling::function] pub fn refresh(&mut self) { - #[cfg(feature = "debug")] - puffin::profile_function!(); - self.popups.cleanup(); self.xdg_activation_state.retain_tokens(|_, data| { diff --git a/src/shell/workspace.rs b/src/shell/workspace.rs index 31262aa2..91231f15 100644 --- a/src/shell/workspace.rs +++ b/src/shell/workspace.rs @@ -288,9 +288,6 @@ impl Workspace { #[profiling::function] pub fn refresh(&mut self, xdg_activation_state: &XdgActivationState) { - #[cfg(feature = "debug")] - puffin::profile_function!(); - // TODO: `Option::take_if` once stabilitized if self.fullscreen.as_ref().is_some_and(|w| !w.alive()) { let _ = self.fullscreen.take(); @@ -1084,9 +1081,6 @@ impl Workspace { CosmicStackRenderElement: RenderElement, WorkspaceRenderElement: RenderElement, { - #[cfg(feature = "debug")] - puffin::profile_function!(); - let mut window_elements = Vec::new(); let mut popup_elements = Vec::new(); diff --git a/src/wayland/handlers/screencopy.rs b/src/wayland/handlers/screencopy.rs index 8a122c1b..a589c0f8 100644 --- a/src/wayland/handlers/screencopy.rs +++ b/src/wayland/handlers/screencopy.rs @@ -612,9 +612,6 @@ where usize, ) -> Result>, { - #[cfg(feature = "debug")] - puffin::profile_function!(); - let mut dt = session.user_data().get::().unwrap().borrow_mut(); let res = render_fn( @@ -926,9 +923,6 @@ pub fn render_window_to_buffer( params: BufferParams, window: &CosmicSurface, ) -> Result { - #[cfg(feature = "debug")] - puffin::profile_function!(); - let geometry = window.geometry(); let buffer_size = buffer_dimensions(¶ms.buffer).unwrap(); if buffer_size != geometry.size.to_buffer(1, Transform::Normal) {