From d9538f3c4f0c63932ad3601db00302e232449877be594f99f65609d726001564 Mon Sep 17 00:00:00 2001 From: Antonio Larrosa Date: Mon, 24 Jan 2022 11:27:30 +0000 Subject: [PATCH] Accepting request 948381 from home:alarrosa:branches:multimedia:libs - Since wireplumber keeps failing to run in openQA since 0.4.7, let's drop all patches added since then: * 0001-core-add-API-to-check-if-running-in-a-virtual-machine.patch * 0002-alsa-monitor-set-period-size-and-headroom-props-if-running-in-virtual-machine.patch * 0002-default-nodes-handle-nodes-without-Routes.patch - And revert one of the commits introduced in 0.4.7: * 0001-reversed-default-nodes-check-if-default-node-has-available-ro.patch OBS-URL: https://build.opensuse.org/request/show/948381 OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/wireplumber?expand=0&rev=23 --- ...heck-if-running-in-a-virtual-machine.patch | 101 ---------------- ...eck-if-default-node-has-available-ro.patch | 108 ++++++++++++++++++ ...-props-if-running-in-virtual-machine.patch | 31 ----- ...lt-nodes-handle-nodes-without-Routes.patch | 47 -------- wireplumber.changes | 11 ++ wireplumber.spec | 4 +- 6 files changed, 120 insertions(+), 182 deletions(-) delete mode 100644 0001-core-add-API-to-check-if-running-in-a-virtual-machine.patch create mode 100644 0001-reversed-default-nodes-check-if-default-node-has-available-ro.patch delete mode 100644 0002-alsa-monitor-set-period-size-and-headroom-props-if-running-in-virtual-machine.patch delete mode 100644 0002-default-nodes-handle-nodes-without-Routes.patch diff --git a/0001-core-add-API-to-check-if-running-in-a-virtual-machine.patch b/0001-core-add-API-to-check-if-running-in-a-virtual-machine.patch deleted file mode 100644 index e750ea0..0000000 --- a/0001-core-add-API-to-check-if-running-in-a-virtual-machine.patch +++ /dev/null @@ -1,101 +0,0 @@ -From db728c2f7fff23446feeeaf3b3f16189a18a8f1e Mon Sep 17 00:00:00 2001 -From: Julian Bouzas -Date: Fri, 14 Jan 2022 14:34:38 -0500 -Subject: [PATCH] core: add API to check if running in a virtual machine - ---- - lib/wp/core.c | 26 ++++++++++++++++++++++++++ - lib/wp/core.h | 5 +++++ - modules/module-lua-scripting/api.c | 9 +++++++++ - 3 files changed, 40 insertions(+) - -diff --git a/lib/wp/core.c b/lib/wp/core.c -index 23f6f35f..3713135c 100644 ---- a/lib/wp/core.c -+++ b/lib/wp/core.c -@@ -15,6 +15,7 @@ - #include - - #include -+#include - #include - - /* -@@ -986,6 +987,31 @@ wp_core_get_registry (WpCore * self) - return &self->registry; - } - -+/*! -+ * \brief Checks whether core is a guest running in a virtual machine or not. -+ * -+ * \ingroup wpcore -+ * \param self the core -+ * \returns: TRUE if core is a guest, FALSE otherwise -+ */ -+gboolean -+wp_core_is_guest (WpCore * self) -+{ -+ const struct spa_support *support; -+ uint32_t n_support; -+ struct spa_cpu *cpu; -+ -+ g_return_val_if_fail (WP_IS_CORE (self), FALSE); -+ g_return_val_if_fail (self->pw_context, FALSE); -+ -+ support = pw_context_get_support (self->pw_context, &n_support); -+ cpu = spa_support_find (support, n_support, SPA_TYPE_INTERFACE_CPU); -+ if (!cpu) -+ return FALSE; -+ -+ return spa_cpu_get_vm_type (cpu) != SPA_CPU_VM_NONE; -+} -+ - WpCore * - wp_registry_get_core (WpRegistry * self) - { -diff --git a/lib/wp/core.h b/lib/wp/core.h -index 07a6125b..8efb922d 100644 ---- a/lib/wp/core.h -+++ b/lib/wp/core.h -@@ -115,6 +115,11 @@ WP_API - gboolean wp_core_sync_finish (WpCore * self, GAsyncResult * res, - GError ** error); - -+/* Misc */ -+ -+WP_API -+gboolean wp_core_is_guest (WpCore * self); -+ - /* Object Manager */ - - WP_API -diff --git a/modules/module-lua-scripting/api.c b/modules/module-lua-scripting/api.c -index 876b4f6f..27033027 100644 ---- a/modules/module-lua-scripting/api.c -+++ b/modules/module-lua-scripting/api.c -@@ -228,6 +228,14 @@ core_require_api (lua_State *L) - return wp_require_api_transition_new_from_lua (L, core); - } - -+static int -+core_is_guest (lua_State *L) -+{ -+ WpCore * core = get_wp_core (L); -+ lua_pushboolean (L, wp_core_is_guest (core)); -+ return 1; -+} -+ - static const luaL_Reg core_funcs[] = { - { "get_info", core_get_info }, - { "idle_add", core_idle_add }, -@@ -235,6 +243,7 @@ static const luaL_Reg core_funcs[] = { - { "sync", core_sync }, - { "quit", core_quit }, - { "require_api", core_require_api }, -+ { "is_guest", core_is_guest }, - { NULL, NULL } - }; - --- -GitLab - diff --git a/0001-reversed-default-nodes-check-if-default-node-has-available-ro.patch b/0001-reversed-default-nodes-check-if-default-node-has-available-ro.patch new file mode 100644 index 0000000..9271693 --- /dev/null +++ b/0001-reversed-default-nodes-check-if-default-node-has-available-ro.patch @@ -0,0 +1,108 @@ +--- b/modules/module-default-nodes.c ++++ a/modules/module-default-nodes.c +@@ -8,7 +8,6 @@ + + #include + #include +-#include + #include + + #define COMPILING_MODULE_DEFAULT_NODES 1 +@@ -98,87 +97,6 @@ + } + } + +-static gboolean +-node_has_available_routes (WpDefaultNodes * self, WpNode *node) +-{ +- const gchar *dev_id_str = wp_pipewire_object_get_property ( +- WP_PIPEWIRE_OBJECT (node), PW_KEY_DEVICE_ID); +- const gchar *cpd_str = wp_pipewire_object_get_property ( +- WP_PIPEWIRE_OBJECT (node), "card.profile.device"); +- gint dev_id = dev_id_str ? atoi (dev_id_str) : -1; +- gint cpd = cpd_str ? atoi (cpd_str) : -1; +- g_autoptr (WpDevice) device = NULL; +- +- if (dev_id == -1 || cpd == -1) +- return TRUE; +- +- /* Get the device */ +- device = wp_object_manager_lookup (self->rescan_om, WP_TYPE_DEVICE, +- WP_CONSTRAINT_TYPE_G_PROPERTY, "bound-id", "=i", dev_id, NULL); +- if (!device) +- return TRUE; +- +- /* Check if the current device route supports the node card device profile */ +- { +- g_autoptr (WpIterator) routes = NULL; +- g_auto (GValue) val = G_VALUE_INIT; +- routes = wp_pipewire_object_enum_params_sync (WP_PIPEWIRE_OBJECT (device), +- "Route", NULL); +- for (; wp_iterator_next (routes, &val); g_value_unset (&val)) { +- WpSpaPod *route = g_value_get_boxed (&val); +- gint route_device = -1; +- guint32 route_avail = SPA_PARAM_AVAILABILITY_unknown; +- +- if (!wp_spa_pod_get_object (route, NULL, +- "device", "i", &route_device, +- "available", "?I", &route_avail, +- NULL)) +- continue; +- +- if (route_device != cpd) +- continue; +- +- if (route_avail == SPA_PARAM_AVAILABILITY_no) +- return FALSE; +- +- return TRUE; +- } +- } +- +- /* Check if available routes support the node card device profile */ +- { +- g_autoptr (WpIterator) routes = NULL; +- g_auto (GValue) val = G_VALUE_INIT; +- routes = wp_pipewire_object_enum_params_sync (WP_PIPEWIRE_OBJECT (device), +- "EnumRoute", NULL); +- for (; wp_iterator_next (routes, &val); g_value_unset (&val)) { +- WpSpaPod *route = g_value_get_boxed (&val); +- guint32 route_avail = SPA_PARAM_AVAILABILITY_unknown; +- g_autoptr (WpSpaPod) route_devices = NULL; +- +- if (!wp_spa_pod_get_object (route, NULL, +- "available", "?I", &route_avail, +- "devices", "?P", &route_devices, +- NULL)) +- continue; +- +- { +- g_autoptr (WpIterator) it = wp_spa_pod_new_iterator (route_devices); +- g_auto (GValue) v = G_VALUE_INIT; +- for (; wp_iterator_next (it, &v); g_value_unset (&v)) { +- gint32 *d = (gint32 *)g_value_get_pointer (&v); +- if (d && *d == cpd) { +- if (route_avail != SPA_PARAM_AVAILABILITY_no) +- return TRUE; +- } +- } +- } +- } +- } +- +- return FALSE; +-} +- + static WpNode * + find_best_media_class_node (WpDefaultNodes * self, const gchar *media_class, + const gchar *node_name, WpDirection direction, gint *priority) +@@ -206,9 +124,6 @@ + WP_PIPEWIRE_OBJECT (node), PW_KEY_PRIORITY_SESSION); + gint prio = prio_str ? atoi (prio_str) : -1; + +- if (!node_has_available_routes (self, node)) +- continue; +- + if (name && node_name && g_strcmp0 (name, node_name) == 0) + prio += 10000; + diff --git a/0002-alsa-monitor-set-period-size-and-headroom-props-if-running-in-virtual-machine.patch b/0002-alsa-monitor-set-period-size-and-headroom-props-if-running-in-virtual-machine.patch deleted file mode 100644 index 721c398..0000000 --- a/0002-alsa-monitor-set-period-size-and-headroom-props-if-running-in-virtual-machine.patch +++ /dev/null @@ -1,31 +0,0 @@ -From ba2cd1cfd74de346ccc88028b6e1d6e95f055ba1 Mon Sep 17 00:00:00 2001 -From: Julian Bouzas -Date: Fri, 14 Jan 2022 14:35:58 -0500 -Subject: [PATCH] alsa-monitor: set period-size and headroom props if running - in virtual machine - -Fixes #162 ---- - src/scripts/monitors/alsa.lua | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/src/scripts/monitors/alsa.lua b/src/scripts/monitors/alsa.lua -index 3e8eda83..592a250d 100644 ---- a/src/scripts/monitors/alsa.lua -+++ b/src/scripts/monitors/alsa.lua -@@ -166,6 +166,12 @@ function createNode(parent, id, type, factory, properties) - end - end - -+ -- apply virtual machine properties -+ if Core.is_guest() then -+ properties["api.alsa.period-size"] = 256 -+ properties["api.alsa.headroom"] = 8192 -+ end -+ - -- apply properties from config.rules - rulesApplyProperties(properties) - if properties["node.disabled"] then --- -GitLab - diff --git a/0002-default-nodes-handle-nodes-without-Routes.patch b/0002-default-nodes-handle-nodes-without-Routes.patch deleted file mode 100644 index 457c6e1..0000000 --- a/0002-default-nodes-handle-nodes-without-Routes.patch +++ /dev/null @@ -1,47 +0,0 @@ -From 211f1e6b6cd4898121e4c2b821fae4dea6cc3317 Mon Sep 17 00:00:00 2001 -From: Wim Taymans -Date: Fri, 14 Jan 2022 16:28:48 +0100 -Subject: [PATCH] default-nodes: handle nodes without Routes - -When a node has not part of any EnumRoute, we must assume it is -available. - -Fixes selection of Pro Audio nodes as default nodes. ---- - modules/module-default-nodes.c | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/modules/module-default-nodes.c b/modules/module-default-nodes.c -index 32b2725b..15aadeaa 100644 ---- a/modules/module-default-nodes.c -+++ b/modules/module-default-nodes.c -@@ -108,6 +108,7 @@ node_has_available_routes (WpDefaultNodes * self, WpNode *node) - gint dev_id = dev_id_str ? atoi (dev_id_str) : -1; - gint cpd = cpd_str ? atoi (cpd_str) : -1; - g_autoptr (WpDevice) device = NULL; -+ gint found = 0; - - if (dev_id == -1 || cpd == -1) - return TRUE; -@@ -168,6 +169,7 @@ node_has_available_routes (WpDefaultNodes * self, WpNode *node) - for (; wp_iterator_next (it, &v); g_value_unset (&v)) { - gint32 *d = (gint32 *)g_value_get_pointer (&v); - if (d && *d == cpd) { -+ found++; - if (route_avail != SPA_PARAM_AVAILABILITY_no) - return TRUE; - } -@@ -175,6 +177,10 @@ node_has_available_routes (WpDefaultNodes * self, WpNode *node) - } - } - } -+ /* The node is part of a profile without routes so we assume it -+ * is available. This can happen for Pro Audio profiles */ -+ if (found == 0) -+ return TRUE; - - return FALSE; - } --- -GitLab - diff --git a/wireplumber.changes b/wireplumber.changes index c7716ef..56127ed 100644 --- a/wireplumber.changes +++ b/wireplumber.changes @@ -1,3 +1,14 @@ +------------------------------------------------------------------- +Mon Jan 24 11:08:04 UTC 2022 - Antonio Larrosa + +- Since wireplumber keeps failing to run in openQA since 0.4.7, + let's drop all patches added since then: + * 0001-core-add-API-to-check-if-running-in-a-virtual-machine.patch + * 0002-alsa-monitor-set-period-size-and-headroom-props-if-running-in-virtual-machine.patch + * 0002-default-nodes-handle-nodes-without-Routes.patch +- And revert one of the commits introduced in 0.4.7: + * 0001-reversed-default-nodes-check-if-default-node-has-available-ro.patch + ------------------------------------------------------------------- Fri Jan 21 11:41:03 UTC 2022 - Antonio Larrosa diff --git a/wireplumber.spec b/wireplumber.spec index 7f2bf74..2906d18 100644 --- a/wireplumber.spec +++ b/wireplumber.spec @@ -30,9 +30,7 @@ Group: Development/Libraries/C and C++ URL: https://gitlab.freedesktop.org/pipewire/wireplumber Source0: wireplumber-%{version}.tar.xz Source1: split-config-file.py -Patch1: 0002-default-nodes-handle-nodes-without-Routes.patch -Patch2: 0001-core-add-API-to-check-if-running-in-a-virtual-machine.patch -Patch3: 0002-alsa-monitor-set-period-size-and-headroom-props-if-running-in-virtual-machine.patch +Patch0: 0001-reversed-default-nodes-check-if-default-node-has-available-ro.patch Patch100: reduce-meson-required-version.patch # docs BuildRequires: doxygen