Add support for profiling using tracy

This commit is contained in:
Ian Douglas Scott 2023-10-07 19:15:44 -07:00 committed by Victoria Brekenfeld
parent 929f4fcb05
commit a1c8b3aa3e
18 changed files with 122 additions and 5 deletions

View file

@ -1153,6 +1153,7 @@ fn get_surface_dmabuf_feedback(
}
impl Surface {
#[profiling::function]
pub fn render_output(
&mut self,
api: &mut GpuManager<GbmGlesBackend<GlowRenderer, DrmDeviceFd>>,
@ -1359,6 +1360,7 @@ impl KmsState {
self.session.change_vt(num).map_err(Into::into)
}
#[profiling::function]
pub fn apply_config_for_output(
&mut self,
output: &Output,
@ -1587,6 +1589,7 @@ impl KmsState {
Err(last_err)
}
#[profiling::function]
pub fn schedule_render(
&mut self,
loop_handle: &LoopHandle<'_, State>,
@ -1626,6 +1629,7 @@ impl KmsState {
)
},
move |_time, _, state| {
profiling::scope!("render_timer");
let backend = state.backend.kms();
let (mut device, mut other) = backend
.devices
@ -1666,6 +1670,8 @@ impl KmsState {
)
};
profiling::finish_frame!();
match result {
Ok(_) => {
trace!(?crtc, "Frame pending");

View file

@ -184,6 +184,7 @@ where
)
}
#[profiling::function]
pub fn draw_dnd_icon<R>(
renderer: &mut R,
surface: &wl_surface::WlSurface,
@ -301,6 +302,7 @@ impl Default for CursorState {
}
}
#[profiling::function]
pub fn draw_cursor<R>(
renderer: &mut R,
seat: &Seat<State>,

View file

@ -389,6 +389,7 @@ pub enum CursorMode {
All,
}
#[profiling::function]
pub fn cursor_elements<'frame, E, R>(
renderer: &mut R,
state: &Common,
@ -464,6 +465,7 @@ where
elements
}
#[profiling::function]
pub fn workspace_elements<R>(
_gpu: Option<&DrmNode>,
renderer: &mut R,
@ -965,6 +967,7 @@ where
}
}
#[profiling::function]
pub fn render_output<R, Target, OffTarget, Source>(
gpu: Option<&DrmNode>,
renderer: &mut R,
@ -1020,6 +1023,7 @@ where
result
}
#[profiling::function]
pub fn render_workspace<R, Target, OffTarget, Source>(
gpu: Option<&DrmNode>,
renderer: &mut R,

View file

@ -51,6 +51,7 @@ pub struct WinitState {
}
impl WinitState {
#[profiling::function]
pub fn render_output(&mut self, state: &mut Common) -> Result<()> {
self.backend
.bind()
@ -197,6 +198,7 @@ pub fn init_backend(
error!(?err, "Failed to render frame.");
render_ping.ping();
}
profiling::finish_frame!();
})
.map_err(|_| anyhow::anyhow!("Failed to init eventloop timer for winit"))?,
);