debug: More profiling annotations

This commit is contained in:
Victoria Brekenfeld 2025-05-20 17:54:12 +02:00 committed by Victoria Brekenfeld
parent 465813c1c5
commit a65e1d6b5f
8 changed files with 20 additions and 0 deletions

View file

@ -725,6 +725,7 @@ impl SurfaceThreadState {
//self.software_api.as_mut().remove_node(node); //self.software_api.as_mut().remove_node(node);
} }
#[profiling::function]
fn on_vblank(&mut self, metadata: Option<DrmEventMetadata>) { fn on_vblank(&mut self, metadata: Option<DrmEventMetadata>) {
let Some(compositor) = self.compositor.as_mut() else { let Some(compositor) = self.compositor.as_mut() else {
return; return;
@ -851,6 +852,7 @@ impl SurfaceThreadState {
} }
} }
#[profiling::function]
fn on_estimated_vblank(&mut self, force: bool) { fn on_estimated_vblank(&mut self, force: bool) {
match mem::replace(&mut self.state, QueueState::Idle) { match mem::replace(&mut self.state, QueueState::Idle) {
QueueState::Idle => unreachable!(), QueueState::Idle => unreachable!(),
@ -949,6 +951,7 @@ impl SurfaceThreadState {
} }
} }
#[profiling::function]
fn redraw(&mut self, estimated_presentation: Duration) -> Result<()> { fn redraw(&mut self, estimated_presentation: Duration) -> Result<()> {
let Some(compositor) = self.compositor.as_mut() else { let Some(compositor) = self.compositor.as_mut() else {
return Ok(()); return Ok(());
@ -1826,6 +1829,7 @@ fn source_node_for_surface(w: &WlSurface) -> Option<DrmNode> {
// TODO: Introduce can_shared_dmabuf_framebuffer for cases where we might select another gpu // 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" // and composite on target if not possible to finally get rid of "primary"
#[profiling::function]
fn render_node_for_output( fn render_node_for_output(
output: &Output, output: &Output,
primary_node: &DrmNode, primary_node: &DrmNode,

View file

@ -122,6 +122,7 @@ impl State {
} }
} }
#[profiling::function]
pub fn handle_shortcut_action( pub fn handle_shortcut_action(
&mut self, &mut self,
action: shortcuts::Action, action: shortcuts::Action,

View file

@ -161,6 +161,7 @@ impl ModifiersShortcutQueue {
} }
impl State { impl State {
#[profiling::function]
pub fn process_input_event<B: InputBackend>(&mut self, event: InputEvent<B>) pub fn process_input_event<B: InputBackend>(&mut self, event: InputEvent<B>)
where where
<B as InputBackend>::Device: 'static, <B as InputBackend>::Device: 'static,
@ -1504,6 +1505,7 @@ impl State {
} }
/// Determine is key event should be intercepted as a key binding, or forwarded to surface /// Determine is key event should be intercepted as a key binding, or forwarded to surface
#[profiling::function]
pub fn filter_keyboard_input<B: InputBackend, E: KeyboardKeyEvent<B>>( pub fn filter_keyboard_input<B: InputBackend, E: KeyboardKeyEvent<B>>(
&mut self, &mut self,
event: &E, event: &E,
@ -1958,6 +1960,7 @@ impl State {
} }
} }
#[profiling::function]
pub fn element_under( pub fn element_under(
global_pos: Point<f64, Global>, global_pos: Point<f64, Global>,
output: &Output, output: &Output,
@ -2084,6 +2087,7 @@ impl State {
.flatten() .flatten()
} }
#[profiling::function]
pub fn surface_under( pub fn surface_under(
global_pos: Point<f64, Global>, global_pos: Point<f64, Global>,
output: &Output, output: &Output,

View file

@ -99,6 +99,7 @@ impl Shell {
/// Set the keyboard focus to the given target /// 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 /// 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 /// if the focus change was due to a pointer event, this should be set to false
#[profiling::function]
pub fn set_focus( pub fn set_focus(
state: &mut State, state: &mut State,
target: Option<&KeyboardFocusTarget>, target: Option<&KeyboardFocusTarget>,
@ -224,6 +225,7 @@ impl Shell {
} }
/// Internal, used to ensure that ActiveFocus, KeyboardFocusTarget, and FocusedOutput are all in sync /// Internal, used to ensure that ActiveFocus, KeyboardFocusTarget, and FocusedOutput are all in sync
#[profiling::function]
fn update_focus_state( fn update_focus_state(
seat: &Seat<State>, seat: &Seat<State>,
target: Option<&KeyboardFocusTarget>, target: Option<&KeyboardFocusTarget>,
@ -327,6 +329,7 @@ fn raise_with_children(floating_layer: &mut FloatingLayout, focused: &CosmicMapp
} }
impl Common { impl Common {
#[profiling::function]
pub fn refresh_focus(state: &mut State) { pub fn refresh_focus(state: &mut State) {
let seats = state let seats = state
.common .common

View file

@ -1408,6 +1408,7 @@ impl Common {
self.idle_notifier_state.set_is_inhibited(is_inhibited); self.idle_notifier_state.set_is_inhibited(is_inhibited);
} }
#[profiling::function]
pub fn on_commit(&mut self, surface: &WlSurface) { pub fn on_commit(&mut self, surface: &WlSurface) {
{ {
let shell = self.shell.read(); let shell = self.shell.read();

View file

@ -695,6 +695,7 @@ fn primary_scanout_output_compare<'a>(
} }
impl Common { impl Common {
#[profiling::function]
pub fn update_primary_output( pub fn update_primary_output(
&self, &self,
output: &Output, output: &Output,
@ -796,6 +797,7 @@ impl Common {
} }
} }
#[profiling::function]
pub fn send_dmabuf_feedback( pub fn send_dmabuf_feedback(
&self, &self,
output: &Output, output: &Output,
@ -946,6 +948,7 @@ impl Common {
} }
} }
#[profiling::function]
pub fn send_frames(&self, output: &Output, sequence: Option<usize>) { pub fn send_frames(&self, output: &Output, sequence: Option<usize>) {
let time = self.clock.now(); let time = self.clock.now();
let should_send = |surface: &WlSurface, states: &SurfaceData| { let should_send = |surface: &WlSurface, states: &SurfaceData| {

View file

@ -71,6 +71,7 @@ impl OverlapNotifyState {
self.global.clone() self.global.clone()
} }
#[profiling::function]
pub fn refresh<D, W>(state: &mut D) pub fn refresh<D, W>(state: &mut D)
where where
D: GlobalDispatch<ZcosmicOverlapNotifyV1, OverlapNotifyGlobalData> D: GlobalDispatch<ZcosmicOverlapNotifyV1, OverlapNotifyGlobalData>

View file

@ -317,6 +317,7 @@ impl Common {
} }
} }
#[profiling::function]
pub fn xwayland_notify_key_event( pub fn xwayland_notify_key_event(
&mut self, &mut self,
sym: Keysym, sym: Keysym,
@ -400,6 +401,7 @@ impl Common {
} }
} }
#[profiling::function]
pub fn xwayland_notify_pointer_button_event( pub fn xwayland_notify_pointer_button_event(
&mut self, &mut self,
button: u32, button: u32,
@ -449,6 +451,7 @@ impl Common {
} }
} }
#[profiling::function]
pub fn update_x11_stacking_order(&mut self) { pub fn update_x11_stacking_order(&mut self) {
let shell = self.shell.read(); let shell = self.shell.read();
let active_output = shell.seats.last_active().active_output(); let active_output = shell.seats.last_active().active_output();