Skip to content

Commit

Permalink
Add a COSMIC_DISABLE_SYNCOBJ env var to disable syncobj protocol
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ids1024 authored and Drakulix committed Jan 16, 2025
1 parent 9dddead commit 6c7ec54
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions src/backend/kms/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<State>(&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::<State>(&dh, import_device);
kms.syncobj_state = Some(syncobj_state);
}
}
}
}
Expand Down

0 comments on commit 6c7ec54

Please sign in to comment.