meson: add options to set server and client RT priority

Make a rtprio-server and rtprio-client option. Leave the server
priority by default to 88 but lower client priority to 83. JACK
does something similar by setting clients to rtprio-server - 5.

Make module-rt use the client priority by default and bump the server
priority explicitly in the config file.

Leave the pulse-server to the default rtprio-client, there is no reason
to lower this any further because it is really just a regular client.

Bump the ffado packetizer thread to rtprio-server + 5 because that is
also what JACK does.

88 is still much higher than the value of 60 that JACK uses in
Fedora but now this is at least configurable.
This commit is contained in:
Wim Taymans 2024-02-15 11:53:32 +01:00
parent 2833ff1272
commit f1a6fabb6c
15 changed files with 30 additions and 13 deletions

View file

@ -220,6 +220,8 @@ cdata.set_quoted('PIPEWIRE_CONFIG_DIR', pipewire_configdir)
cdata.set_quoted('PLUGINDIR', spa_plugindir)
cdata.set_quoted('SPADATADIR', spa_datadir)
cdata.set_quoted('PA_ALSA_DATA_DIR', alsadatadir)
cdata.set('RTPRIO_SERVER', get_option('rtprio-server'))
cdata.set('RTPRIO_CLIENT', get_option('rtprio-client'))
if host_machine.endian() == 'big'
cdata.set('WORDS_BIGENDIAN', 1)

View file

@ -306,6 +306,18 @@ option('rlimits-match',
description : 'PAM match rule for the generated limits.d file. @<name> denotes matching a group.',
type : 'string',
value: '@pipewire')
option('rtprio-server',
description : 'PipeWire server realtime priority',
type : 'integer',
min: 11,
max: 99,
value: 88)
option('rtprio-client',
description : 'PipeWire clients realtime priority',
type : 'integer',
min: 11,
max: 99,
value: 83)
option('rlimits-rtprio',
description : 'RR and FIFO scheduler priority permitted for realtime threads of the matching user(s)',
type : 'integer',

View file

@ -45,7 +45,7 @@
* with mlockall() on many systems */
#define THREAD_STACK 524288
#define DEFAULT_RT_MAX 88
#define DEFAULT_RT_MAX RTPRIO_CLIENT
#define JACK_CLIENT_NAME_SIZE 256
#define JACK_PORT_NAME_SIZE 256

View file

@ -43,7 +43,7 @@ context.modules = [
# Uses realtime scheduling to boost the audio thread priorities
{ name = libpipewire-module-rt
args = {
#rt.prio = 88
#rt.prio = @rtprio_client@
#rt.time.soft = -1
#rt.time.hard = -1
}

View file

@ -42,7 +42,7 @@ context.modules = [
# Uses realtime scheduling to boost the audio thread priorities
{ name = libpipewire-module-rt
args = {
#rt.prio = 88
#rt.prio = @rtprio_client@
#rt.time.soft = -1
#rt.time.hard = -1
}

View file

@ -43,7 +43,7 @@ context.modules = [
# Boost the data thread priority.
{ name = libpipewire-module-rt
args = {
#rt.prio = 88
#rt.prio = @rtprio_client@
#rt.time.soft = -1
#rt.time.hard = -1
}

View file

@ -11,6 +11,8 @@ conf_config.set('pipewire_path', pipewire_bindir / 'pipewire')
conf_config.set('pipewire_pulse_path', pipewire_bindir / 'pipewire-pulse')
conf_config.set('sm_comment', '#')
conf_config.set('pulse_comment', '#')
conf_config.set('rtprio_server', get_option('rtprio-server'))
conf_config.set('rtprio_client', get_option('rtprio-client'))
conf_config_uninstalled = conf_config
conf_config_uninstalled.set('pipewire_path',

View file

@ -81,7 +81,7 @@ context.modules = [
{ name = libpipewire-module-rt
args = {
nice.level = -11
#rt.prio = 88
rt.prio = @rtprio_server@
#rt.time.soft = -1
#rt.time.hard = -1
}

View file

@ -52,7 +52,7 @@ context.modules = [
{ name = libpipewire-module-rt
args = {
nice.level = -11
#rt.prio = 88
#rt.prio = @rtprio_client@
#rt.time.soft = -1
#rt.time.hard = -1
}

View file

@ -27,7 +27,7 @@ context.modules = [
{ name = libpipewire-module-rt
args = {
nice.level = -11
#rt.prio = 88
#rt.prio = @rtprio_client@
#rt.time.soft = -1
#rt.time.hard = -1
}

View file

@ -27,8 +27,7 @@ context.modules = [
{ name = libpipewire-module-rt
args = {
nice.level = -11
#rt.prio = 88
rt.prio = 65
#rt.prio = @rtprio_client@
#rt.time.soft = -1
#rt.time.hard = -1
#uclamp.min = 0

View file

@ -53,7 +53,7 @@ context.modules = [
{ name = libpipewire-module-rt
args = {
nice.level = -11
#rt.prio = 88
#rt.prio = @rtprio_client@
#rt.time.soft = -1
#rt.time.hard = -1
}

View file

@ -96,7 +96,7 @@ context.modules = [
{ name = libpipewire-module-rt
args = {
nice.level = -11
#rt.prio = 88
rt.prio = @rtprio_server@
#rt.time.soft = -1
#rt.time.hard = -1
#uclamp.min = 0

View file

@ -115,6 +115,8 @@ PW_LOG_TOPIC_STATIC(mod_topic, "mod." NAME);
#define DEFAULT_POSITION "[ FL FR ]"
#define DEFAULT_MIDI_PORTS 1
#define FFADO_RT_PRIORITY_PACKETIZER_RELATIVE 5
#define MODULE_USAGE "( remote.name=<remote> ) " \
"( driver.mode=<sink|source|duplex> ) " \
"( ffado.devices=<devices array size, default \"hw:0\"> ) " \
@ -762,7 +764,7 @@ static int open_ffado_device(struct impl *impl)
impl->device_options.period_size = impl->period_size;
impl->device_options.nb_buffers = impl->n_periods;
impl->device_options.realtime = 1;
impl->device_options.packetizer_priority = 88;
impl->device_options.packetizer_priority = RTPRIO_SERVER + FFADO_RT_PRIORITY_PACKETIZER_RELATIVE;
impl->device_options.verbose = impl->verbose;
impl->device_options.slave_mode = impl->slave_mode;
impl->device_options.snoop_mode = impl->snoop_mode;

View file

@ -136,7 +136,7 @@ PW_LOG_TOPIC_STATIC(mod_topic, "mod." NAME);
#define DEFAULT_NICE_LEVEL 20 /* invalid value by default, see above */
#define DEFAULT_RT_PRIO_MIN 11
#define DEFAULT_RT_PRIO 88
#define DEFAULT_RT_PRIO RTPRIO_CLIENT
#define DEFAULT_RT_TIME_SOFT -1
#define DEFAULT_RT_TIME_HARD -1