mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-11 13:30:07 -05:00
core: improve alignment
Use the CPU alignment to align memory of allocated buffers. This makes it more likely that all CPU optimizations can be done.
This commit is contained in:
parent
c8ffcaaefe
commit
7798cf7364
6 changed files with 53 additions and 13 deletions
|
|
@ -37,7 +37,8 @@
|
|||
|
||||
#define NAME "buffers"
|
||||
|
||||
#define MAX_BUFFERS 64
|
||||
#define MAX_ALIGN 32
|
||||
#define MAX_BUFFERS 64
|
||||
|
||||
struct port {
|
||||
struct spa_node *node;
|
||||
|
|
@ -246,8 +247,12 @@ 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)
|
||||
align = pw_properties_parse_int(str);
|
||||
else
|
||||
align = MAX_ALIGN;
|
||||
|
||||
minsize = stride = 0;
|
||||
align = 8;
|
||||
param = find_param(params, n_params, SPA_TYPE_OBJECT_ParamBuffers);
|
||||
if (param) {
|
||||
uint32_t qmax_buffers = max_buffers,
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@
|
|||
|
||||
#include <pipewire/log.h>
|
||||
|
||||
#include <spa/support/cpu.h>
|
||||
#include <spa/support/dbus.h>
|
||||
#include <spa/node/utils.h>
|
||||
#include <spa/utils/names.h>
|
||||
|
|
@ -479,6 +480,7 @@ struct pw_core *pw_core_new(struct pw_loop *main_loop,
|
|||
void *dbus_iface = NULL;
|
||||
uint32_t n_support;
|
||||
struct pw_properties *pr;
|
||||
struct spa_cpu *cpu;
|
||||
int res = 0;
|
||||
|
||||
impl = calloc(1, sizeof(struct impl) + user_data_size);
|
||||
|
|
@ -526,6 +528,9 @@ struct pw_core *pw_core_new(struct pw_loop *main_loop,
|
|||
this->support[n_support++] = SPA_SUPPORT_INIT(SPA_TYPE_INTERFACE_DataSystem, this->data_system);
|
||||
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));
|
||||
|
||||
lib = pw_properties_get(properties, PW_KEY_LIBRARY_NAME_DBUS);
|
||||
if (lib == NULL)
|
||||
lib = "support/libspa-dbus";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue