From 33f98489d62100dd024306bd16bcf90c79a82538 Mon Sep 17 00:00:00 2001 From: columbarius Date: Thu, 17 Aug 2023 01:02:16 +0200 Subject: [PATCH] pipewire-vulkan: Start vulkan nodes via pipewire proxy server --- src/daemon/meson.build | 18 +++++- src/daemon/pipewire-vulkan.conf.in | 98 ++++++++++++++++++++++++++++++ 2 files changed, 115 insertions(+), 1 deletion(-) create mode 100644 src/daemon/pipewire-vulkan.conf.in diff --git a/src/daemon/meson.build b/src/daemon/meson.build index 0610d7323..8629a99ff 100644 --- a/src/daemon/meson.build +++ b/src/daemon/meson.build @@ -27,6 +27,8 @@ build_ms = 'media-session' in get_option('session-managers') build_wp = 'wireplumber' in get_option('session-managers') default_sm = get_option('session-managers').get(0, '') +build_vk = get_option('vulkan').enabled() + summary({'Build media-session': build_ms, 'Build wireplumber': build_wp, 'Default session-manager': default_sm}, @@ -75,6 +77,10 @@ conf_files = [ 'pipewire-aes67.conf', ] +if build_vk + conf_files += 'pipewire-vulkan.conf' +endif + foreach c : conf_files configure_file(input : '@0@.in'.format(c), output : c, @@ -107,7 +113,17 @@ pipewire_exec = executable('pipewire', ln = find_program('ln') -foreach alias : ['pipewire-pulse', 'pipewire-avb', 'pipewire-aes67'] +pipewire_aliases = [ + 'pipewire-pulse', + 'pipewire-avb', + 'pipewire-aes67', +] + +if build_vk + pipewire_aliases += 'pipewire-vulkan' +endif + +foreach alias : pipewire_aliases custom_target( alias, build_by_default: true, diff --git a/src/daemon/pipewire-vulkan.conf.in b/src/daemon/pipewire-vulkan.conf.in new file mode 100644 index 000000000..37f13d8bf --- /dev/null +++ b/src/daemon/pipewire-vulkan.conf.in @@ -0,0 +1,98 @@ +# Config file for PipeWire version "0.3.77" # +# +# This config file should start the vulkan-compute-source/filter as proxied +# clients +# + +context.properties = { + ## Configure properties in the system. + #library.name.system = support/libspa-support + #context.data-loop.library.name.system = support/libspa-support + #support.dbus = true + #link.max-buffers = 64 + #link.max-buffers = 16 # version < 3 clients can't handle more + #mem.warn-mlock = false + #mem.allow-mlock = true + #mem.mlock-all = false + #clock.power-of-two-quantum = true + #log.level = 4 + #cpu.zero.denormals = false + + #default.clock.quantum-limit = 8192 +} + +context.spa-libs = { + # = + # + # Used to find spa factory names. It maps an spa factory name + # regular expression to a library name that should contain + # that factory. + # + api.vulkan.* = vulkan/libspa-vulkan + support.* = support/libspa-support +} + +context.modules = [ + #{ name = + # ( args = { = ... } ) + # ( flags = [ ( ifexists ) ( nofail ) ] ) + # ( condition = [ { = ... } ... ] ) + #} + # + # Loads a module with the given parameters. + # If ifexists is given, the module is ignored when it is not found. + # If nofail is given, module initialization failures are ignored. + # If condition is given, the module is loaded only when the context + # properties all match the match rules. + # + + # Uses realtime scheduling to boost the audio thread priorities. This uses + # RTKit if the user doesn't have permission to use regular realtime + # scheduling. + { name = libpipewire-module-rt + args = { + nice.level = -11 + #rt.prio = 88 + #rt.time.soft = -1 + #rt.time.hard = -1 + } + flags = [ ifexists nofail ] + } + + # The native communication protocol. + { name = libpipewire-module-protocol-native } + + # Creates a factory for making nodes that run in the + # context of the PipeWire server. + { name = libpipewire-module-spa-node-factory } + + # Allows creating nodes that run in the context of the + # client. Is used by all clients that want to provide + # data to PipeWire. + { name = libpipewire-module-client-node } + + # Makes a factory for wrapping nodes in an adapter with a + # converter and resampler. + { name = libpipewire-module-adapter } +] + +context.objects = [ + #{ factory = + # ( args = { = ... } ) + # ( flags = [ ( nofail ) ] ) + # ( condition = [ { = ... } ... ] ) + #} + # + # Creates an object from a PipeWire factory with the given parameters. + # If nofail is given, errors are ignored (and no object is created). + # If condition is given, the object is created only when the context properties + # all match the match rules. + # + #{ factory = spa-node-factory args = { factory.name = videotestsrc node.name = videotestsrc Spa:Pod:Object:Param:Props:patternType = 1 } } + #{ factory = spa-device-factory args = { factory.name = api.jack.device foo=bar } flags = [ nofail ] } + #{ factory = spa-device-factory args = { factory.name = api.alsa.enum.udev } } + #{ factory = spa-node-factory args = { factory.name = api.alsa.seq.bridge node.name = Internal-MIDI-Bridge } } + #{ factory = adapter args = { factory.name = audiotestsrc node.name = my-test } } + { factory = spa-node-factory args = { factory.name = api.vulkan.compute.source node.name = vulkan-compute-source object.export = true } } + { factory = spa-node-factory args = { factory.name = api.vulkan.compute.filter node.name = vulkan-compute-filter object.export = true } } +]