From ebdb06c60645d6494c134810718559f1aee48cfa Mon Sep 17 00:00:00 2001 From: Corbin Crutchley Date: Fri, 3 Jul 2026 07:46:56 -0700 Subject: [PATCH] fix: remove second screen cursor --- .../src/compositor/udev.rs | 2 +- .../src/compositor/udev/device.rs | 29 +++++++++++++++++-- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/crates/hearthspace-compositor/src/compositor/udev.rs b/crates/hearthspace-compositor/src/compositor/udev.rs index aaacc3b..50ef704 100644 --- a/crates/hearthspace-compositor/src/compositor/udev.rs +++ b/crates/hearthspace-compositor/src/compositor/udev.rs @@ -409,7 +409,7 @@ impl UdevBackendState { }; let (mut dmabuf, buffer_age) = output.gbm_surface.next_buffer()?; - let age = if force_full_redraw { + let age = if force_full_redraw || state.software_cursor_visible { 0 } else { usize::from(buffer_age) diff --git a/crates/hearthspace-compositor/src/compositor/udev/device.rs b/crates/hearthspace-compositor/src/compositor/udev/device.rs index 995562e..fd31d52 100644 --- a/crates/hearthspace-compositor/src/compositor/udev/device.rs +++ b/crates/hearthspace-compositor/src/compositor/udev/device.rs @@ -4,7 +4,7 @@ use smithay::{ backend::{ allocator::gbm::{GbmAllocator, GbmBufferFlags, GbmDevice}, allocator::{Format, Fourcc}, - drm::{DrmDevice, DrmDeviceFd, GbmBufferedSurface}, + drm::{DrmDevice, DrmDeviceFd, DrmSurface, GbmBufferedSurface}, egl::{EGLContext, EGLDisplay}, renderer::{ImportDma, damage::OutputDamageTracker, gles::GlesRenderer}, session::{Session, libseat::LibSeatSession}, @@ -12,7 +12,7 @@ use smithay::{ }, output::{PhysicalProperties, Subpixel}, reexports::{ - drm::control::{Device as ControlDevice, Mode, connector, crtc}, + drm::control::{Device as ControlDevice, Mode, connector, crtc, dumbbuffer}, rustix::fs::{OFlags, stat}, }, utils::{DeviceFd, Physical, Size, Transform}, @@ -260,6 +260,7 @@ fn create_output_surface( target.mode, std::slice::from_ref(&target.connector), )?; + clear_hardware_cursor(scanout_node, &surface, &target); info!(connector = ?target.connector, crtc = ?target.crtc, mode = ?target.mode, "created DRM surface"); let gbm_device = GbmDevice::new(render_node.drm_fd.clone())?; @@ -289,6 +290,30 @@ fn create_output_surface( }) } +fn clear_hardware_cursor( + scanout_node: &ScanoutNode, + surface: &DrmSurface, + target: &KmsOutputTarget, +) { + #[allow(deprecated)] + match scanout_node + .drm_fd + .set_cursor(target.crtc, Option::<&dumbbuffer::DumbBuffer>::None) + { + Ok(()) => debug!(crtc = ?target.crtc, "cleared legacy DRM cursor plane"), + Err(error) => debug!(crtc = ?target.crtc, %error, "legacy DRM cursor clear failed"), + } + + for plane in surface.planes().cursor.iter().map(|plane| plane.handle) { + match surface.clear_plane(plane) { + Ok(()) => debug!(crtc = ?target.crtc, ?plane, "queued atomic DRM cursor plane clear"), + Err(error) => { + debug!(crtc = ?target.crtc, ?plane, %error, "atomic DRM cursor plane clear failed") + } + } + } +} + pub(super) fn create_udev_device( session: &mut LibSeatSession, path: PathBuf, -- 2.51.2