From 62c5a76739828ce61d0cb19e3835ecb2ee9e7d53 Mon Sep 17 00:00:00 2001 From: Ian Douglas Scott Date: Thu, 16 Jan 2025 10:11:02 -0800 Subject: [PATCH] Add a `COSMIC_DISABLE_SYNCOBJ` env var to disable syncobj protocol If any issues with the syncobj protocol come up, or any issues we suspect may be related to it, an env var may be helpful. --- src/backend/kms/mod.rs | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/src/backend/kms/mod.rs b/src/backend/kms/mod.rs index 49a56cbd..ce467ece 100644 --- a/src/backend/kms/mod.rs +++ b/src/backend/kms/mod.rs @@ -156,19 +156,21 @@ pub fn init_backend( } } - let kms = match &mut state.backend { - BackendData::Kms(kms) => kms, - _ => unreachable!(), - }; - if let Some(primary_node) = kms - .primary_node - .and_then(|node| node.node_with_type(NodeType::Primary).and_then(|x| x.ok())) - { - if let Some(device) = kms.drm_devices.get(&primary_node) { - let import_device = device.drm.device().device_fd().clone(); - if supports_syncobj_eventfd(&import_device) { - let syncobj_state = DrmSyncobjState::new::(&dh, import_device); - kms.syncobj_state = Some(syncobj_state); + if !crate::utils::env::bool_var("COSMIC_DISABLE_SYNCOBJ").unwrap_or(false) { + let kms = match &mut state.backend { + BackendData::Kms(kms) => kms, + _ => unreachable!(), + }; + if let Some(primary_node) = kms + .primary_node + .and_then(|node| node.node_with_type(NodeType::Primary).and_then(|x| x.ok())) + { + if let Some(device) = kms.drm_devices.get(&primary_node) { + let import_device = device.drm.device().device_fd().clone(); + if supports_syncobj_eventfd(&import_device) { + let syncobj_state = DrmSyncobjState::new::(&dh, import_device); + kms.syncobj_state = Some(syncobj_state); + } } } }