kms/impl-device/atomic: Set IN_FENCE_FD for direct scanout

Since meta_kms_impl_device_get_sync_file always returns the same
file descriptor referencing the same sync_file, this means the atomic
ioctl doesn't need to wait for any fences to signal. This is fine
because we already waited for the buffer to become idle before applying
the Wayland surface state.

Fixes the atomic commit ioctl spuriously synchronizing to the screen
cast paint (at least with the amdgpu driver), which could result in
the page flip missing its target scanout cycle.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3148

v2:
* Rename local variable to signaled_sync_file for consistency with new
  function name

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3389>
This commit is contained in:
Michel Dänzer 2023-11-12 16:07:02 +01:00 committed by Marge Bot
parent 281ff86b4b
commit e8a213beef

View File

@ -588,6 +588,30 @@ process_plane_assignment (MetaKmsImplDevice *impl_device,
error))
return FALSE;
}
if (plane_assignment->flags & META_KMS_ASSIGN_PLANE_FLAG_DIRECT_SCANOUT)
{
int signaled_sync_file;
signaled_sync_file =
meta_kms_impl_device_get_signaled_sync_file (impl_device);
if (signaled_sync_file >= 0)
{
g_autoptr (GError) local_error = NULL;
if (!add_plane_property (impl_device,
plane, req,
META_KMS_PLANE_PROP_IN_FENCE_FD,
signaled_sync_file,
&local_error))
{
meta_topic (META_DEBUG_KMS,
"add_plane_property failed for IN_FENCE_FD: %s",
local_error->message);
}
}
}
}
else
{