Update Smithay
Some checks are pending
CI (Pinnacle) / Build (push) Waiting to run
CI (Pinnacle) / Run tests (push) Waiting to run
CI (Pinnacle) / Check formatting (push) Waiting to run
CI (Pinnacle) / Clippy check (push) Waiting to run

This commit is contained in:
Ottatop 2024-07-01 17:01:53 -05:00
parent 88c1a88645
commit c7907df43c
7 changed files with 40 additions and 99 deletions

4
Cargo.lock generated
View file

@ -3687,7 +3687,7 @@ checksum = "b7c388c1b5e93756d0c740965c41e8822f866621d41acbdf6336a6a168f8840c"
[[package]]
name = "smithay"
version = "0.3.0"
source = "git+https://github.com/Smithay/smithay?rev=69b379d#69b379d00af9e1bcc98dac2d452bfd86eafdaf34"
source = "git+https://github.com/Smithay/smithay?rev=3731734#3731734d5a0409186a0475238ffe46e2835cee6d"
dependencies = [
"appendlist",
"bitflags 2.5.0",
@ -3802,7 +3802,7 @@ dependencies = [
[[package]]
name = "smithay-drm-extras"
version = "0.1.0"
source = "git+https://github.com/Smithay/smithay?rev=69b379d#69b379d00af9e1bcc98dac2d452bfd86eafdaf34"
source = "git+https://github.com/Smithay/smithay?rev=3731734#3731734d5a0409186a0475238ffe46e2835cee6d"
dependencies = [
"drm",
"edid-rs",

View file

@ -37,7 +37,7 @@ indexmap = "2.2.6"
[workspace.dependencies.smithay]
git = "https://github.com/Smithay/smithay"
rev = "69b379d"
rev = "3731734"
# path = "../../git/smithay"
default-features = false
features = [
@ -85,7 +85,7 @@ keywords = ["wayland", "compositor", "smithay", "lua"]
[dependencies]
# Smithay
smithay = { workspace = true }
smithay-drm-extras = { git = "https://github.com/Smithay/smithay", rev = "69b379d" }
smithay-drm-extras = { git = "https://github.com/Smithay/smithay", rev = "3731734" }
# Tracing
tracing = { workspace = true }
tracing-subscriber = { workspace = true }

View file

@ -6,3 +6,4 @@ Problems:
- Xwayland popups are screwed when the output is not at (0, 0)
- Dragging an xwayland window to another output and closing a nested right click menu closes the whole
right click menu because the keyboard focus is getting updated on the original output.
- Turning a monitor off then on causes scale increases to not propagate the new scale to clients resulting in blurry windows

View file

@ -456,7 +456,7 @@ impl Udev {
/// Schedule a new render that will cause the compositor to redraw everything.
pub fn schedule_render(&mut self, loop_handle: &LoopHandle<State>, output: &Output) {
let Some(surface) = render_surface_for_output(output, &mut self.backends) else {
tracing::info!("no render surface on output {}", output.name());
debug!("no render surface on output {}", output.name());
return;
};
@ -522,58 +522,12 @@ impl Udev {
impl State {
/// Switch the tty.
///
/// This will first clear the overlay plane to prevent any lingering artifacts,
/// then switch the vt.
///
/// Does nothing when called on the winit backend.
pub fn switch_vt(&mut self, vt: i32) {
if let Backend::Udev(udev) = &mut self.backend {
if let Err(err) = udev.session.change_vt(vt) {
error!("Failed to switch to vt {vt}: {err}");
}
// TODO: uncomment this when `RenderFrameResult::blit_frame_result` is fixed for
// | overlay/cursor planes
// for backend in udev.backends.values_mut() {
// for surface in backend.surfaces.values_mut() {
// // Clear the overlay planes on tty switch.
// //
// // On my machine, switching a tty would leave the topmost window on the
// // screen. Smithay will render the topmost window on the overlay plane,
// // so we clear it here.
// let planes = surface.compositor.surface().planes().clone();
// tracing::debug!("Clearing overlay planes");
// for overlay_plane in planes.overlay {
// if let Err(err) = surface
// .compositor
// .surface()
// .clear_plane(overlay_plane.handle)
// {
// warn!("Failed to clear overlay planes: {err}");
// }
// }
// }
// }
// Wait for the clear to commit before switching
// self.schedule(
// |state| {
// let udev = state.backend.udev();
// !udev
// .backends
// .values()
// .flat_map(|backend| backend.surfaces.values())
// .map(|surface| surface.compositor.surface())
// .any(|drm_surf| drm_surf.commit_pending())
// },
// move |state| {
// let udev = state.backend.udev_mut();
// if let Err(err) = udev.session.change_vt(vt) {
// error!("Failed to switch to vt {vt}: {err}");
// }
// },
// );
}
}
}
@ -708,8 +662,8 @@ fn get_surface_dmabuf_feedback(
// the supplied buffer can not be scanned out directly
let planes_formats = planes
.primary
.formats
.into_iter()
.flat_map(|p| p.formats)
.chain(planes.overlay.into_iter().flat_map(|p| p.formats))
.collect::<IndexSet<_>>()
.intersection(&all_render_formats)
@ -800,7 +754,7 @@ enum PendingGammaChange {
struct ScreencopyCommitState {
primary_plane_swapchain: CommitCounter,
primary_plane_element: CommitCounter,
_cursor: CommitCounter,
cursor: CommitCounter,
}
type GbmDrmCompositor = DrmCompositor<
@ -1036,8 +990,9 @@ impl Udev {
let mut planes = surface.planes().clone();
// INFO: We are disabling overlay planes because it seems that any elements on
// | overlay planes don't get up/downscaled according to the set filter;
// | it always defaults to linear.
// overlay planes don't get up/downscaled according to the set filter;
// it always defaults to linear. Also alacritty seems to have the wrong alpha
// when it's on the overlay plane.
planes.overlay.clear();
match DrmCompositor::new(
@ -1117,7 +1072,7 @@ impl Udev {
node: DrmNode,
crtc: crtc::Handle,
) {
tracing::debug!(?crtc, "connector_disconnected");
debug!(?crtc, "connector_disconnected");
let device = if let Some(device) = self.backends.get_mut(&node) {
device
@ -1185,7 +1140,7 @@ impl Udev {
self.connector_disconnected(pinnacle, node, crtc);
}
tracing::debug!("Surfaces dropped");
debug!("Surfaces dropped");
// drop the backends on this side
if let Some(backend_data) = self.backends.remove(&node) {
@ -1195,7 +1150,7 @@ impl Udev {
pinnacle.loop_handle.remove(backend_data.registration_token);
tracing::debug!("Dropping device");
debug!("Dropping device");
}
}
@ -1393,19 +1348,6 @@ impl Udev {
|| (pinnacle.lock_state.is_locked()
&& output.with_state(|state| state.lock_surface.is_none()));
// HACK: Doing `blit_frame_result` with something on the cursor/overlay plane overwrites
// transparency. This workaround makes the cursor not be on the cursor plane for blitting.
let kind = if output.with_state(|state| {
state
.screencopy
.as_ref()
.is_some_and(|sc| sc.overlay_cursor())
}) {
element::Kind::Unspecified
} else {
element::Kind::Cursor
};
let (pointer_render_elements, cursor_ids) = pointer_render_elements(
output,
&mut renderer,
@ -1414,7 +1356,6 @@ impl Udev {
pointer_location,
pinnacle.dnd_icon.as_ref(),
&pinnacle.clock,
kind,
);
output_render_elements.extend(
pointer_render_elements
@ -1587,7 +1528,7 @@ fn handle_pending_screencopy<'a>(
// region. Sway does the former, Hyprland the latter. Also, no one actually seems to be using the
// received damage. wf-recorder and wl-mirror have no-op handlers for the damage event.
let damage = match &render_frame_result.primary_element {
let mut damage = match &render_frame_result.primary_element {
PrimaryPlaneElement::Swapchain(element) => {
let swapchain_commit = &mut surface.screencopy_commit_state.primary_plane_swapchain;
let damage = element.damage.damage_since(Some(*swapchain_commit));
@ -1622,29 +1563,30 @@ fn handle_pending_screencopy<'a>(
)])
});
// INFO: This code is here for if the bug where `blit_frame_result` makes the area around
// | the cursor transparent is fixed/a workaround found.
// let cursor_damage = render_frame_result
// .cursor_element
// .map(|cursor| {
// let damage =
// cursor.damage_since(scale, Some(surface.screencopy_commit_state.cursor));
// new_commit_counters.cursor = cursor.current_commit();
// damage
// })
// .unwrap_or_default();
let cursor_damage = render_frame_result
.cursor_element
.map(|cursor| {
let damage =
cursor.damage_since(scale, Some(surface.screencopy_commit_state.cursor));
surface.screencopy_commit_state.cursor = cursor.current_commit();
damage
})
.unwrap_or_default();
damage = damage.into_iter().chain(cursor_damage).collect();
// The primary plane and cursor had no damage but something got rendered,
// so it must be the cursor moving.
//
// damage.extend(cursor_damage);
//
// // The primary plane and cursor had no damage but something got rendered,
// // so it must be the cursor moving.
// //
// // We currently have overlay planes disabled, so we don't have to worry about that.
// if damage.is_empty() && !render_frame_result.is_empty {
// if let Some(cursor_elem) = render_frame_result.cursor_element {
// damage.push(cursor_elem.geometry(scale));
// }
// }
// We currently have overlay planes disabled, so we don't have to worry about that.
if damage.is_empty() && !render_frame_result.is_empty {
if let Some(cursor_elem) = render_frame_result.cursor_element {
damage = damage
.into_iter()
.chain([cursor_elem.geometry(scale)])
.collect();
}
}
// INFO: Protocol states that `copy_with_damage` should wait until there is
// | damage to be copied.

View file

@ -297,7 +297,6 @@ impl Winit {
pointer_location,
pinnacle.dnd_icon.as_ref(),
&pinnacle.clock,
element::Kind::Cursor,
);
output_render_elements.extend(
pointer_render_elements

View file

@ -100,7 +100,7 @@ impl WindowElement {
pub fn render_elements<R: PRenderer>(
&self,
renderer: &mut R,
location: Point<i32, Logical>,
location: Point<i32, Logical>, // TODO: make f64
scale: Scale<f64>,
alpha: f32,
) -> Vec<WaylandSurfaceRenderElement<R>> {

View file

@ -52,7 +52,6 @@ pub fn pointer_render_elements<R: PRenderer>(
pointer_location: Point<f64, Logical>,
dnd_icon: Option<&WlSurface>,
clock: &Clock<Monotonic>,
kind: element::Kind,
) -> (Vec<PointerRenderElement<R>>, Vec<Id>) {
let mut pointer_render_elements = Vec::new();
let mut cursor_ids = Vec::new();
@ -83,7 +82,7 @@ pub fn pointer_render_elements<R: PRenderer>(
None,
None,
None,
kind,
element::Kind::Cursor,
);
elem.map(|elem| vec![PointerRenderElement::Memory(elem)])