diff --git a/libs/ardour/automation_watch.cc b/libs/ardour/automation_watch.cc index 3778367e9e..20b6b093a9 100644 --- a/libs/ardour/automation_watch.cc +++ b/libs/ardour/automation_watch.cc @@ -201,7 +201,7 @@ AutomationWatch::timer () void AutomationWatch::thread () { - pbd_set_thread_priority (pthread_self(), PBD_SCHED_FIFO, AudioEngine::instance()->client_real_time_priority() - 2); // XXX + pbd_set_thread_priority (pthread_self(), PBD_SCHED_FIFO, PBD_RT_PRI_CTRL); while (_run_thread) { Glib::usleep ((gulong) floor (Config->get_automation_interval_msecs() * 1000)); // TODO use pthread_cond_timedwait on _run_thread timer (); diff --git a/libs/ardour/convolver.cc b/libs/ardour/convolver.cc index ee4fff453d..9dd1dfecf6 100644 --- a/libs/ardour/convolver.cc +++ b/libs/ardour/convolver.cc @@ -169,7 +169,7 @@ Convolution::restart () } if (rv == 0) { - rv = _convproc.start_process (pbd_absolute_rt_priority (PBD_SCHED_FIFO, AudioEngine::instance ()->client_real_time_priority () - 1), PBD_SCHED_FIFO); + rv = _convproc.start_process (pbd_absolute_rt_priority (PBD_SCHED_FIFO, PBD_RT_PRI_PROC), PBD_SCHED_FIFO); } assert (rv == 0); // bail out in debug builds diff --git a/libs/ardour/globals.cc b/libs/ardour/globals.cc index 22166d7eea..a017ff7d3b 100644 --- a/libs/ardour/globals.cc +++ b/libs/ardour/globals.cc @@ -815,7 +815,7 @@ ARDOUR::init_post_engine (uint32_t start_cnt) } } - BaseUI::set_thread_priority (pbd_absolute_rt_priority (PBD_SCHED_FIFO, AudioEngine::instance()->client_real_time_priority () - 2)); + BaseUI::set_thread_priority (pbd_absolute_rt_priority (PBD_SCHED_FIFO, PBD_RT_PRI_CTRL)); TransportMasterManager::instance ().restart (); } diff --git a/libs/ardour/lv2_plugin.cc b/libs/ardour/lv2_plugin.cc index 1121334159..de01e94245 100644 --- a/libs/ardour/lv2_plugin.cc +++ b/libs/ardour/lv2_plugin.cc @@ -607,7 +607,7 @@ LV2Plugin::init(const void* c_plugin, samplecnt_t rate) static const int32_t _min_block_length = 1; // may happen during split-cycles static const int32_t _max_block_length = 8192; // max possible (with all engines and during export) static const int32_t rt_policy = PBD_SCHED_FIFO; - static const int32_t rt_priority = pbd_absolute_rt_priority (PBD_SCHED_FIFO, AudioEngine::instance()->client_real_time_priority () - 1); + static const int32_t rt_priority = pbd_absolute_rt_priority (PBD_SCHED_FIFO, PBD_RT_PRI_PROC); static const int32_t hw_concurrency = how_many_dsp_threads (); /* Consider updating max-block-size whenever the buffersize changes. * It requires re-instantiating the plugin (which is a non-realtime operation), diff --git a/libs/pbd/base_ui.cc b/libs/pbd/base_ui.cc index d6b37f3657..4b4a65edb7 100644 --- a/libs/pbd/base_ui.cc +++ b/libs/pbd/base_ui.cc @@ -50,7 +50,7 @@ using namespace PBD; using namespace Glib; uint64_t BaseUI::rt_bit = 1; -int BaseUI::_thread_priority = PBD_RT_PRI_PROC - 1; +int BaseUI::_thread_priority = PBD_RT_PRI_CTRL; BaseUI::RequestType BaseUI::CallSlot = BaseUI::new_request_type(); BaseUI::RequestType BaseUI::Quit = BaseUI::new_request_type(); diff --git a/libs/pbd/pbd/pthread_utils.h b/libs/pbd/pbd/pthread_utils.h index 862340c548..a528363230 100644 --- a/libs/pbd/pbd/pthread_utils.h +++ b/libs/pbd/pbd/pthread_utils.h @@ -57,6 +57,7 @@ # define PBD_RT_PRI_MAIN pbd_pthread_priority (THREAD_MAIN) # define PBD_RT_PRI_MIDI pbd_pthread_priority (THREAD_MIDI) # define PBD_RT_PRI_PROC pbd_pthread_priority (THREAD_PROC) +# define PBD_RT_PRI_CTRL pbd_pthread_priority (THREAD_CTRL) LIBPBD_API int pthread_create_and_store (std::string name, pthread_t *thread, void * (*start_routine)(void *), void * arg, uint32_t stacklimit = 0x80000 /*512kB*/); LIBPBD_API void pthread_cancel_one (pthread_t thread); @@ -65,10 +66,13 @@ LIBPBD_API void pthread_kill_all (int signum); LIBPBD_API const char* pthread_name (); LIBPBD_API void pthread_set_name (const char* name); +LIBPBD_API void pbd_set_engine_rt_priority (int); + enum PBDThreadClass { THREAD_MAIN, // main audio I/O thread THREAD_MIDI, // MIDI I/O threads THREAD_PROC, // realtime worker + THREAD_CTRL, // Automation watch, BaseUI THREAD_IO // non-realtime I/O };