From fb44b240ea4a3aa39a6b92f5bede23301ab9a26e Mon Sep 17 00:00:00 2001 From: Ian Douglas Scott Date: Wed, 22 May 2024 12:42:14 -0700 Subject: [PATCH] compositor: Disable `IN_FENCE_FD` on Nvidia Atomic commits fail if this is set on the Nvidia driver, it seems: https://github.com/NVIDIA/open-gpu-kernel-modules/issues/622 Kwin also has a check for this https://invent.kde.org/plasma/kwin/-/merge_requests/4770. This fixes Anvil and cosmic-comp on the Nvidia 555 beta driver. (I'm not sure why it only started to be a problem; `EGL_ANDROID_native_fence_sync` is present in the 550 driver, etc.) --- src/backend/drm/compositor/mod.rs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/backend/drm/compositor/mod.rs b/src/backend/drm/compositor/mod.rs index 176c3b5aba5d..af146cd3b582 100644 --- a/src/backend/drm/compositor/mod.rs +++ b/src/backend/drm/compositor/mod.rs @@ -1640,6 +1640,22 @@ where .overlay .sort_by_key(|p| std::cmp::Reverse(p.zpos.unwrap_or_default())); + let driver = surface.get_driver().map_err(|err| { + FrameError::DrmError(DrmError::Access(AccessError { + errmsg: "Failed to query drm driver", + dev: surface.dev_path(), + source: err, + })) + })?; + // `IN_FENCE_FD` makes commit fail on Nvidia driver + // https://github.com/NVIDIA/open-gpu-kernel-modules/issues/622 + let is_nvidia = driver.name().to_string_lossy().to_lowercase().contains("nvidia") + || driver + .description() + .to_string_lossy() + .to_lowercase() + .contains("nvidia"); + let cursor_size = Size::from((cursor_size.w as i32, cursor_size.h as i32)); let damage_tracker = OutputDamageTracker::from_mode_source(output_mode_source.clone()); let supports_fencing = !surface.is_legacy() @@ -1653,7 +1669,8 @@ where source: err, })) })? - && plane_has_property(&*surface, surface.plane(), "IN_FENCE_FD")?; + && plane_has_property(&*surface, surface.plane(), "IN_FENCE_FD")? + && !is_nvidia; for format in color_formats { debug!("Testing color format: {}", format);