core: add and use some keys for cpu settings

This commit is contained in:
Wim Taymans 2019-10-29 12:48:07 +01:00
parent b179b11e66
commit 140203d5a3
3 changed files with 9 additions and 3 deletions

View file

@ -31,6 +31,7 @@
#include <spa/debug/pod.h> #include <spa/debug/pod.h>
#include <spa/debug/format.h> #include <spa/debug/format.h>
#include "pipewire/keys.h"
#include "pipewire/private.h" #include "pipewire/private.h"
#include "buffers.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)); struct spa_pod_builder b = SPA_POD_BUILDER_INIT(buffer, sizeof(buffer));
uint32_t i, offset, n_params; uint32_t i, offset, n_params;
uint32_t max_buffers; uint32_t max_buffers;
size_t minsize = 8192, stride = 0, align; size_t minsize, stride, align;
uint32_t data_sizes[1]; uint32_t data_sizes[1];
int32_t data_strides[1]; int32_t data_strides[1];
uint32_t data_aligns[1]; uint32_t data_aligns[1];
@ -245,7 +246,7 @@ int pw_buffers_negotiate(struct pw_core *core, uint32_t flags,
else else
max_buffers = MAX_BUFFERS; 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); align = pw_properties_parse_int(str);
else else
align = MAX_ALIGN; align = MAX_ALIGN;

View file

@ -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); 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) 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); lib = pw_properties_get(properties, PW_KEY_LIBRARY_NAME_DBUS);
if (lib == NULL) if (lib == NULL)

View file

@ -72,6 +72,11 @@ extern "C" {
#define PW_KEY_CORE_ID "core.id" /**< the core id */ #define PW_KEY_CORE_ID "core.id" /**< the core id */
#define PW_KEY_CORE_MONITORS "core.monitors" /**< the apis monitored by core. */ #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 */ /* priorities */
#define PW_KEY_PRIORITY_SESSION "priority.session" /**< priority in session manager */ #define PW_KEY_PRIORITY_SESSION "priority.session" /**< priority in session manager */
#define PW_KEY_PRIORITY_MASTER "priority.master" /**< priority to be a master */ #define PW_KEY_PRIORITY_MASTER "priority.master" /**< priority to be a master */