kms/impl: Manage a list of impl devices
Accessing the device list directly from MetaKms might not be safe if we introduce threads, so keep a list completely within the impl context. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1488>
This commit is contained in:
parent
eb78b62515
commit
a8d724d058
@ -270,6 +270,8 @@ create_impl_device_in_impl (MetaKmsImpl *impl,
|
||||
if (!impl_device)
|
||||
return FALSE;
|
||||
|
||||
meta_kms_impl_add_impl_device (impl, impl_device);
|
||||
|
||||
data->out_impl_device = impl_device;
|
||||
data->out_crtcs = meta_kms_impl_device_copy_crtcs (impl_device);
|
||||
data->out_connectors = meta_kms_impl_device_copy_connectors (impl_device);
|
||||
|
@ -703,6 +703,8 @@ meta_kms_impl_device_finalize (GObject *object)
|
||||
MetaKmsImplDevicePrivate *priv =
|
||||
meta_kms_impl_device_get_instance_private (impl_device);
|
||||
|
||||
meta_kms_impl_remove_impl_device (priv->impl, impl_device);
|
||||
|
||||
g_list_free_full (priv->planes, g_object_unref);
|
||||
g_list_free_full (priv->crtcs, g_object_unref);
|
||||
g_list_free_full (priv->connectors, g_object_unref);
|
||||
|
@ -22,6 +22,8 @@
|
||||
|
||||
#include "backends/native/meta-kms-impl.h"
|
||||
|
||||
#include "backends/native/meta-kms-private.h"
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
@ -32,6 +34,8 @@ enum
|
||||
typedef struct _MetaKmsImplPrivate
|
||||
{
|
||||
MetaKms *kms;
|
||||
|
||||
GList *impl_devices;
|
||||
} MetaKmsImplPrivate;
|
||||
|
||||
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (MetaKmsImpl, meta_kms_impl, G_TYPE_OBJECT)
|
||||
@ -44,6 +48,28 @@ meta_kms_impl_get_kms (MetaKmsImpl *impl)
|
||||
return priv->kms;
|
||||
}
|
||||
|
||||
void
|
||||
meta_kms_impl_add_impl_device (MetaKmsImpl *impl,
|
||||
MetaKmsImplDevice *impl_device)
|
||||
{
|
||||
MetaKmsImplPrivate *priv = meta_kms_impl_get_instance_private (impl);
|
||||
|
||||
meta_assert_in_kms_impl (priv->kms);
|
||||
|
||||
priv->impl_devices = g_list_append (priv->impl_devices, impl_device);
|
||||
}
|
||||
|
||||
void
|
||||
meta_kms_impl_remove_impl_device (MetaKmsImpl *impl,
|
||||
MetaKmsImplDevice *impl_device)
|
||||
{
|
||||
MetaKmsImplPrivate *priv = meta_kms_impl_get_instance_private (impl);
|
||||
|
||||
meta_assert_in_kms_impl (priv->kms);
|
||||
|
||||
priv->impl_devices = g_list_remove (priv->impl_devices, impl_device);
|
||||
}
|
||||
|
||||
MetaKmsFeedback *
|
||||
meta_kms_impl_process_update (MetaKmsImpl *impl,
|
||||
MetaKmsUpdate *update)
|
||||
|
@ -47,6 +47,12 @@ MetaKms * meta_kms_impl_get_kms (MetaKmsImpl *impl);
|
||||
MetaKmsFeedback * meta_kms_impl_process_update (MetaKmsImpl *impl,
|
||||
MetaKmsUpdate *update);
|
||||
|
||||
void meta_kms_impl_add_impl_device (MetaKmsImpl *impl,
|
||||
MetaKmsImplDevice *impl_device);
|
||||
|
||||
void meta_kms_impl_remove_impl_device (MetaKmsImpl *impl,
|
||||
MetaKmsImplDevice *impl_device);
|
||||
|
||||
void meta_kms_impl_handle_page_flip_callback (MetaKmsImpl *impl,
|
||||
MetaKmsPageFlipData *page_flip_data);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user