mirror of
https://github.com/brl/mutter.git
synced 2025-07-11 04:57:18 +00:00
kms-impl-device: Clean up state if drm resources disappear
It may happen that drmModeGetResources() starts returning NULL. Handle
this gracefully by removing all connectors, CRTCs and planes making the
device in practice defunct.
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1121
(cherry picked from commit 5319949a45
)
This commit is contained in:
@ -326,6 +326,16 @@ meta_kms_impl_device_update_states (MetaKmsImplDevice *impl_device)
|
||||
meta_assert_in_kms_impl (meta_kms_impl_get_kms (impl_device->impl));
|
||||
|
||||
drm_resources = drmModeGetResources (impl_device->fd);
|
||||
if (!drm_resources)
|
||||
{
|
||||
g_list_free_full (impl_device->planes, g_object_unref);
|
||||
g_list_free_full (impl_device->crtcs, g_object_unref);
|
||||
g_list_free_full (impl_device->connectors, g_object_unref);
|
||||
impl_device->planes = NULL;
|
||||
impl_device->crtcs = NULL;
|
||||
impl_device->connectors = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
update_connectors (impl_device, drm_resources);
|
||||
|
||||
|
Reference in New Issue
Block a user