mirror of
https://github.com/moonlight-stream/moonlight-qt
synced 2025-01-23 16:15:02 +00:00
Improve fast AES heuristic for Linux ARM and unknown platforms
This commit is contained in:
parent
ce8b24dfa7
commit
be7694dd8b
2 changed files with 14 additions and 3 deletions
|
@ -605,8 +605,8 @@ bool Session::initialize()
|
||||||
|
|
||||||
#ifndef STEAM_LINK
|
#ifndef STEAM_LINK
|
||||||
// Opt-in to all encryption features if we detect that the platform
|
// Opt-in to all encryption features if we detect that the platform
|
||||||
// has AES cryptography acceleration instructions.
|
// has AES cryptography acceleration instructions and more than 2 cores.
|
||||||
if (StreamUtils::hasFastAes()) {
|
if (StreamUtils::hasFastAes() && SDL_GetCPUCount() > 2) {
|
||||||
m_StreamConfig.encryptionFlags = ENCFLG_ALL;
|
m_StreamConfig.encryptionFlags = ENCFLG_ALL;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -10,6 +10,10 @@
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef Q_OS_LINUX
|
||||||
|
#include <sys/auxv.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
Uint32 StreamUtils::getPlatformWindowFlags()
|
Uint32 StreamUtils::getPlatformWindowFlags()
|
||||||
{
|
{
|
||||||
#if defined(Q_OS_DARWIN)
|
#if defined(Q_OS_DARWIN)
|
||||||
|
@ -118,8 +122,15 @@ bool StreamUtils::hasFastAes()
|
||||||
#elif defined(Q_OS_DARWIN)
|
#elif defined(Q_OS_DARWIN)
|
||||||
// Everything that runs Catalina and later has AES-NI or ARMv8 crypto instructions
|
// Everything that runs Catalina and later has AES-NI or ARMv8 crypto instructions
|
||||||
return true;
|
return true;
|
||||||
|
#elif defined(Q_OS_LINUX) && defined(Q_PROCESSOR_ARM) && QT_POINTER_SIZE == 4
|
||||||
|
return getauxval(AT_HWCAP2) & HWCAP2_AES;
|
||||||
|
#elif defined(Q_OS_LINUX) && defined(Q_PROCESSOR_ARM) && QT_POINTER_SIZE == 8
|
||||||
|
return getauxval(AT_HWCAP) & HWCAP_AES;
|
||||||
|
#elif QT_POINTER_SIZE == 4
|
||||||
|
#warning Unknown 32-bit platform. Assuming AES is slow on this CPU.
|
||||||
|
return false;
|
||||||
#else
|
#else
|
||||||
// Assume AES is fast if we don't recognize the OS or processor
|
#warning Unknown 64-bit platform. Assuming AES is fast on this CPU.
|
||||||
return true;
|
return true;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue