From 3ca70616590cc5161863d5647035d358534d1a53 Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Mon, 11 Jan 2021 14:17:49 +0100 Subject: [PATCH] Switch to SCHED_OTHER while handling events GUI drawing should not be able to interrupt the cores that are handling DSP, but it seems like that was happening for some people with suboptimal kernel configurations. This will require some more extensive testing to see if these changes don't actually increase DSP load. --- CHANGELOG.md | 4 ++++ src/wine-host/utils.h | 13 +++++++++++++ 2 files changed, 17 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 102fed67..dec1a76b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -45,6 +45,10 @@ TODO: Add an updated screenshot with some fancy VST3-only plugins to the readme difference in responsiveness. - VST2 editor idle events are now handled slightly differently. This should result in even more responsive GUIs for VST2 plugins. +- Win32 and X11 events in the Wine plugin host are now handled with lower + scheduling priority than other tasks. With a properly configured system GUI + drawing should not affect DSP load at all, but this should help with less than + optimal setups some people were getting DSP load spikes with the editor open. - Changed part of the build process considering [this Wine bug](https://bugs.winehq.org/show_bug.cgi?id=49138). Building with Wine 5.7 and 5.8 required a change, but that change now breaks builds using Wine 6.0 diff --git a/src/wine-host/utils.h b/src/wine-host/utils.h index 3477b586..2dae532b 100644 --- a/src/wine-host/utils.h +++ b/src/wine-host/utils.h @@ -32,6 +32,8 @@ #include #include +#include "../common/utils.h" + /** * The delay between calls to the event loop so we can keep a nice 60 fps. We * could bump this up to the monitor's refresh rate, but I'm afraid that it will @@ -108,7 +110,18 @@ class MainContext { return; } + // NOTE: These periodic callbacks should not be able to + // interrupt other threads that are actively processing + // audio. For me personally having the GUI open makes + // absolutely zero difference on DSP usage (as it should), + // but for some others it does have an impact. + // TODO: Benchmark this further on a properly configured system, + // see if it does not increase average load because of the + // rapid scheduling switching. + set_realtime_priority(false); handler(); + set_realtime_priority(true); + async_handle_events(handler); }); }