diff options
author | Ahmed S. Darwish <darwish.07@gmail.com> | 2016-04-15 23:07:36 +0200 |
---|---|---|
committer | Arun Raghavan <git@arunraghavan.net> | 2016-04-27 18:37:08 +0530 |
commit | d2a6afcab31f9f8122200ce383fdd5479ca0ebd1 (patch) | |
tree | 0d99cc24fe698380b388204e5bd740e7ef2662da /src/daemon | |
parent | b1d47d60fc3f5dcc098f0ccc52a0f29dca8ce29e (diff) | |
download | pulseaudio-d2a6afcab31f9f8122200ce383fdd5479ca0ebd1.tar.gz |
core: Support memfd transport; bump protocol version
Now that all layers in the stack support memfd blocks, add memfd
support for the daemon's global core mempool. Also introduce
"enable-memfd=" daemon argument and configuration option.
For now, memfd support is an opt-in feature to be activated only
when daemon's enable-memfd= is set to yes.
Signed-off-by: Ahmed S. Darwish <darwish.07@gmail.com>
Diffstat (limited to 'src/daemon')
-rw-r--r-- | src/daemon/cmdline.c | 13 | ||||
-rw-r--r-- | src/daemon/daemon-conf.c | 2 | ||||
-rw-r--r-- | src/daemon/daemon-conf.h | 1 | ||||
-rw-r--r-- | src/daemon/main.c | 4 |
4 files changed, 18 insertions, 2 deletions
diff --git a/src/daemon/cmdline.c b/src/daemon/cmdline.c index 117147dd8..0454b6d84 100644 --- a/src/daemon/cmdline.c +++ b/src/daemon/cmdline.c @@ -63,6 +63,7 @@ enum { ARG_CHECK, ARG_NO_CPU_LIMIT, ARG_DISABLE_SHM, + ARG_ENABLE_MEMFD, ARG_DUMP_RESAMPLE_METHODS, ARG_SYSTEM, ARG_CLEANUP_SHM, @@ -100,6 +101,7 @@ static const struct option long_options[] = { {"system", 2, 0, ARG_SYSTEM}, {"no-cpu-limit", 2, 0, ARG_NO_CPU_LIMIT}, {"disable-shm", 2, 0, ARG_DISABLE_SHM}, + {"enable-memfd", 2, 0, ARG_ENABLE_MEMFD}, {"dump-resample-methods", 2, 0, ARG_DUMP_RESAMPLE_METHODS}, {"cleanup-shm", 2, 0, ARG_CLEANUP_SHM}, {NULL, 0, 0, 0} @@ -152,7 +154,8 @@ void pa_cmdline_help(const char *argv0) { " --use-pid-file[=BOOL] Create a PID file\n" " --no-cpu-limit[=BOOL] Do not install CPU load limiter on\n" " platforms that support it.\n" - " --disable-shm[=BOOL] Disable shared memory support.\n\n" + " --disable-shm[=BOOL] Disable shared memory support.\n" + " --enable-memfd[=BOOL] Enable memfd shared memory support.\n\n" "STARTUP SCRIPT:\n" " -L, --load=\"MODULE ARGUMENTS\" Load the specified plugin module with\n" @@ -389,6 +392,14 @@ int pa_cmdline_parse(pa_daemon_conf *conf, int argc, char *const argv [], int *d conf->disable_shm = !!b; break; + case ARG_ENABLE_MEMFD: + if ((b = optarg ? pa_parse_boolean(optarg) : 1) < 0) { + pa_log(_("--enable-memfd expects boolean argument")); + goto fail; + } + conf->disable_memfd = !b; + break; + default: goto fail; } diff --git a/src/daemon/daemon-conf.c b/src/daemon/daemon-conf.c index 288aed2b2..965a5c802 100644 --- a/src/daemon/daemon-conf.c +++ b/src/daemon/daemon-conf.c @@ -92,6 +92,7 @@ static const pa_daemon_conf default_conf = { #endif .no_cpu_limit = true, .disable_shm = false, + .disable_memfd = true, .lock_memory = false, .deferred_volume = true, .default_n_fragments = 4, @@ -526,6 +527,7 @@ int pa_daemon_conf_load(pa_daemon_conf *c, const char *filename) { { "cpu-limit", pa_config_parse_not_bool, &c->no_cpu_limit, NULL }, { "disable-shm", pa_config_parse_bool, &c->disable_shm, NULL }, { "enable-shm", pa_config_parse_not_bool, &c->disable_shm, NULL }, + { "enable-memfd", pa_config_parse_not_bool, &c->disable_memfd, NULL }, { "flat-volumes", pa_config_parse_bool, &c->flat_volumes, NULL }, { "lock-memory", pa_config_parse_bool, &c->lock_memory, NULL }, { "enable-deferred-volume", pa_config_parse_bool, &c->deferred_volume, NULL }, diff --git a/src/daemon/daemon-conf.h b/src/daemon/daemon-conf.h index 458784c98..82b619fa6 100644 --- a/src/daemon/daemon-conf.h +++ b/src/daemon/daemon-conf.h @@ -66,6 +66,7 @@ typedef struct pa_daemon_conf { system_instance, no_cpu_limit, disable_shm, + disable_memfd, disable_remixing, disable_lfe_remixing, load_default_script_file, diff --git a/src/daemon/main.c b/src/daemon/main.c index c2f47b69a..ae1185d31 100644 --- a/src/daemon/main.c +++ b/src/daemon/main.c @@ -1017,7 +1017,9 @@ int main(int argc, char *argv[]) { pa_assert_se(mainloop = pa_mainloop_new()); - if (!(c = pa_core_new(pa_mainloop_get_api(mainloop), !conf->disable_shm, conf->shm_size))) { + if (!(c = pa_core_new(pa_mainloop_get_api(mainloop), !conf->disable_shm, + !conf->disable_shm && !conf->disable_memfd && pa_memfd_is_locally_supported(), + conf->shm_size))) { pa_log(_("pa_core_new() failed.")); goto finish; } |