From a65e1d6b5fc2f72dddb38cb8a90aba019a1a24bc Mon Sep 17 00:00:00 2001 From: Victoria Brekenfeld Date: Tue, 20 May 2025 17:54:12 +0200 Subject: [PATCH] debug: More profiling annotations --- src/backend/kms/surface/mod.rs | 4 ++++ src/input/actions.rs | 1 + src/input/mod.rs | 4 ++++ src/shell/focus/mod.rs | 3 +++ src/shell/mod.rs | 1 + src/state.rs | 3 +++ src/wayland/protocols/overlap_notify.rs | 1 + src/xwayland.rs | 3 +++ 8 files changed, 20 insertions(+) diff --git a/src/backend/kms/surface/mod.rs b/src/backend/kms/surface/mod.rs index db5dc2cf..44ee6e1d 100644 --- a/src/backend/kms/surface/mod.rs +++ b/src/backend/kms/surface/mod.rs @@ -725,6 +725,7 @@ impl SurfaceThreadState { //self.software_api.as_mut().remove_node(node); } + #[profiling::function] fn on_vblank(&mut self, metadata: Option) { let Some(compositor) = self.compositor.as_mut() else { return; @@ -851,6 +852,7 @@ impl SurfaceThreadState { } } + #[profiling::function] fn on_estimated_vblank(&mut self, force: bool) { match mem::replace(&mut self.state, QueueState::Idle) { QueueState::Idle => unreachable!(), @@ -949,6 +951,7 @@ impl SurfaceThreadState { } } + #[profiling::function] fn redraw(&mut self, estimated_presentation: Duration) -> Result<()> { let Some(compositor) = self.compositor.as_mut() else { return Ok(()); @@ -1826,6 +1829,7 @@ fn source_node_for_surface(w: &WlSurface) -> Option { // TODO: Introduce can_shared_dmabuf_framebuffer for cases where we might select another gpu // and composite on target if not possible to finally get rid of "primary" +#[profiling::function] fn render_node_for_output( output: &Output, primary_node: &DrmNode, diff --git a/src/input/actions.rs b/src/input/actions.rs index 84cc9000..268c1153 100644 --- a/src/input/actions.rs +++ b/src/input/actions.rs @@ -122,6 +122,7 @@ impl State { } } + #[profiling::function] pub fn handle_shortcut_action( &mut self, action: shortcuts::Action, diff --git a/src/input/mod.rs b/src/input/mod.rs index c9023d68..e7aef5cf 100644 --- a/src/input/mod.rs +++ b/src/input/mod.rs @@ -161,6 +161,7 @@ impl ModifiersShortcutQueue { } impl State { + #[profiling::function] pub fn process_input_event(&mut self, event: InputEvent) where ::Device: 'static, @@ -1504,6 +1505,7 @@ impl State { } /// Determine is key event should be intercepted as a key binding, or forwarded to surface + #[profiling::function] pub fn filter_keyboard_input>( &mut self, event: &E, @@ -1958,6 +1960,7 @@ impl State { } } + #[profiling::function] pub fn element_under( global_pos: Point, output: &Output, @@ -2084,6 +2087,7 @@ impl State { .flatten() } + #[profiling::function] pub fn surface_under( global_pos: Point, output: &Output, diff --git a/src/shell/focus/mod.rs b/src/shell/focus/mod.rs index a46f4027..01323d70 100644 --- a/src/shell/focus/mod.rs +++ b/src/shell/focus/mod.rs @@ -99,6 +99,7 @@ impl Shell { /// Set the keyboard focus to the given target /// Note: `update_cursor` is used to determine whether to update the pointer location if cursor_follows_focus is enabled /// if the focus change was due to a pointer event, this should be set to false + #[profiling::function] pub fn set_focus( state: &mut State, target: Option<&KeyboardFocusTarget>, @@ -224,6 +225,7 @@ impl Shell { } /// Internal, used to ensure that ActiveFocus, KeyboardFocusTarget, and FocusedOutput are all in sync +#[profiling::function] fn update_focus_state( seat: &Seat, target: Option<&KeyboardFocusTarget>, @@ -327,6 +329,7 @@ fn raise_with_children(floating_layer: &mut FloatingLayout, focused: &CosmicMapp } impl Common { + #[profiling::function] pub fn refresh_focus(state: &mut State) { let seats = state .common diff --git a/src/shell/mod.rs b/src/shell/mod.rs index aa194492..4a69af2f 100644 --- a/src/shell/mod.rs +++ b/src/shell/mod.rs @@ -1408,6 +1408,7 @@ impl Common { self.idle_notifier_state.set_is_inhibited(is_inhibited); } + #[profiling::function] pub fn on_commit(&mut self, surface: &WlSurface) { { let shell = self.shell.read(); diff --git a/src/state.rs b/src/state.rs index 12e8973e..1a7de6fc 100644 --- a/src/state.rs +++ b/src/state.rs @@ -695,6 +695,7 @@ fn primary_scanout_output_compare<'a>( } impl Common { + #[profiling::function] pub fn update_primary_output( &self, output: &Output, @@ -796,6 +797,7 @@ impl Common { } } + #[profiling::function] pub fn send_dmabuf_feedback( &self, output: &Output, @@ -946,6 +948,7 @@ impl Common { } } + #[profiling::function] pub fn send_frames(&self, output: &Output, sequence: Option) { let time = self.clock.now(); let should_send = |surface: &WlSurface, states: &SurfaceData| { diff --git a/src/wayland/protocols/overlap_notify.rs b/src/wayland/protocols/overlap_notify.rs index ed47f9f3..cb4cc35d 100644 --- a/src/wayland/protocols/overlap_notify.rs +++ b/src/wayland/protocols/overlap_notify.rs @@ -71,6 +71,7 @@ impl OverlapNotifyState { self.global.clone() } + #[profiling::function] pub fn refresh(state: &mut D) where D: GlobalDispatch diff --git a/src/xwayland.rs b/src/xwayland.rs index 27662804..cabf683c 100644 --- a/src/xwayland.rs +++ b/src/xwayland.rs @@ -317,6 +317,7 @@ impl Common { } } + #[profiling::function] pub fn xwayland_notify_key_event( &mut self, sym: Keysym, @@ -400,6 +401,7 @@ impl Common { } } + #[profiling::function] pub fn xwayland_notify_pointer_button_event( &mut self, button: u32, @@ -449,6 +451,7 @@ impl Common { } } + #[profiling::function] pub fn update_x11_stacking_order(&mut self) { let shell = self.shell.read(); let active_output = shell.seats.last_active().active_output();