Reduce UI jank when transitioning to the stream segue

This commit is contained in:
Cameron Gutman 2018-09-09 10:17:32 -07:00
parent b8169ae08b
commit cfbcc4093c
2 changed files with 14 additions and 2 deletions

View file

@ -278,6 +278,11 @@ Session::Session(NvComputer* computer, NvApp& app)
m_DisplayOriginX(0), m_DisplayOriginX(0),
m_DisplayOriginY(0), m_DisplayOriginY(0),
m_PendingWindowedTransition(false) m_PendingWindowedTransition(false)
{
}
void Session::initialize()
{ {
qDebug() << "Server GPU:" << m_Computer->gpuModel; qDebug() << "Server GPU:" << m_Computer->gpuModel;
@ -366,14 +371,14 @@ Session::Session(NvComputer* computer, NvApp& app)
break; break;
} }
if (computer->activeAddress == computer->remoteAddress) { if (m_Computer->activeAddress == m_Computer->remoteAddress) {
m_StreamConfig.streamingRemotely = 1; m_StreamConfig.streamingRemotely = 1;
} }
else { else {
m_StreamConfig.streamingRemotely = 0; m_StreamConfig.streamingRemotely = 0;
} }
if (computer->activeAddress == computer->localAddress) { if (m_Computer->activeAddress == m_Computer->localAddress) {
m_StreamConfig.packetSize = 1392; m_StreamConfig.packetSize = 1392;
} }
else { else {
@ -701,6 +706,11 @@ void Session::exec(int displayOriginX, int displayOriginY)
m_DisplayOriginX = displayOriginX; m_DisplayOriginX = displayOriginX;
m_DisplayOriginY = displayOriginY; m_DisplayOriginY = displayOriginY;
// Complete initialization in this deferred context to avoid
// calling expensive functions in the constructor (during the
// process of loading the StreamSegue).
initialize();
// Check for validation errors/warnings and emit // Check for validation errors/warnings and emit
// signals for them, if appropriate // signals for them, if appropriate
if (!validateLaunch()) { if (!validateLaunch()) {

View file

@ -41,6 +41,8 @@ signals:
void displayLaunchWarning(QString text); void displayLaunchWarning(QString text);
private: private:
void initialize();
bool validateLaunch(); bool validateLaunch();
void emitLaunchWarning(QString text); void emitLaunchWarning(QString text);