mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2026-06-17 22:23:31 +00:00
Adjust thread priorities based on recent refactoring
This commit is contained in:
@@ -1007,14 +1007,6 @@ void Session::exec(int displayOriginX, int displayOriginY)
|
|||||||
// sleep precision and more accurate callback timing.
|
// sleep precision and more accurate callback timing.
|
||||||
SDL_SetHint(SDL_HINT_TIMER_RESOLUTION, "1");
|
SDL_SetHint(SDL_HINT_TIMER_RESOLUTION, "1");
|
||||||
|
|
||||||
// Raise the priority of the main thread, since it handles
|
|
||||||
// time-sensitive video rendering
|
|
||||||
if (SDL_SetThreadPriority(SDL_THREAD_PRIORITY_HIGH) < 0) {
|
|
||||||
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
|
||||||
"Unable to set main thread to high priority: %s",
|
|
||||||
SDL_GetError());
|
|
||||||
}
|
|
||||||
|
|
||||||
int currentDisplayIndex = SDL_GetWindowDisplayIndex(m_Window);
|
int currentDisplayIndex = SDL_GetWindowDisplayIndex(m_Window);
|
||||||
|
|
||||||
// Now that we're about to stream, any SDL_QUIT event is expected
|
// Now that we're about to stream, any SDL_QUIT event is expected
|
||||||
|
|||||||
@@ -76,7 +76,11 @@ int DxVsyncSource::vsyncThread(void* context)
|
|||||||
{
|
{
|
||||||
DxVsyncSource* me = reinterpret_cast<DxVsyncSource*>(context);
|
DxVsyncSource* me = reinterpret_cast<DxVsyncSource*>(context);
|
||||||
|
|
||||||
|
#if SDL_VERSION_ATLEAST(2, 0, 9)
|
||||||
|
SDL_SetThreadPriority(SDL_THREAD_PRIORITY_TIME_CRITICAL);
|
||||||
|
#else
|
||||||
SDL_SetThreadPriority(SDL_THREAD_PRIORITY_HIGH);
|
SDL_SetThreadPriority(SDL_THREAD_PRIORITY_HIGH);
|
||||||
|
#endif
|
||||||
|
|
||||||
D3DKMT_OPENADAPTERFROMHDC openAdapterParams = {};
|
D3DKMT_OPENADAPTERFROMHDC openAdapterParams = {};
|
||||||
HMONITOR lastMonitor = nullptr;
|
HMONITOR lastMonitor = nullptr;
|
||||||
|
|||||||
@@ -33,7 +33,11 @@ int NullThreadedVsyncSource::vsyncThread(void* context)
|
|||||||
{
|
{
|
||||||
NullThreadedVsyncSource* me = reinterpret_cast<NullThreadedVsyncSource*>(context);
|
NullThreadedVsyncSource* me = reinterpret_cast<NullThreadedVsyncSource*>(context);
|
||||||
|
|
||||||
|
#if SDL_VERSION_ATLEAST(2, 0, 9)
|
||||||
|
SDL_SetThreadPriority(SDL_THREAD_PRIORITY_TIME_CRITICAL);
|
||||||
|
#else
|
||||||
SDL_SetThreadPriority(SDL_THREAD_PRIORITY_HIGH);
|
SDL_SetThreadPriority(SDL_THREAD_PRIORITY_HIGH);
|
||||||
|
#endif;
|
||||||
|
|
||||||
while (SDL_AtomicGet(&me->m_Stopping) == 0) {
|
while (SDL_AtomicGet(&me->m_Stopping) == 0) {
|
||||||
me->m_Pacer->vsyncCallback(1000 / me->m_DisplayFps);
|
me->m_Pacer->vsyncCallback(1000 / me->m_DisplayFps);
|
||||||
|
|||||||
@@ -65,6 +65,12 @@ int Pacer::renderThread(void* context)
|
|||||||
{
|
{
|
||||||
Pacer* me = reinterpret_cast<Pacer*>(context);
|
Pacer* me = reinterpret_cast<Pacer*>(context);
|
||||||
|
|
||||||
|
if (SDL_SetThreadPriority(SDL_THREAD_PRIORITY_HIGH) < 0) {
|
||||||
|
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
|
"Unable to set render thread to high priority: %s",
|
||||||
|
SDL_GetError());
|
||||||
|
}
|
||||||
|
|
||||||
while (!me->m_Stopping) {
|
while (!me->m_Stopping) {
|
||||||
// Acquire the frame queue lock to protect the queue and
|
// Acquire the frame queue lock to protect the queue and
|
||||||
// the not empty condition
|
// the not empty condition
|
||||||
|
|||||||
Reference in New Issue
Block a user