Log shm slot pool size on new/destroyed output
This might help to keep better track on our graphics memory use
This commit is contained in:
parent
62d90ae9c2
commit
7681beecba
1 changed files with 74 additions and 22 deletions
|
@ -1,6 +1,6 @@
|
||||||
use std::{num::NonZeroU32, path::PathBuf};
|
use std::{num::NonZeroU32, path::PathBuf};
|
||||||
|
|
||||||
use log::{debug, error};
|
use log::{debug, error, warn};
|
||||||
use smithay_client_toolkit::{
|
use smithay_client_toolkit::{
|
||||||
delegate_compositor, delegate_layer, delegate_output, delegate_registry,
|
delegate_compositor, delegate_layer, delegate_output, delegate_registry,
|
||||||
delegate_shm,
|
delegate_shm,
|
||||||
|
@ -155,11 +155,6 @@ impl OutputHandler for State {
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
debug!(
|
|
||||||
"New output, name: {}, resolution: {}x{}",
|
|
||||||
output_name, width, height
|
|
||||||
);
|
|
||||||
|
|
||||||
if !width.is_positive() {
|
if !width.is_positive() {
|
||||||
error!(
|
error!(
|
||||||
"New output '{}' has a non-positive width: {}, skipping",
|
"New output '{}' has a non-positive width: {}, skipping",
|
||||||
|
@ -177,6 +172,16 @@ impl OutputHandler for State {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
debug!(
|
||||||
|
"New output, name: {}, resolution: {}x{}",
|
||||||
|
output_name, width, height
|
||||||
|
);
|
||||||
|
|
||||||
|
debug!(
|
||||||
|
"Slot pool size before loading wallpapers: {} KiB",
|
||||||
|
self.shm_slot_pool.len() / 1024
|
||||||
|
);
|
||||||
|
|
||||||
let surface = self.compositor_state.create_surface(qh);
|
let surface = self.compositor_state.create_surface(qh);
|
||||||
|
|
||||||
let layer = self.layer_shell.create_layer_surface(
|
let layer = self.layer_shell.create_layer_surface(
|
||||||
|
@ -224,6 +229,11 @@ impl OutputHandler for State {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
debug!(
|
||||||
|
"Slot pool size after loading wallpapers: {} KiB",
|
||||||
|
self.shm_slot_pool.len() / 1024
|
||||||
|
);
|
||||||
|
|
||||||
self.background_layers.push(BackgroundLayer {
|
self.background_layers.push(BackgroundLayer {
|
||||||
output_name,
|
output_name,
|
||||||
|
@ -239,23 +249,30 @@ impl OutputHandler for State {
|
||||||
&mut self,
|
&mut self,
|
||||||
_conn: &Connection,
|
_conn: &Connection,
|
||||||
_qh: &QueueHandle<Self>,
|
_qh: &QueueHandle<Self>,
|
||||||
_output: wl_output::WlOutput,
|
output: wl_output::WlOutput,
|
||||||
) {
|
) {
|
||||||
// This will only be needed if we implement scaling the wallpapers
|
// This will only be needed if we implement scaling the wallpapers
|
||||||
// to the output resolution
|
// to the output resolution
|
||||||
//
|
|
||||||
// let Some(info) = self.output_state.info(&output)
|
let Some(info) = self.output_state.info(&output)
|
||||||
// else {
|
else {
|
||||||
// error!("Updated output has no output info, skipping");
|
error!("Updated output has no output info, skipping");
|
||||||
// return;
|
return;
|
||||||
// };
|
};
|
||||||
//
|
|
||||||
// let Some(name) = info.name
|
let Some(name) = info.name
|
||||||
// else {
|
else {
|
||||||
// error!("Updated output has no name, skipping");
|
error!("Updated output has no name, skipping");
|
||||||
// return;
|
return;
|
||||||
// };
|
};
|
||||||
//
|
|
||||||
|
debug!(
|
||||||
|
"Update output: {}",
|
||||||
|
name
|
||||||
|
);
|
||||||
|
|
||||||
|
warn!("Handling of output updates are not yet implemented");
|
||||||
|
|
||||||
// let Some((width, height)) = info.modes.iter()
|
// let Some((width, height)) = info.modes.iter()
|
||||||
// .find(|mode| mode.current)
|
// .find(|mode| mode.current)
|
||||||
// .map(|mode| mode.dimensions)
|
// .map(|mode| mode.dimensions)
|
||||||
|
@ -299,17 +316,47 @@ impl OutputHandler for State {
|
||||||
error!("Destroyed output has no name, skipping");
|
error!("Destroyed output has no name, skipping");
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
debug!(
|
||||||
|
"Output destroyed: {}",
|
||||||
|
name,
|
||||||
|
);
|
||||||
|
|
||||||
|
debug!(
|
||||||
|
"Slot pool size before dropping wallpapers: {} KiB",
|
||||||
|
self.shm_slot_pool.len() / 1024,
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
if let Some(bg_layer_index) = self.background_layers.iter()
|
if let Some(bg_layer_index) = self.background_layers.iter()
|
||||||
.position(|bg_layers| bg_layers.output_name == name)
|
.position(|bg_layers| bg_layers.output_name == name)
|
||||||
{
|
{
|
||||||
self.background_layers.swap_remove(bg_layer_index);
|
let removed_bg_layer = self.background_layers
|
||||||
|
.swap_remove(bg_layer_index);
|
||||||
|
|
||||||
// Workspaces on the destroyed output may have been moved anywhere
|
// Workspaces on the destroyed output may have been moved anywhere
|
||||||
// so reset the wallpaper on all the visible workspaces
|
// so reset the wallpaper on all the visible workspaces
|
||||||
self.sway_connection_task.request_visible_workspaces();
|
self.sway_connection_task.request_visible_workspaces();
|
||||||
|
|
||||||
debug!("Destroyed output: {}", name);
|
debug!(
|
||||||
|
"Dropping {} wallpapers on destroyed output for workspaces: {}",
|
||||||
|
removed_bg_layer.workspace_backgrounds.len(),
|
||||||
|
removed_bg_layer.workspace_backgrounds.iter()
|
||||||
|
.map(|workspace_bg| workspace_bg.workspace_name.as_str())
|
||||||
|
.collect::<Vec<_>>().join(", ")
|
||||||
|
);
|
||||||
|
|
||||||
|
for workspace_bg in removed_bg_layer.workspace_backgrounds.iter() {
|
||||||
|
if workspace_bg.buffer.slot().has_active_buffers() {
|
||||||
|
warn!(
|
||||||
|
"On destroyed output '{}' workspace background '{}' will be dropped while its shm slot still has active buffers",
|
||||||
|
name,
|
||||||
|
workspace_bg.workspace_name,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
drop(removed_bg_layer);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
error!(
|
error!(
|
||||||
|
@ -320,6 +367,11 @@ impl OutputHandler for State {
|
||||||
.collect::<Vec<_>>().join(", ")
|
.collect::<Vec<_>>().join(", ")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
debug!(
|
||||||
|
"Slot pool size after dropping wallpapers: {} KiB",
|
||||||
|
self.shm_slot_pool.len() / 1024
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue