Siarkowy / com.valvesoftware.Steam.CompatibilityTool.WineASIO

WineASIO extension for Steam Flatpak app. Low-latency audio in Rocksmith 2014! 🎸✨
3 stars 0 forks source link

pw_data_loop_start: can't create thread: Resource temporarily unavailable #1

Closed Siarkowy closed 1 year ago

Siarkowy commented 1 year ago

Game startup fails with No audio output device is detected error, and the following logs are produced.

Realtime privileges seem to be misconfigured inside Flatpak container.

110402.828:0114:0118:trace:loaddll:build_module Loaded L"C:\\windows\\system32\\wineasio.dll" at E1510000: builtin
[I][10402.829104] jack         | [ pipewire-jack.c: 3284 jack_client_open()] 0x7e3d2a00: open 'Rocksmith2014' options:1
[I][10402.829205] pw.conf      | [          conf.c:  423 conf_load()] 0x7e3db2d0: loaded config '/usr/share/pipewire/jack.conf' with 5 items
[I][10402.829227] pw.conf      | [          conf.c:  881 pw_context_conf_section_for_each()] handle config '/usr/share/pipewire/jack.conf' section 'context.properties'
[I][10402.829232] pw.context   | [       context.c:  259 pw_context_new()] 0x7e3daf90: parsed 1 context.properties items
[I][10402.829452] pw.conf      | [          conf.c:  881 pw_context_conf_section_for_each()] handle config '/usr/share/pipewire/jack.conf' section 'context.spa-libs'
[I][10402.829471] pw.context   | [       context.c:  360 pw_context_new()] 0x7e3daf90: parsed 1 context.spa-libs items
[I][10402.829477] pw.conf      | [          conf.c:  881 pw_context_conf_section_for_each()] handle config '/usr/share/pipewire/jack.conf' section 'context.modules'
[I][10402.829487] pw.module    | [   impl-module.c:  181 pw_context_load_module()] 0x7e3daf90: name:libpipewire-module-rt args:{
            #rt.prio      = 88
            #rt.time.soft = -1
            #rt.time.hard = -1
        }
[I][10402.829604] mod.rt       | [     module-rt.c:  600 check_realtime_privileges()] Clamp rtprio 88 to 0
[I][10402.829609] mod.rt       | [     module-rt.c:  607 check_realtime_privileges()] Priority max (0) must be at least 11
[I][10402.831005] pw.conf      | [          conf.c:  602 load_module()] 0x7e3daf90: loaded module libpipewire-module-rt
[I][10402.831015] pw.module    | [   impl-module.c:  181 pw_context_load_module()] 0x7e3daf90: name:libpipewire-module-protocol-native args:(null)
[I][10402.831175] pw.conf      | [          conf.c:  602 load_module()] 0x7e3daf90: loaded module libpipewire-module-protocol-native
[I][10402.831182] pw.module    | [   impl-module.c:  181 pw_context_load_module()] 0x7e3daf90: name:libpipewire-module-client-node args:(null)
[I][10402.831310] pw.conf      | [          conf.c:  602 load_module()] 0x7e3daf90: loaded module libpipewire-module-client-node
[I][10402.831316] pw.module    | [   impl-module.c:  181 pw_context_load_module()] 0x7e3daf90: name:libpipewire-module-metadata args:(null)
[I][10402.831384] pw.conf      | [          conf.c:  602 load_module()] 0x7e3daf90: loaded module libpipewire-module-metadata
[I][10402.831389] pw.context   | [       context.c:  364 pw_context_new()] 0x7e3daf90: parsed 4 context.modules items
[I][10402.831393] pw.context   | [       context.c:  369 pw_context_new()] 0x7e3daf90: parsed 0 context.objects items
[I][10402.831395] pw.context   | [       context.c:  372 pw_context_new()] 0x7e3daf90: parsed 0 context.exec items
[E][10402.831400] pw.data-loop | [     data-loop.c:  210 pw_data_loop_start()] 0x7e3dca90: can't create thread: Resource temporarily unavailable
[I][10402.831624] jack         | [ pipewire-jack.c: 3562 jack_client_close()] 0x7e3d2a00: close
[I][10402.831632] jack         | [ pipewire-jack.c: 3800 jack_deactivate()] 0x7e3d2a00: active:0
Unable to open a JACK client as: Rocksmith2014
110402.829:0114:0118:trace:loaddll:free_modref Unloaded module L"C:\\windows\\system32\\wineasio.dll" : builtin
Siarkowy commented 1 year ago

Originally posted as part of https://github.com/theNizo/linux_rocksmith/issues/31

Siarkowy commented 1 year ago

Using following audio interface:

% lsusb | grep -i 2i2
Bus 001 Device 002: ID 1235:8210 Focusrite-Novation Scarlett 2i2 Camera

Contents of RS_ASIO.ini:

# for "EnableWasapiOutputs" you can use -1 to have a message prompting
# to use either WASAPI or ASIO for output every time you boot the game
[Config]
EnableWasapiOutputs=0
EnableWasapiInputs=0
EnableAsio=1

[Asio]
; available buffer size modes:
;    driver - respect buffer size setting set in the driver
;    host   - use a buffer size as close as possible as that requested by the host application
;    custom - use the buffer size specified in CustomBufferSize field
BufferSizeMode=custom
CustomBufferSize=256

# if your game hangs or crashes on exit, try setting "EnableRefCountHack" to true.
# when blank or invalid, the value of "EnableRefCountHack" will be interpreted as
# true if RS ASIO detects the usage of Asio4All.
# the same applies for all inputs.
[Asio.Output]
Driver=WineASIO
BaseChannel=0
AltBaseChannel=
EnableSoftwareEndpointVolumeControl=1
EnableSoftwareMasterVolumeControl=1
SoftwareMasterVolumePercent=100
EnableRefCountHack=

[Asio.Input.0]
Driver=WineASIO
Channel=0
EnableSoftwareEndpointVolumeControl=1
EnableSoftwareMasterVolumeControl=1
SoftwareMasterVolumePercent=100
EnableRefCountHack=

#[Asio.Input.1]
#Driver=
#Channel=1
#EnableSoftwareEndpointVolumeControl=1
#EnableSoftwareMasterVolumeControl=1
#SoftwareMasterVolumePercent=100
#EnableRefCountHack=

#[Asio.Input.Mic]
#Driver=
#Channel=1
#EnableSoftwareEndpointVolumeControl=1
#EnableSoftwareMasterVolumeControl=1
#SoftwareMasterVolumePercent=100
#EnableRefCountHack=

Contents of Rocksmith.ini:

[Audio]
EnableMicrophone=1
ExclusiveMode=1
LatencyBuffer=4
ForceDefaultPlaybackDevice=
ForceWDM=0
ForceDirectXSink=0
DumpAudioLog=0
MaxOutputBufferSize=0
RealToneCableOnly=0
MonoToStereoChannel=0
Win32UltraLowLatencyMode=1
[Renderer.Win32]
ShowGamepadUI=0
ScreenWidth=0
ScreenHeight=0
Fullscreen=1
VisualQuality=1
RenderingWidth=0
RenderingHeight=0
EnablePostEffects=1
EnableShadows=1
EnableHighResScope=1
EnableDepthOfField=1
EnablePerPixelLighting=1
MsaaSamples=4
DisableBrowser=0
[Net]
UseProxy=1
[Global]
Version=1
Siarkowy commented 1 year ago

Fixed after $USER is added to realtime group, and realtime privileges are enabled in /etc/security/limits.d/realtime.conf or similar. See https://jackaudio.org/faq/linux_rt_config.html for more details.

This should also potentially work with existing pipewire group mentioned in /etc/security/limits.d/25-pw-rlimits.conf.


For Fedora 38 Silverblue:

Enable realtime setup.

rpm-ostree install realtime-setup
systemctl reboot

Verify group name in:

cat /etc/security/limits.d/realtime.conf

Add user to realtime group.

grep -E '^realtime:' /usr/lib/group
sh -c "grep -E '^realtime:' /usr/lib/group >> /etc/group"

Now, add yourself to realtime group in /etc/group, then log out completely or reboot.

After logging in, running groups should contain realtime.