From ea5b140d0c0599eacf7c042f3c5b58876698cf57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Wed, 1 Feb 2023 16:22:28 +0100 Subject: [PATCH] Allow starting headless again Resolves: #2116363 --- ...-t-query-preferred-size-without-allo.patch | 52 +++++++++++++++++++ ...hat-we-can-have-outputs-if-we-have-c.patch | 45 ++++++++++++++++ mutter.spec | 10 +++- 3 files changed, 106 insertions(+), 1 deletion(-) create mode 100644 0001-clutter-text-Don-t-query-preferred-size-without-allo.patch create mode 100644 0001-gpu-kms-Report-that-we-can-have-outputs-if-we-have-c.patch diff --git a/0001-clutter-text-Don-t-query-preferred-size-without-allo.patch b/0001-clutter-text-Don-t-query-preferred-size-without-allo.patch new file mode 100644 index 0000000..90c09f5 --- /dev/null +++ b/0001-clutter-text-Don-t-query-preferred-size-without-allo.patch @@ -0,0 +1,52 @@ +From 5cd66485cdd99068dab0f57d7f64d3ef294b0037 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Florian=20M=C3=BCllner?= +Date: Wed, 4 Aug 2021 19:30:10 +0200 +Subject: [PATCH] clutter/text: Don't query preferred size without allocation + +The size request functions query the resource scale, which hits +an assert if headless. The returned sizes are already only used +when clutter_actor_has_allocation() is true, so this doesn't +change the condition for calling either redraw or relayout. + +https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4522 + +Part-of: +--- + clutter/clutter/clutter-text.c | 17 +++++++++++------ + 1 file changed, 11 insertions(+), 6 deletions(-) + +diff --git a/clutter/clutter/clutter-text.c b/clutter/clutter/clutter-text.c +index 45c7eac56b..80e53ea32f 100644 +--- a/clutter/clutter/clutter-text.c ++++ b/clutter/clutter/clutter-text.c +@@ -4797,16 +4797,21 @@ static void + clutter_text_queue_redraw_or_relayout (ClutterText *self) + { + ClutterActor *actor = CLUTTER_ACTOR (self); +- gfloat preferred_width; +- gfloat preferred_height; ++ float preferred_width = -1.; ++ float preferred_height = -1.; + + clutter_text_dirty_cache (self); + +- /* we're using our private implementations here to avoid the caching done by ClutterActor */ +- clutter_text_get_preferred_width (actor, -1, NULL, &preferred_width); +- clutter_text_get_preferred_height (actor, preferred_width, NULL, &preferred_height); ++ if (clutter_actor_has_allocation (actor)) ++ { ++ /* we're using our private implementations here to avoid the caching done by ClutterActor */ ++ clutter_text_get_preferred_width (actor, -1, NULL, &preferred_width); ++ clutter_text_get_preferred_height (actor, preferred_width, NULL, ++ &preferred_height); ++ } + +- if (clutter_actor_has_allocation (actor) && ++ if (preferred_width > 0 && ++ preferred_height > 0 && + fabsf (preferred_width - clutter_actor_get_width (actor)) <= 0.001 && + fabsf (preferred_height - clutter_actor_get_height (actor)) <= 0.001) + clutter_text_queue_redraw (actor); +-- +2.31.1 + diff --git a/0001-gpu-kms-Report-that-we-can-have-outputs-if-we-have-c.patch b/0001-gpu-kms-Report-that-we-can-have-outputs-if-we-have-c.patch new file mode 100644 index 0000000..37712b8 --- /dev/null +++ b/0001-gpu-kms-Report-that-we-can-have-outputs-if-we-have-c.patch @@ -0,0 +1,45 @@ +From 168a47c9ebefaeca6cc25fcbc0d41ac50c16f400 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jonas=20=C3=85dahl?= +Date: Wed, 1 Feb 2023 10:07:53 +0100 +Subject: [PATCH] gpu/kms: Report that we can have outputs if we have + connectors + +As part of https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/525 +(introduction of transactional KMS API), the logic determining whether a +GPU can have outputs was changed from whether any connectors existed to +whether any connected connectors existed. That effectively meant that we +wouldn't attempt to start at all if there were no monitors connected +while starting up. + +This was unintentional, so lets revert back the expected behavior. +--- + src/backends/native/meta-gpu-kms.c | 13 +------------ + 1 file changed, 1 insertion(+), 12 deletions(-) + +diff --git a/src/backends/native/meta-gpu-kms.c b/src/backends/native/meta-gpu-kms.c +index e81c90a022..2756bddb26 100644 +--- a/src/backends/native/meta-gpu-kms.c ++++ b/src/backends/native/meta-gpu-kms.c +@@ -399,18 +399,7 @@ meta_gpu_kms_read_current (MetaGpu *gpu, + gboolean + meta_gpu_kms_can_have_outputs (MetaGpuKms *gpu_kms) + { +- GList *l; +- int n_connected_connectors = 0; +- +- for (l = meta_kms_device_get_connectors (gpu_kms->kms_device); l; l = l->next) +- { +- MetaKmsConnector *kms_connector = l->data; +- +- if (meta_kms_connector_get_current_state (kms_connector)) +- n_connected_connectors++; +- } +- +- return n_connected_connectors > 0; ++ return !!meta_kms_device_get_connectors (gpu_kms->kms_device); + } + + MetaGpuKms * +-- +2.39.1 + diff --git a/mutter.spec b/mutter.spec index 31ac053..89de75f 100644 --- a/mutter.spec +++ b/mutter.spec @@ -10,7 +10,7 @@ Name: mutter Version: 40.9 -Release: 13%{?dist} +Release: 14%{?dist} Summary: Window and compositing manager based on Clutter License: GPLv2+ @@ -107,6 +107,10 @@ Patch43: 0002-output-kms-Don-t-attemp-to-add-common-modes-on-conne.patch Patch44: 0001-backends-Only-apply-EDID-based-tablet-mapping-heuris.patch +# Allow starting headless again (#2116363) +Patch45: 0001-gpu-kms-Report-that-we-can-have-outputs-if-we-have-c.patch +Patch46: 0001-clutter-text-Don-t-query-preferred-size-without-allo.patch + BuildRequires: chrpath BuildRequires: pango-devel BuildRequires: startup-notification-devel @@ -254,6 +258,10 @@ desktop-file-validate %{buildroot}/%{_datadir}/applications/%{name}.desktop %{_datadir}/mutter-%{mutter_api_version}/tests %changelog +* Wed Feb 01 2023 Jonas Ã…dahl ) - 40.9-14 +- Allow starting headless again + Resolves: #2116363 + * Tue Jan 03 2023 Carlos Garnacho ) - 40.9-13 - Do not apply EDID mapping heuristics to non-integrated tablets Resolves: #2047341