chore: update smithay + switch to tracing

This commit is contained in:
Victoria Brekenfeld 2023-02-24 17:41:52 +01:00
parent 844ed552b9
commit 35de500c00
35 changed files with 622 additions and 754 deletions

View file

@ -128,9 +128,7 @@ impl CompositorHandler for State {
CosmicSurface::Wayland(ref wl_window) => {
let toplevel = wl_window.toplevel();
if self.toplevel_ensure_initial_configure(&toplevel)
&& with_renderer_surface_state(&surface, |state| {
state.wl_buffer().is_some()
})
&& with_renderer_surface_state(&surface, |state| state.buffer().is_some())
{
let output = seat.active_output();
Shell::map_window(self, &window, &output);

View file

@ -13,6 +13,7 @@ use smithay::{
xwayland::xwm::{SelectionType, XwmId},
};
use std::{cell::RefCell, os::unix::io::OwnedFd};
use tracing::warn;
pub struct DnDIcon {
surface: RefCell<Option<WlSurface>>,
@ -66,10 +67,10 @@ impl DataDeviceHandler for State {
Some(metadata.mime_types.clone()),
)
}) {
slog_scope::warn!("Failed to set Xwayland clipboard selection: {}", err);
warn!(?err, "Failed to set Xwayland clipboard selection.");
}
} else if let Err(err) = xwm.new_selection(SelectionType::Clipboard, None) {
slog_scope::warn!("Failed to clear Xwayland clipboard selection: {}", err);
warn!(?err, "Failed to clear Xwayland clipboard selection.");
}
}
}
@ -94,7 +95,7 @@ impl DataDeviceHandler for State {
fd,
self.common.event_loop_handle.clone(),
) {
slog_scope::warn!("Failed to send clipboard (X11 -> Wayland): {}", err);
warn!(?err, "Failed to send clipboard (X11 -> Wayland).");
}
}
}

View file

@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-3.0-only
use smithay::output::Output;
use tracing::{error, warn};
use crate::{
config::OutputConfig,
@ -89,10 +90,10 @@ impl State {
seats.iter().cloned(),
&self.common.event_loop_handle,
) {
slog_scope::warn!(
"Failed to apply config to {}: {}. Resetting",
warn!(
?err,
"Failed to apply config to {}. Resetting",
output.name(),
err
);
for (output, backup) in backups {
{
@ -111,11 +112,7 @@ impl State {
seats.iter().cloned(),
&self.common.event_loop_handle,
) {
slog_scope::error!(
"Failed to reset output config for {}: {}",
output.name(),
err
);
error!(?err, "Failed to reset output config for {}.", output.name(),);
}
}
}

View file

@ -5,6 +5,7 @@ use smithay::{
delegate_primary_selection,
wayland::primary_selection::{PrimarySelectionHandler, PrimarySelectionState, with_source_metadata}, xwayland::xwm::{XwmId, SelectionType}, reexports::wayland_protocols::wp::primary_selection::zv1::server::zwp_primary_selection_source_v1::ZwpPrimarySelectionSourceV1,
};
use tracing::warn;
use std::os::unix::io::OwnedFd;
@ -22,10 +23,10 @@ impl PrimarySelectionHandler for State {
if let Ok(Err(err)) = with_source_metadata(source, |metadata| {
xwm.new_selection(SelectionType::Primary, Some(metadata.mime_types.clone()))
}) {
slog_scope::warn!("Failed to set Xwayland primary selection: {}", err);
warn!(?err, "Failed to set Xwayland primary selection");
}
} else if let Err(err) = xwm.new_selection(SelectionType::Primary, None) {
slog_scope::warn!("Failed to clear Xwayland primary selection: {}", err);
warn!(?err, "Failed to clear Xwayland primary selection");
}
}
}
@ -50,7 +51,7 @@ impl PrimarySelectionHandler for State {
fd,
self.common.event_loop_handle.clone(),
) {
slog_scope::warn!("Failed to send primary selection (X11 -> Wayland): {}", err);
warn!(?err, "Failed to send primary selection (X11 -> Wayland).");
}
}
}

View file

