From f27ad659f83d1d13493473e847840345a4abe5df Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Fri, 16 Apr 2021 16:41:20 +0200 Subject: [PATCH] spa: add property to force VM Also add PIPEWIRE_VM to force a VM type. --- spa/include/spa/support/cpu.h | 1 + spa/plugins/support/cpu.c | 2 ++ src/pipewire/pipewire.c | 2 ++ 3 files changed, 5 insertions(+) diff --git a/spa/include/spa/support/cpu.h b/spa/include/spa/support/cpu.h index 455e1a2fa..af3d0223d 100644 --- a/spa/include/spa/support/cpu.h +++ b/spa/include/spa/support/cpu.h @@ -140,6 +140,7 @@ struct spa_cpu_methods { /** keys can be given when initializing the cpu handle */ #define SPA_KEY_CPU_FORCE "cpu.force" /**< force cpu flags */ +#define SPA_KEY_CPU_VM_TYPE "cpu.vm.type" /**< force a VM type */ #ifdef __cplusplus } /* extern "C" */ diff --git a/spa/plugins/support/cpu.c b/spa/plugins/support/cpu.c index 032b6669a..11b16e8f1 100644 --- a/spa/plugins/support/cpu.c +++ b/spa/plugins/support/cpu.c @@ -259,6 +259,8 @@ impl_init(const struct spa_handle_factory *factory, if (info) { if ((str = spa_dict_lookup(info, SPA_KEY_CPU_FORCE)) != NULL) this->flags = atoi(str); + if ((str = spa_dict_lookup(info, SPA_KEY_CPU_VM_TYPE)) != NULL) + this->vm_type = atoi(str); } spa_log_debug(this->log, NAME " %p: count:%d align:%d flags:%08x", diff --git a/src/pipewire/pipewire.c b/src/pipewire/pipewire.c index 1b2a8f8ea..76f7e0c33 100644 --- a/src/pipewire/pipewire.c +++ b/src/pipewire/pipewire.c @@ -538,6 +538,8 @@ void pw_init(int *argc, char **argv[]) n_items = 0; if ((str = getenv("PIPEWIRE_CPU"))) items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_CPU_FORCE, str); + if ((str = getenv("PIPEWIRE_VM"))) + items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_CPU_VM_TYPE, str); info = SPA_DICT_INIT(items, n_items); add_interface(support, SPA_NAME_SUPPORT_CPU, SPA_TYPE_INTERFACE_CPU, &info);