[mutter] monitor-manager/native: Allow starting without outputs when headless
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] monitor-manager/native: Allow starting without outputs when headless
- Date: Fri, 12 Mar 2021 15:43:44 +0000 (UTC)
commit 59a10cd18827100643804299874b35db31425943
Author: Jonas Ã…dahl <jadahl gmail com>
Date: Mon Jan 18 22:34:04 2021 +0100
monitor-manager/native: Allow starting without outputs when headless
This will allow starting, then adding virtual outputs when needed e.g.
via the screen cast API.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1698>
src/backends/native/meta-backend-native.c | 2 +
src/backends/native/meta-monitor-manager-native.c | 48 ++++++++++++++++++++++-
2 files changed, 49 insertions(+), 1 deletion(-)
---
diff --git a/src/backends/native/meta-backend-native.c b/src/backends/native/meta-backend-native.c
index ebd8570d07..45fb7b421d 100644
--- a/src/backends/native/meta-backend-native.c
+++ b/src/backends/native/meta-backend-native.c
@@ -212,10 +212,12 @@ static MetaMonitorManager *
meta_backend_native_create_monitor_manager (MetaBackend *backend,
GError **error)
{
+ MetaBackendNative *backend_native = META_BACKEND_NATIVE (backend);
MetaMonitorManager *manager;
manager = g_initable_new (META_TYPE_MONITOR_MANAGER_NATIVE, NULL, error,
"backend", backend,
+ "needs-outputs", !backend_native->is_headless,
NULL);
if (!manager)
return NULL;
diff --git a/src/backends/native/meta-monitor-manager-native.c
b/src/backends/native/meta-monitor-manager-native.c
index d0253d89ab..30a1535061 100644
--- a/src/backends/native/meta-monitor-manager-native.c
+++ b/src/backends/native/meta-monitor-manager-native.c
@@ -63,6 +63,17 @@
#include "meta/main.h"
#include "meta/meta-x11-errors.h"
+enum
+{
+ PROP_0,
+
+ PROP_NEED_OUTPUTS,
+
+ N_PROPS
+};
+
+static GParamSpec *obj_props[N_PROPS];
+
struct _MetaMonitorManagerNative
{
MetaMonitorManager parent_instance;
@@ -70,6 +81,8 @@ struct _MetaMonitorManagerNative
gulong kms_resources_changed_handler_id;
GHashTable *crtc_gamma_cache;
+
+ gboolean needs_outputs;
};
struct _MetaMonitorManagerNativeClass
@@ -588,6 +601,26 @@ meta_monitor_manager_native_get_default_layout_mode (MetaMonitorManager *manager
return META_LOGICAL_MONITOR_LAYOUT_MODE_PHYSICAL;
}
+static void
+meta_monitor_manager_native_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ MetaMonitorManagerNative *manager_native =
+ META_MONITOR_MANAGER_NATIVE (object);
+
+ switch (prop_id)
+ {
+ case PROP_NEED_OUTPUTS:
+ manager_native->needs_outputs = g_value_get_boolean (value);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
static void
meta_monitor_manager_native_dispose (GObject *object)
{
@@ -625,7 +658,8 @@ meta_monitor_manager_native_initable_init (GInitable *initable,
break;
}
}
- if (!can_have_outputs)
+
+ if (manager_native->needs_outputs && !can_have_outputs)
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND,
"No GPUs with outputs found");
@@ -649,6 +683,7 @@ initable_iface_init (GInitableIface *initable_iface)
static void
meta_monitor_manager_native_init (MetaMonitorManagerNative *manager_native)
{
+ manager_native->needs_outputs = TRUE;
}
static void
@@ -657,6 +692,7 @@ meta_monitor_manager_native_class_init (MetaMonitorManagerNativeClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
MetaMonitorManagerClass *manager_class = META_MONITOR_MANAGER_CLASS (klass);
+ object_class->set_property = meta_monitor_manager_native_set_property;
object_class->dispose = meta_monitor_manager_native_dispose;
manager_class->read_edid =
@@ -685,4 +721,14 @@ meta_monitor_manager_native_class_init (MetaMonitorManagerNativeClass *klass)
meta_monitor_manager_native_get_max_screen_size;
manager_class->get_default_layout_mode =
meta_monitor_manager_native_get_default_layout_mode;
+
+ obj_props[PROP_NEED_OUTPUTS] =
+ g_param_spec_boolean ("needs-outputs",
+ "needs-outputs",
+ "Whether any outputs are needed for operation",
+ TRUE,
+ G_PARAM_WRITABLE |
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS);
+ g_object_class_install_properties (object_class, N_PROPS, obj_props);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]