debug: Drop puffin integration

This commit is contained in:
Victoria Brekenfeld 2024-03-21 17:49:06 +01:00
parent b5cbe0207f
commit d341cb8b86
13 changed files with 7 additions and 173 deletions

View file

@ -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(());
}

View file

@ -195,9 +195,6 @@ where
R: Renderer + ImportAll,
<R as Renderer>::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,
<R as Renderer>::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

View file

@ -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<R>: RenderElement<R>,
E: From<CursorRenderElement<R>> + From<CosmicMappedRenderElement<R>>,
{
#[cfg(feature = "debug")]
puffin::profile_function!();
let scale = output.current_scale().fractional_scale();
let mut elements = Vec::new();
@ -484,9 +481,6 @@ where
CosmicMappedRenderElement<R>: RenderElement<R>,
WorkspaceRenderElement<R>: RenderElement<R>,
{
#[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(<R as Renderer>::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<R>: RenderElement<R>,
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

View file

@ -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<i32, Logical>,
scale: f64,
) -> Result<Option<TextureRenderElement<GlesTexture>>, 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,

View file

@ -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

View file

@ -75,9 +75,6 @@ impl MoveGrabState {
CosmicMappedRenderElement<R>: RenderElement<R>,
I: From<CosmicMappedRenderElement<R>>,
{
#[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

View file

@ -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<R>: RenderElement<R>,
CosmicStackRenderElement<R>: RenderElement<R>,
{
#[cfg(feature = "debug")]
puffin::profile_function!();
let output = self.space.outputs().next().unwrap();
let output_geometry = {
let layers = layer_map_for_output(output);

View file

@ -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<Data>,
gaps: (i32, i32),
) -> Option<TilingBlocker> {
#[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<R>: RenderElement<R>,
CosmicStackRenderElement<R>: RenderElement<R>,
{
#[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() {

View file

@ -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| {

View file

@ -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<R>: RenderElement<R>,
WorkspaceRenderElement<R>: RenderElement<R>,
{
#[cfg(feature = "debug")]
puffin::profile_function!();
let mut window_elements = Vec::new();
let mut popup_elements = Vec::new();

View file

@ -612,9 +612,6 @@ where
usize,
) -> Result<RenderOutputResult, DTError<R>>,
{
#[cfg(feature = "debug")]
puffin::profile_function!();
let mut dt = session.user_data().get::<SessionDT>().unwrap().borrow_mut();
let res = render_fn(
@ -926,9 +923,6 @@ pub fn render_window_to_buffer(
params: BufferParams,
window: &CosmicSurface,
) -> Result<bool, (FailureReason, anyhow::Error)> {
#[cfg(feature = "debug")]
puffin::profile_function!();
let geometry = window.geometry();
let buffer_size = buffer_dimensions(&params.buffer).unwrap();
if buffer_size != geometry.size.to_buffer(1, Transform::Normal) {