From 6897f81984f63212d1a2cc5ddd40d18da0e84d24 Mon Sep 17 00:00:00 2001 From: Victoria Brekenfeld Date: Mon, 11 Aug 2025 16:48:16 +0200 Subject: [PATCH] kms/device: Don't re-enumerate disabled outputs --- src/backend/kms/device.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/backend/kms/device.rs b/src/backend/kms/device.rs index 0b7fab74..fa55a569 100644 --- a/src/backend/kms/device.rs +++ b/src/backend/kms/device.rs @@ -586,8 +586,10 @@ impl Device { .iter() .filter(|(conn, maybe)| match (surfaces.get(&conn), maybe) { (Some(current_crtc), Some(new_crtc)) => current_crtc != new_crtc, - (None, _) => true, - _ => false, + // see `removed` + (Some(_), None) => true, + // if we already know about it, we don't consider it added + (None, _) => self.inner.outputs.get(conn).is_none(), }) .map(|(conn, crtc)| (*conn, *crtc)) .collect::>(); @@ -598,6 +600,9 @@ impl Device { .iter() .filter(|(conn, _)| match config.get(conn) { Some(Some(c)) => surfaces.get(&conn).is_some_and(|crtc| c != crtc), + // if don't have a crtc, we need to drop the surface if it exists. + // so it needs to be in both `removed` AND `added`. + Some(None) => surfaces.get(&conn).is_some(), _ => true, }) .map(|(conn, _)| *conn)