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]] [[package]]
name = "smithay" name = "smithay"
version = "0.3.0" 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 = [ dependencies = [
"appendlist", "appendlist",
"bitflags 2.5.0", "bitflags 2.5.0",
@ -3802,7 +3802,7 @@ dependencies = [
[[package]] [[package]]
name = "smithay-drm-extras" name = "smithay-drm-extras"
version = "0.1.0" 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 = [ dependencies = [
"drm", "drm",
"edid-rs", "edid-rs",

View file

@ -37,7 +37,7 @@ indexmap = "2.2.6"
[workspace.dependencies.smithay] [workspace.dependencies.smithay]
git = "https://github.com/Smithay/smithay" git = "https://github.com/Smithay/smithay"
rev = "69b379d" rev = "3731734"
# path = "../../git/smithay" # path = "../../git/smithay"
default-features = false default-features = false
features = [ features = [
@ -85,7 +85,7 @@ keywords = ["wayland", "compositor", "smithay", "lua"]
[dependencies] [dependencies]
# Smithay # Smithay
smithay = { workspace = true } 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
tracing = { workspace = true } tracing = { workspace = true }
tracing-subscriber = { 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) - 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 - 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. 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. /// Schedule a new render that will cause the compositor to redraw everything.
pub fn schedule_render(&mut self, loop_handle: &LoopHandle<State>, output: &Output) { pub fn schedule_render(&mut self, loop_handle: &LoopHandle<State>, output: &Output) {
let Some(surface) = render_surface_for_output(output, &mut self.backends) else { 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; return;
}; };
@ -522,58 +522,12 @@ impl Udev {
impl State { impl State {
/// Switch the tty. /// 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. /// Does nothing when called on the winit backend.
pub fn switch_vt(&mut self, vt: i32) { pub fn switch_vt(&mut self, vt: i32) {
if let Backend::Udev(udev) = &mut self.backend { if let Backend::Udev(udev) = &mut self.backend {
if let Err(err) = udev.session.change_vt(vt) { if let Err(err) = udev.session.change_vt(vt) {
error!("Failed to switch to vt {vt}: {err}"); 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 // the supplied buffer can not be scanned out directly
let planes_formats = planes let planes_formats = planes
.primary .primary
.formats
.into_iter() .into_iter()
.flat_map(|p| p.formats)
.chain(planes.overlay.into_iter().flat_map(|p| p.formats)) .chain(planes.overlay.into_iter().flat_map(|p| p.formats))
.collect::<IndexSet<_>>() .collect::<IndexSet<_>>()
.intersection(&all_render_formats) .intersection(&all_render_formats)
@ -800,7 +754,7 @@ enum PendingGammaChange {
struct ScreencopyCommitState { struct ScreencopyCommitState {
primary_plane_swapchain: CommitCounter, primary_plane_swapchain: CommitCounter,
primary_plane_element: CommitCounter, primary_plane_element: CommitCounter,
_cursor: CommitCounter, cursor: CommitCounter,
} }
type GbmDrmCompositor = DrmCompositor< type GbmDrmCompositor = DrmCompositor<
@ -1036,8 +990,9 @@ impl Udev {
let mut planes = surface.planes().clone(); let mut planes = surface.planes().clone();
// INFO: We are disabling overlay planes because it seems that any elements on // 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; // overlay planes don't get up/downscaled according to the set filter;
// | it always defaults to linear. // it always defaults to linear. Also alacritty seems to have the wrong alpha
// when it's on the overlay plane.
planes.overlay.clear(); planes.overlay.clear();
match DrmCompositor::new( match DrmCompositor::new(
@ -1117,7 +1072,7 @@ impl Udev {
node: DrmNode, node: DrmNode,
crtc: crtc::Handle, crtc: crtc::Handle,
) { ) {
tracing::debug!(?crtc, "connector_disconnected"); debug!(?crtc, "connector_disconnected");
let device = if let Some(device) = self.backends.get_mut(&node) { let device = if let Some(device) = self.backends.get_mut(&node) {
device device
@ -1185,7 +1140,7 @@ impl Udev {
self.connector_disconnected(pinnacle, node, crtc); self.connector_disconnected(pinnacle, node, crtc);
} }
tracing::debug!("Surfaces dropped"); debug!("Surfaces dropped");
// drop the backends on this side // drop the backends on this side
if let Some(backend_data) = self.backends.remove(&node) { if let Some(backend_data) = self.backends.remove(&node) {
@ -1195,7 +1150,7 @@ impl Udev {
pinnacle.loop_handle.remove(backend_data.registration_token); 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() || (pinnacle.lock_state.is_locked()
&& output.with_state(|state| state.lock_surface.is_none())); && 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( let (pointer_render_elements, cursor_ids) = pointer_render_elements(
output, output,
&mut renderer, &mut renderer,
@ -1414,7 +1356,6 @@ impl Udev {
pointer_location, pointer_location,
pinnacle.dnd_icon.as_ref(), pinnacle.dnd_icon.as_ref(),
&pinnacle.clock, &pinnacle.clock,
kind,
); );
output_render_elements.extend( output_render_elements.extend(
pointer_render_elements 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 // 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. // 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) => { PrimaryPlaneElement::Swapchain(element) => {
let swapchain_commit = &mut surface.screencopy_commit_state.primary_plane_swapchain; let swapchain_commit = &mut surface.screencopy_commit_state.primary_plane_swapchain;
let damage = element.damage.damage_since(Some(*swapchain_commit)); 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 let cursor_damage = render_frame_result
// | the cursor transparent is fixed/a workaround found. .cursor_element
// let cursor_damage = render_frame_result .map(|cursor| {
// .cursor_element let damage =
// .map(|cursor| { cursor.damage_since(scale, Some(surface.screencopy_commit_state.cursor));
// let damage = surface.screencopy_commit_state.cursor = cursor.current_commit();
// cursor.damage_since(scale, Some(surface.screencopy_commit_state.cursor)); damage
// new_commit_counters.cursor = cursor.current_commit(); })
// damage .unwrap_or_default();
// })
// .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); // We currently have overlay planes disabled, so we don't have to worry about that.
// if damage.is_empty() && !render_frame_result.is_empty {
// // The primary plane and cursor had no damage but something got rendered, if let Some(cursor_elem) = render_frame_result.cursor_element {
// // so it must be the cursor moving. damage = damage
// // .into_iter()
// // We currently have overlay planes disabled, so we don't have to worry about that. .chain([cursor_elem.geometry(scale)])
// if damage.is_empty() && !render_frame_result.is_empty { .collect();
// if let Some(cursor_elem) = render_frame_result.cursor_element { }
// damage.push(cursor_elem.geometry(scale)); }
// }
// }
// INFO: Protocol states that `copy_with_damage` should wait until there is // INFO: Protocol states that `copy_with_damage` should wait until there is
// | damage to be copied. // | damage to be copied.

View file

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

View file

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

View file

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