[mutter] kms/impl-device: Make non-abstract types explicitly init mode setting
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] kms/impl-device: Make non-abstract types explicitly init mode setting
- Date: Fri, 12 Mar 2021 15:43:44 +0000 (UTC)
commit 7c25953c65ffc2c81c481e501046777df5372e51
Author: Jonas Ã…dahl <jadahl gmail com>
Date: Mon Jan 18 18:27:07 2021 +0100
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>
src/backends/native/meta-kms-impl-device-atomic.c | 25 +++++++++++++++++++++--
src/backends/native/meta-kms-impl-device-simple.c | 6 +-----
src/backends/native/meta-kms-impl-device.c | 21 ++++---------------
src/backends/native/meta-kms-impl-device.h | 3 +++
4 files changed, 31 insertions(+), 24 deletions(-)
---
diff --git a/src/backends/native/meta-kms-impl-device-atomic.c
b/src/backends/native/meta-kms-impl-device-atomic.c
index a7c219ef36..d2da354d37 100644
--- a/src/backends/native/meta-kms-impl-device-atomic.c
+++ b/src/backends/native/meta-kms-impl-device-atomic.c
@@ -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)
{
diff --git a/src/backends/native/meta-kms-impl-device-simple.c
b/src/backends/native/meta-kms-impl-device-simple.c
index 99c09a6877..07f80c21f8 100644
--- a/src/backends/native/meta-kms-impl-device-simple.c
+++ b/src/backends/native/meta-kms-impl-device-simple.c
@@ -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;
}
diff --git a/src/backends/native/meta-kms-impl-device.c b/src/backends/native/meta-kms-impl-device.c
index b2f1c3f111..1f72de75b5 100644
--- a/src/backends/native/meta-kms-impl-device.c
+++ b/src/backends/native/meta-kms-impl-device.c
@@ -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)
{
diff --git a/src/backends/native/meta-kms-impl-device.h b/src/backends/native/meta-kms-impl-device.h
index a3d31daebf..5b3585aa78 100644
--- a/src/backends/native/meta-kms-impl-device.h
+++ b/src/backends/native/meta-kms-impl-device.h
@@ -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 */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]