|
|
|
|
@ -115,7 +115,7 @@ static constexpr int IDLE_UPDATE_INTERVAL_WITH_FULLSCREEN_UI = 8;
|
|
|
|
|
static constexpr int IDLE_UPDATE_INTERVAL_WHILE_DOWNLOADING = 10;
|
|
|
|
|
|
|
|
|
|
/// Poll at 1ms when running GDB server. We can get rid of this once we move networking to its own thread.
|
|
|
|
|
static constexpr int IDLE_UPDATE_INTERVAL_WITH_GDB_CLIENTS = 1;
|
|
|
|
|
static constexpr int IDLE_UPDATE_INTERVAL_WITH_GDB_CLIENTS = 10;
|
|
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
|
// Local function declarations
|
|
|
|
|
@ -2092,7 +2092,7 @@ void CoreThread::createIdleUpdateTimer()
|
|
|
|
|
m_idle_update_timer = new QTimer(this);
|
|
|
|
|
m_idle_update_timer->setSingleShot(false);
|
|
|
|
|
m_idle_update_timer->setTimerType(Qt::CoarseTimer);
|
|
|
|
|
connect(m_idle_update_timer, &QTimer::timeout, &Core::IdleUpdate);
|
|
|
|
|
connect(m_idle_update_timer, &QTimer::timeout, this, &CoreThread::onIdleUpdateTimer);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CoreThread::destroyIdleUpdateTimer()
|
|
|
|
|
@ -2123,6 +2123,25 @@ void CoreThread::stopIdleUpdateTimer()
|
|
|
|
|
m_idle_update_timer->stop();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CoreThread::onIdleUpdateTimer()
|
|
|
|
|
{
|
|
|
|
|
if (!m_has_gdb_clients)
|
|
|
|
|
{
|
|
|
|
|
Core::IdleUpdate(0);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// When we have gdb clients, use the multiplexer to sleep instead. that way round-trips can
|
|
|
|
|
// be responded to as quickly as possible.
|
|
|
|
|
//
|
|
|
|
|
// NOTE: This is kinda screwy, because it'll block RunOnCoreThread() callbacks from running
|
|
|
|
|
// while we're polling. Hence why it's still capped at 10ms.
|
|
|
|
|
|
|
|
|
|
const int timeout = m_idle_update_timer->interval();
|
|
|
|
|
const u64 poll_until = Timer::GetCurrentValue() + Timer::ConvertMillisecondsToValue(static_cast<u32>(timeout));
|
|
|
|
|
Core::IdleUpdate(poll_until);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CoreThread::updateIdleTimerInterval()
|
|
|
|
|
{
|
|
|
|
|
if (!isCurrentThread())
|
|
|
|
|
@ -2145,13 +2164,10 @@ void CoreThread::updateIdleTimerInterval()
|
|
|
|
|
|
|
|
|
|
int CoreThread::getBackgroundControllerPollInterval() const
|
|
|
|
|
{
|
|
|
|
|
#ifdef ENABLE_GDB_SERVER
|
|
|
|
|
if (GDBServer::HasAnyClients())
|
|
|
|
|
return IDLE_UPDATE_INTERVAL_WITH_GDB_CLIENTS;
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
if (m_video_thread_run_idle)
|
|
|
|
|
return IDLE_UPDATE_INTERVAL_WITH_FULLSCREEN_UI;
|
|
|
|
|
else if (m_has_gdb_clients)
|
|
|
|
|
return IDLE_UPDATE_INTERVAL_WITH_GDB_CLIENTS;
|
|
|
|
|
else if (m_http_downloader_active)
|
|
|
|
|
return IDLE_UPDATE_INTERVAL_WHILE_DOWNLOADING;
|
|
|
|
|
else if (InputManager::GetPollableDeviceCount() > 0)
|
|
|
|
|
@ -2173,6 +2189,18 @@ void CoreThread::setHTTPDownloaderActive(bool active)
|
|
|
|
|
updateIdleTimerInterval();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CoreThread::setGDBActiveClients(bool active)
|
|
|
|
|
{
|
|
|
|
|
if (!isCurrentThread())
|
|
|
|
|
{
|
|
|
|
|
QMetaObject::invokeMethod(this, &CoreThread::setGDBActiveClients, Qt::QueuedConnection, active);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_has_gdb_clients = active;
|
|
|
|
|
updateIdleTimerInterval();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CoreThread::setVideoThreadRunIdle(bool active)
|
|
|
|
|
{
|
|
|
|
|
if (!isCurrentThread())
|
|
|
|
|
@ -2214,7 +2242,7 @@ void Host::OnHTTPDownloaderActiveChanged(bool active)
|
|
|
|
|
|
|
|
|
|
void Host::OnGDBServerActiveClientsChanged(bool has_clients)
|
|
|
|
|
{
|
|
|
|
|
g_core_thread->updateIdleTimerInterval();
|
|
|
|
|
g_core_thread->setGDBActiveClients(has_clients);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CoreThread::stop()
|
|
|
|
|
|