kms/impl-device: Inhibit real-time scheduling when querying KMS state
On some setups, the kernel may keep the KMS thread busy for significant amounts of time while querying KMS state, which could result in mutter getting killed by the kernel, e.g. after hot-plugging displays. Issue: https://gitlab.gnome.org/GNOME/mutter/-/issues/3479 Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3763>
This commit is contained in:
parent
be4bf8da9c
commit
8a862b102c
@ -966,6 +966,9 @@ meta_kms_impl_device_update_states (MetaKmsImplDevice *impl_device,
|
|||||||
{
|
{
|
||||||
MetaKmsImplDevicePrivate *priv =
|
MetaKmsImplDevicePrivate *priv =
|
||||||
meta_kms_impl_device_get_instance_private (impl_device);
|
meta_kms_impl_device_get_instance_private (impl_device);
|
||||||
|
MetaKmsImpl *kms_impl = meta_kms_impl_device_get_impl (impl_device);
|
||||||
|
MetaThreadImpl *thread_impl = META_THREAD_IMPL (kms_impl);
|
||||||
|
MetaThread *thread = meta_thread_impl_get_thread (thread_impl);
|
||||||
g_autoptr (GError) error = NULL;
|
g_autoptr (GError) error = NULL;
|
||||||
int fd;
|
int fd;
|
||||||
drmModeRes *drm_resources;
|
drmModeRes *drm_resources;
|
||||||
@ -985,11 +988,13 @@ meta_kms_impl_device_update_states (MetaKmsImplDevice *impl_device,
|
|||||||
ensure_latched_fd_hold (impl_device);
|
ensure_latched_fd_hold (impl_device);
|
||||||
|
|
||||||
fd = meta_device_file_get_fd (priv->device_file);
|
fd = meta_device_file_get_fd (priv->device_file);
|
||||||
|
meta_thread_inhibit_realtime_in_impl (thread);
|
||||||
drm_resources = drmModeGetResources (fd);
|
drm_resources = drmModeGetResources (fd);
|
||||||
if (!drm_resources)
|
if (!drm_resources)
|
||||||
{
|
{
|
||||||
meta_topic (META_DEBUG_KMS, "Device '%s' didn't return any resources",
|
meta_topic (META_DEBUG_KMS, "Device '%s' didn't return any resources",
|
||||||
priv->path);
|
priv->path);
|
||||||
|
meta_thread_uninhibit_realtime_in_impl (thread);
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1006,6 +1011,8 @@ meta_kms_impl_device_update_states (MetaKmsImplDevice *impl_device,
|
|||||||
changes |= meta_kms_crtc_update_state_in_impl (crtc);
|
changes |= meta_kms_crtc_update_state_in_impl (crtc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
meta_thread_uninhibit_realtime_in_impl (thread);
|
||||||
|
|
||||||
drmModeFreeResources (drm_resources);
|
drmModeFreeResources (drm_resources);
|
||||||
|
|
||||||
return changes;
|
return changes;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user