@ -39,6 +39,7 @@ use smithay::{
},
xwayland::XWaylandClientData,
};
use tracing::warn;
use crate::{
backend::render::{
@ -250,7 +251,7 @@ impl ScreencopyHandler for State {
let buffer_size = match buffer_dimensions(&params.buffer) {
Some(size) => size.to_logical(1, Transform::Normal),
None => {
slog_scope::warn!("Error during screencopy session: Buffer has no size");
warn!("Error during screencopy session: Buffer has no size");
session.failed(FailureReason::InvalidBuffer);
return;
}
@ -260,7 +261,7 @@ impl ScreencopyHandler for State {
let mode = match output.current_mode() {
Some(mode) => mode,
None => {
slog_scope::warn!("Error during screencopy session: Output has no mode");
warn!("Error during screencopy session: Output has no mode");
session.failed(FailureReason::InvalidOutput);
return;
}
@ -268,7 +269,7 @@ impl ScreencopyHandler for State {
.size;
if buffer_size.to_physical(1) != mode {
slog_scope::warn!("Error during screencopy session: Buffer size doesn't match");
warn!("Error during screencopy session: Buffer size doesn't match");
session.failed(FailureReason::InvalidSize);
return;
}
@ -276,7 +277,7 @@ impl ScreencopyHandler for State {
SessionType::Window(window) => {
let geometry = window.geometry();
if buffer_size != geometry.size {
slog_scope::warn!("Error during screencopy session: Buffer size doesn't match");
warn!("Error during screencopy session: Buffer size doesn't match");
session.failed(FailureReason::InvalidSize);
return;
}
@ -288,7 +289,7 @@ impl ScreencopyHandler for State {
buffer_type(&params.buffer),
Some(BufferType::Shm) | Some(BufferType::Dma)
) {
slog_scope::warn!("Error during screencopy session: Buffer is neither shm or dma");
warn!("Error during screencopy session: Buffer is neither shm or dma");
session.failed(FailureReason::InvalidBuffer);
return;
}
@ -299,7 +300,7 @@ impl ScreencopyHandler for State {
})
.unwrap()
{
slog_scope::warn!("Error during screencopy session: Invalid shm buffer format");
warn!("Error during screencopy session: Invalid shm buffer format");
session.failed(FailureReason::InvalidBuffer);
return;
}
@ -368,8 +369,8 @@ impl ScreencopyHandler for State {
buffer.release();
}
Ok(true) => {} // success
Err((reason, error)) => {
slog_scope::warn!("Error during screencopy session: {}", error);
Err((reason, err)) => {
warn!(?err, "Error during screencopy session");
session.failed(reason);
}
}
@ -955,7 +956,7 @@ pub fn render_window_to_buffer(
.map_err(DamageTrackedRendererError::Rendering)?;
}
dtr.render_output(renderer, age, &elements, CLEAR_COLOR, None)
dtr.render_output(renderer, age, &elements, CLEAR_COLOR)
}
let node = node_from_params(&params, &mut state.backend, None);
@ -1134,7 +1135,7 @@ impl State {
Ok(false) => data.state.common.still_pending(session, params),
Ok(true) => {} // success
Err((reason, err)) => {
slog_scope::warn!("Screencopy session failed: {}", err);
warn!(?err, "Screencopy session failed");
session.failed(reason);
}
}
@ -1263,7 +1264,7 @@ pub fn schedule_offscreen_workspace_session(
}
Ok(true) => {}
Err((reason, err)) => {
slog_scope::warn!("Screencopy session failed: {}", err);
warn!(?err, "Screencopy session failed.");
session.failed(reason);
}
}

View file

@ -22,6 +22,7 @@ use smithay::{
},
};
use std::cell::Cell;
use tracing::warn;
use super::screencopy::PendingScreencopyBuffers;
@ -125,9 +126,9 @@ impl XdgShellHandler for State {
self.common.shell.unconstrain_popup(&surface, &positioner);
surface.send_repositioned(token);
if let Err(err) = surface.send_configure() {
slog_scope::warn!(
"Client bug: Unable to re-configure repositioned popup: {}",
err
warn!(
?err,
"Client bug: Unable to re-configure repositioned popup.",
);
}
}

View file

@ -24,6 +24,7 @@ use smithay::{
},
};
use std::sync::Mutex;
use tracing::{debug, warn};
impl Shell {
pub fn unconstrain_popup(&self, surface: &PopupSurface, positioner: &PositionerState) {
@ -86,9 +87,9 @@ pub fn update_reactive_popups<'a>(
{
unconstrain_xdg_popup(&surface, loc, rect);
if let Err(err) = surface.send_configure() {
slog_scope::warn!(
"Compositor bug: Unable to re-configure reactive popup: {}",
err
warn!(
?err,
"Compositor bug: Unable to re-configure reactive popup",
);
}
}
@ -103,7 +104,7 @@ fn unconstrain_xdg_popup_tile(surface: &PopupSurface, rect: Rectangle<i32, Logic
let offset = check_constrained(geometry, rect);
if offset.x != 0 || offset.y != 0 {
slog_scope::debug!("Unconstraining popup to tile: {:?}", surface);
debug!(?surface, "Unconstraining popup to tile.");
if !unconstrain_flip(&surface, rect) {
return unconstrain_slide(&surface, rect);
// don't try to resize for fitting to a tile
@ -123,7 +124,7 @@ fn unconstrain_xdg_popup(
let offset = check_constrained(geometry, relative);
if offset.x != 0 || offset.y != 0 {
slog_scope::debug!("Unconstraining popup: {:?}", surface);
debug!(?surface, "Unconstraining popup.");
if !unconstrain_flip(&surface, relative) {
if !unconstrain_slide(&surface, relative) {
unconstrain_resize(&surface, relative);
@ -143,7 +144,7 @@ fn unconstrain_layer_popup(surface: &PopupSurface, output: &Output, layer_surfac
let offset = check_constrained(geometry, relative);
if offset.x != 0 || offset.y != 0 {
slog_scope::debug!("Unconstraining popup: {:?}", surface);
debug!(?surface, "Unconstraining popup.");
if !unconstrain_flip(&surface, relative) {
if !unconstrain_slide(&surface, relative) {
unconstrain_resize(&surface, relative);

View file

@ -34,6 +34,7 @@ use smithay::{
dmabuf::{DmabufGlobal, DmabufHandler, ImportError},
},
};
use tracing::trace;
use std::{convert::TryFrom, path::PathBuf, sync::Arc};
@ -44,7 +45,6 @@ pub struct DrmGlobalData {
filter: Box<dyn for<'a> Fn(&'a Client) -> bool + Send + Sync>,
formats: Arc<Vec<Fourcc>>,
device_path: PathBuf,
_logger: slog::Logger,
dmabuf_global: DmabufGlobal,
}
@ -165,9 +165,7 @@ where
Ok(_) => {
// import was successful
data_init.init(id, dmabuf);
slog_scope::trace!(
"Created a new validated dma wl_buffer via wl_drm."
);
trace!("Created a new validated dma wl_buffer via wl_drm.");
}
Err(ImportError::InvalidFormat) => {
@ -246,7 +244,6 @@ impl WlDrmState {
formats,
device_path,
dmabuf_global: dmabuf_global.clone(),
_logger: slog_scope::logger().new(slog::o!("cosmic_module" => "wayland_drm")),
};
display.create_global::<D, wl_drm::WlDrm, _>(2, data)

View file

@ -24,6 +24,7 @@ use smithay::{
},
utils::{user_data::UserDataMap, Buffer, IsAlive, Physical, Point, Rectangle, Size, Transform},
};
use tracing::warn;
use wayland_backend::{
protocol::WEnum,
server::{GlobalId, ObjectId},
@ -540,7 +541,7 @@ fn check_cursor(
match cursor.into_result() {
Ok(mode) => {
if !supported.contains(&mode) {
slog_scope::warn!("Client did send unsupported cursor mode: {:?}", mode);
warn!(?mode, "Client did send unsupported cursor mode");
resource.post_error(
zcosmic_screencopy_manager_v1::Error::InvalidCursorMode,
"Unsupported cursor mode",
@ -550,7 +551,7 @@ fn check_cursor(
Some(mode)
}
Err(err) => {
slog_scope::warn!("Client did send unknown cursor mode: {}", err);
warn!(?err, "Client did send unknown cursor mode");
resource.post_error(
zcosmic_screencopy_manager_v1::Error::InvalidCursorMode,
"Unknown cursor mode, wrong protocol version?",