Correctly set ctrl-surface thread priority

This commit is contained in:
Robin Gareus 2021-06-10 03:17:13 +02:00
parent 89a0040f1b
commit 6e82f3669f
No known key found for this signature in database
GPG key ID: A090BCE02CF57F04
3 changed files with 13 additions and 3 deletions

View file

@ -47,6 +47,7 @@
#include <boost/algorithm/string/erase.hpp>
#include "pbd/basename.h"
#include "pbd/base_ui.h"
#include "pbd/convert.h"
#include "pbd/error.h"
#include "pbd/file_utils.h"
@ -542,6 +543,8 @@ Session::immediately_post_engine ()
_process_graph.reset (new Graph (*this));
}
BaseUI::set_thread_priority (pbd_absolute_rt_priority (PBD_SCHED_FIFO, AudioEngine::instance()->client_real_time_priority () - 3));
/* every time we reconnect, recompute worst case output latencies */
_engine.Running.connect_same_thread (*this, boost::bind (&Session::initialize_latencies, this));

View file

@ -50,6 +50,8 @@ using namespace PBD;
using namespace Glib;
uint64_t BaseUI::rt_bit = 1;
int BaseUI::_thread_priority = PBD_RT_PRI_PROC - 1;
BaseUI::RequestType BaseUI::CallSlot = BaseUI::new_request_type();
BaseUI::RequestType BaseUI::Quit = BaseUI::new_request_type();
@ -83,9 +85,9 @@ BaseUI::new_request_type ()
}
int
BaseUI::set_thread_priority (const int policy, int priority) const
BaseUI::set_thread_priority () const
{
return pbd_set_thread_priority (pthread_self(), policy, priority);
return pbd_set_thread_priority (pthread_self(), PBD_SCHED_FIFO, _thread_priority);
}
void

View file

@ -62,6 +62,10 @@ class LIBPBD_API BaseUI : public sigc::trackable, public PBD::EventLoop
static RequestType CallSlot;
static RequestType Quit;
static void set_thread_priority (int p) {
_thread_priority = p;
}
/** start up a thread to run the main loop
*/
void run ();
@ -93,7 +97,7 @@ class LIBPBD_API BaseUI : public sigc::trackable, public PBD::EventLoop
virtual void thread_init () {};
int set_thread_priority (const int policy = PBD_SCHED_FIFO, int priority = 0) const;
int set_thread_priority () const;
/** Called when there input ready on the request_channel
*/
@ -114,6 +118,7 @@ class LIBPBD_API BaseUI : public sigc::trackable, public PBD::EventLoop
CrossThreadChannel request_channel;
static uint64_t rt_bit;
static int _thread_priority;
int setup_request_pipe ();
void main_thread ();