kms: Track active clients instead of active buffers

This commit is contained in:
Victoria Brekenfeld 2025-12-19 18:49:22 +01:00 committed by Victoria Brekenfeld
parent a15e378f1e
commit ca00df0b37
6 changed files with 72 additions and 131 deletions

View file

@ -38,12 +38,13 @@ use smithay::{
drm::control::{Device as ControlDevice, ModeTypeFlags, connector, crtc},
gbm::BufferObjectFlags as GbmBufferFlags,
rustix::fs::OFlags,
wayland_server::{DisplayHandle, Weak, protocol::wl_buffer::WlBuffer},
wayland_server::DisplayHandle,
},
utils::{Clock, DevPath, DeviceFd, Monotonic, Point, Transform},
wayland::drm_lease::{DrmLease, DrmLeaseState},
};
use tracing::{error, info, warn};
use wayland_backend::server::ClientId;
use std::{
borrow::BorrowMut,
@ -117,7 +118,7 @@ pub struct InnerDevice {
pub leased_connectors: Vec<(connector::Handle, crtc::Handle)>,
pub leasing_global: Option<DrmLeaseState>,
pub active_leases: Vec<DrmLease>,
pub active_buffers: HashSet<Weak<WlBuffer>>,
pub active_clients: HashSet<ClientId>,
}
impl fmt::Debug for InnerDevice {
@ -133,7 +134,7 @@ impl fmt::Debug for InnerDevice {
.field("leased_connectors", &self.leased_connectors)
.field("leasing_global", &self.leasing_global)
.field("active_leases", &self.active_leases)
.field("active_buffers", &self.active_buffers.len())
.field("active_clients", &self.active_clients.len())
.finish()
}
}
@ -338,7 +339,7 @@ impl State {
leased_connectors: Vec::new(),
leasing_global,
active_leases: Vec::new(),
active_buffers: HashSet::new(),
active_clients: HashSet::new(),
},
supports_atomic,
@ -738,7 +739,7 @@ impl InnerDevice {
pub fn in_use(&self, primary: Option<&DrmNode>) -> bool {
Some(&self.render_node) == primary
|| !self.surfaces.is_empty()
|| !self.active_buffers.is_empty()
|| !self.active_clients.is_empty()
}
pub fn connector_added(