kms/impl-device: Make non-abstract types explicitly init mode setting
This is a step towards making it possible to add a MetaKmsImplDevice that doesn't actually do any mode setting. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1698>
This commit is contained in:
parent
c4a422bc24
commit
7c25953c65
@ -44,8 +44,13 @@ struct _MetaKmsImplDeviceAtomic
|
||||
GHashTable *page_flip_datas;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (MetaKmsImplDeviceAtomic, meta_kms_impl_device_atomic,
|
||||
META_TYPE_KMS_IMPL_DEVICE)
|
||||
static void
|
||||
initable_iface_init (GInitableIface *iface);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (MetaKmsImplDeviceAtomic, meta_kms_impl_device_atomic,
|
||||
META_TYPE_KMS_IMPL_DEVICE,
|
||||
G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE,
|
||||
initable_iface_init))
|
||||
|
||||
static uint32_t
|
||||
store_new_blob (MetaKmsImplDevice *impl_device,
|
||||
@ -1006,6 +1011,16 @@ meta_kms_impl_device_atomic_finalize (GObject *object)
|
||||
G_OBJECT_CLASS (meta_kms_impl_device_atomic_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
meta_kms_impl_device_atomic_initable_init (GInitable *initable,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
MetaKmsImplDevice *impl_device = META_KMS_IMPL_DEVICE (initable);
|
||||
|
||||
return meta_kms_impl_device_init_mode_setting (impl_device, error);
|
||||
}
|
||||
|
||||
static void
|
||||
meta_kms_impl_device_atomic_init (MetaKmsImplDeviceAtomic *impl_device_atomic)
|
||||
{
|
||||
@ -1015,6 +1030,12 @@ meta_kms_impl_device_atomic_init (MetaKmsImplDeviceAtomic *impl_device_atomic)
|
||||
(GDestroyNotify) meta_kms_page_flip_data_unref);
|
||||
}
|
||||
|
||||
static void
|
||||
initable_iface_init (GInitableIface *iface)
|
||||
{
|
||||
iface->init = meta_kms_impl_device_atomic_initable_init;
|
||||
}
|
||||
|
||||
static void
|
||||
meta_kms_impl_device_atomic_class_init (MetaKmsImplDeviceAtomicClass *klass)
|
||||
{
|
||||
|
@ -58,8 +58,6 @@ struct _MetaKmsImplDeviceSimple
|
||||
GHashTable *cached_mode_sets;
|
||||
};
|
||||
|
||||
static GInitableIface *initable_parent_iface;
|
||||
|
||||
static void
|
||||
initable_iface_init (GInitableIface *iface);
|
||||
|
||||
@ -1507,7 +1505,7 @@ meta_kms_impl_device_simple_initable_init (GInitable *initable,
|
||||
MetaKmsDevice *device = meta_kms_impl_device_get_device (impl_device);
|
||||
GList *l;
|
||||
|
||||
if (!initable_parent_iface->init (initable, cancellable, error))
|
||||
if (!meta_kms_impl_device_init_mode_setting (impl_device, error))
|
||||
return FALSE;
|
||||
|
||||
impl_device_simple->cached_mode_sets =
|
||||
@ -1546,8 +1544,6 @@ meta_kms_impl_device_simple_init (MetaKmsImplDeviceSimple *impl_device_simple)
|
||||
static void
|
||||
initable_iface_init (GInitableIface *iface)
|
||||
{
|
||||
initable_parent_iface = g_type_interface_peek_parent (iface);
|
||||
|
||||
iface->init = meta_kms_impl_device_simple_initable_init;
|
||||
}
|
||||
|
||||
|
@ -75,14 +75,9 @@ typedef struct _MetaKmsImplDevicePrivate
|
||||
GList *fallback_modes;
|
||||
} MetaKmsImplDevicePrivate;
|
||||
|
||||
static void
|
||||
initable_iface_init (GInitableIface *iface);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (MetaKmsImplDevice, meta_kms_impl_device,
|
||||
G_TYPE_OBJECT,
|
||||
G_ADD_PRIVATE (MetaKmsImplDevice)
|
||||
G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE,
|
||||
initable_iface_init))
|
||||
G_ADD_PRIVATE (MetaKmsImplDevice))
|
||||
|
||||
MetaKmsDevice *
|
||||
meta_kms_impl_device_get_device (MetaKmsImplDevice *impl_device)
|
||||
@ -786,12 +781,10 @@ meta_kms_impl_device_finalize (GObject *object)
|
||||
G_OBJECT_CLASS (meta_kms_impl_device_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
meta_kms_impl_device_initable_init (GInitable *initable,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
gboolean
|
||||
meta_kms_impl_device_init_mode_setting (MetaKmsImplDevice *impl_device,
|
||||
GError **error)
|
||||
{
|
||||
MetaKmsImplDevice *impl_device = META_KMS_IMPL_DEVICE (initable);
|
||||
MetaKmsImplDevicePrivate *priv =
|
||||
meta_kms_impl_device_get_instance_private (impl_device);
|
||||
drmModeRes *drm_resources;
|
||||
@ -829,12 +822,6 @@ meta_kms_impl_device_init (MetaKmsImplDevice *device)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
initable_iface_init (GInitableIface *initable_iface)
|
||||
{
|
||||
initable_iface->init = meta_kms_impl_device_initable_init;
|
||||
}
|
||||
|
||||
static void
|
||||
meta_kms_impl_device_class_init (MetaKmsImplDeviceClass *klass)
|
||||
{
|
||||
|
@ -140,4 +140,7 @@ void meta_kms_impl_device_discard_pending_page_flips (MetaKmsImplDevice *impl_de
|
||||
|
||||
int meta_kms_impl_device_close (MetaKmsImplDevice *impl_device);
|
||||
|
||||
gboolean meta_kms_impl_device_init_mode_setting (MetaKmsImplDevice *impl_device,
|
||||
GError **error);
|
||||
|
||||
#endif /* META_KMS_IMPL_DEVICE_H */
|
||||
|
Loading…
Reference in New Issue
Block a user