From 140203d5a3c38dd39eda235e274bc208aa0c6fc3 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 29 Oct 2019 12:48:07 +0100 Subject: [PATCH] core: add and use some keys for cpu settings --- src/pipewire/buffers.c | 5 +++-- src/pipewire/core.c | 2 +- src/pipewire/keys.h | 5 +++++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/pipewire/buffers.c b/src/pipewire/buffers.c index 79a4c5b33..97f0be858 100644 --- a/src/pipewire/buffers.c +++ b/src/pipewire/buffers.c @@ -31,6 +31,7 @@ #include #include +#include "pipewire/keys.h" #include "pipewire/private.h" #include "buffers.h" @@ -218,7 +219,7 @@ int pw_buffers_negotiate(struct pw_core *core, uint32_t flags, struct spa_pod_builder b = SPA_POD_BUILDER_INIT(buffer, sizeof(buffer)); uint32_t i, offset, n_params; uint32_t max_buffers; - size_t minsize = 8192, stride = 0, align; + size_t minsize, stride, align; uint32_t data_sizes[1]; int32_t data_strides[1]; uint32_t data_aligns[1]; @@ -245,7 +246,7 @@ int pw_buffers_negotiate(struct pw_core *core, uint32_t flags, else max_buffers = MAX_BUFFERS; - if ((str = pw_properties_get(core->properties, "cpu.max-align")) != NULL) + if ((str = pw_properties_get(core->properties, PW_KEY_CPU_MAX_ALIGN)) != NULL) align = pw_properties_parse_int(str); else align = MAX_ALIGN; diff --git a/src/pipewire/core.c b/src/pipewire/core.c index 2e2dcfbca..20b05706a 100644 --- a/src/pipewire/core.c +++ b/src/pipewire/core.c @@ -529,7 +529,7 @@ struct pw_core *pw_core_new(struct pw_loop *main_loop, this->support[n_support++] = SPA_SUPPORT_INIT(SPA_TYPE_INTERFACE_DataLoop, this->data_loop->loop); if ((cpu = spa_support_find(this->support, n_support, SPA_TYPE_INTERFACE_CPU)) != NULL) - pw_properties_setf(properties, "cpu.max-align", "%u", spa_cpu_get_max_align(cpu)); + pw_properties_setf(properties, PW_KEY_CPU_MAX_ALIGN, "%u", spa_cpu_get_max_align(cpu)); lib = pw_properties_get(properties, PW_KEY_LIBRARY_NAME_DBUS); if (lib == NULL) diff --git a/src/pipewire/keys.h b/src/pipewire/keys.h index 41631c7a7..f6fd921ac 100644 --- a/src/pipewire/keys.h +++ b/src/pipewire/keys.h @@ -72,6 +72,11 @@ extern "C" { #define PW_KEY_CORE_ID "core.id" /**< the core id */ #define PW_KEY_CORE_MONITORS "core.monitors" /**< the apis monitored by core. */ +/* cpu */ +#define PW_KEY_CPU_MAX_ALIGN "cpu.max-align" /**< maximum alignment needed to support + * all CPU optimizations */ +#define PW_KEY_CPU_CORES "cpu.cores" /**< number of cores */ + /* priorities */ #define PW_KEY_PRIORITY_SESSION "priority.session" /**< priority in session manager */ #define PW_KEY_PRIORITY_MASTER "priority.master" /**< priority to be a master */