mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
EXpose the master index for cpu, gpu and display and adjust the profuiler to support it / remove unsupported deferred for macs since now it is fixed
This commit is contained in:
parent
9d9b80dec0
commit
6ef652038b
9 changed files with 140 additions and 14 deletions
|
@ -167,7 +167,9 @@ bool PlatformInfoScriptingInterface::isStandalone() {
|
|||
int PlatformInfoScriptingInterface::getNumCPUs() {
|
||||
return platform::getNumCPUs();
|
||||
}
|
||||
|
||||
int PlatformInfoScriptingInterface::getMasterCPU() {
|
||||
return platform::getMasterCPU();
|
||||
}
|
||||
QString PlatformInfoScriptingInterface::getCPU(int index) {
|
||||
auto desc = platform::getCPU(index);
|
||||
return QString(desc.dump().c_str());
|
||||
|
@ -176,7 +178,9 @@ QString PlatformInfoScriptingInterface::getCPU(int index) {
|
|||
int PlatformInfoScriptingInterface::getNumGPUs() {
|
||||
return platform::getNumGPUs();
|
||||
}
|
||||
|
||||
int PlatformInfoScriptingInterface::getMasterGPU() {
|
||||
return platform::getMasterGPU();
|
||||
}
|
||||
QString PlatformInfoScriptingInterface::getGPU(int index) {
|
||||
auto desc = platform::getGPU(index);
|
||||
return QString(desc.dump().c_str());
|
||||
|
@ -185,7 +189,9 @@ QString PlatformInfoScriptingInterface::getGPU(int index) {
|
|||
int PlatformInfoScriptingInterface::getNumDisplays() {
|
||||
return platform::getNumDisplays();
|
||||
}
|
||||
|
||||
int PlatformInfoScriptingInterface::getMasterDisplay() {
|
||||
return platform::getMasterDisplay();
|
||||
}
|
||||
QString PlatformInfoScriptingInterface::getDisplay(int index) {
|
||||
auto desc = platform::getDisplay(index);
|
||||
return QString(desc.dump().c_str());
|
||||
|
|
|
@ -94,8 +94,8 @@ public slots:
|
|||
* @returns {string} The graphics card type.
|
||||
* @deprecated This function is deprecated and will be removed.
|
||||
* use getNumGPUs() to know the number of GPUs in the hardware, at least one is expected
|
||||
* use getGPU(0)["vendor"] to get the brand of the vendor
|
||||
* use getGPU(0)["model"] to get the model name of the gpu
|
||||
* use getGPU(getMasterGPU())["vendor"] to get the brand of the vendor
|
||||
* use getGPU(getMasterGPU())["model"] to get the model name of the gpu
|
||||
*/
|
||||
QString getGraphicsCardType();
|
||||
|
||||
|
@ -135,6 +135,13 @@ public slots:
|
|||
*/
|
||||
int getNumCPUs();
|
||||
|
||||
/**jsdoc
|
||||
* Get the index of the master CPU.
|
||||
* @function PlatformInfo.getMasterCPU
|
||||
* @returns {number} The index of the master CPU detected on the hardware platform.
|
||||
*/
|
||||
int getMasterCPU();
|
||||
|
||||
/**jsdoc
|
||||
* Get the description of the CPU at the index parameter
|
||||
* expected fields are:
|
||||
|
@ -152,6 +159,13 @@ public slots:
|
|||
*/
|
||||
int getNumGPUs();
|
||||
|
||||
/**jsdoc
|
||||
* Get the index of the master GPU.
|
||||
* @function PlatformInfo.getMasterGPU
|
||||
* @returns {number} The index of the master GPU detected on the hardware platform.
|
||||
*/
|
||||
int getMasterGPU();
|
||||
|
||||
/**jsdoc
|
||||
* Get the description of the GPU at the index parameter
|
||||
* expected fields are:
|
||||
|
@ -169,6 +183,13 @@ public slots:
|
|||
*/
|
||||
int getNumDisplays();
|
||||
|
||||
/**jsdoc
|
||||
* Get the index of the master Display.
|
||||
* @function PlatformInfo.getMasterDisplay
|
||||
* @returns {number} The index of the master Display detected on the hardware platform.
|
||||
*/
|
||||
int getMasterDisplay();
|
||||
|
||||
/**jsdoc
|
||||
* Get the description of the Display at the index parameter
|
||||
* expected fields are:
|
||||
|
|
|
@ -21,12 +21,15 @@ bool enumeratePlatform();
|
|||
|
||||
int getNumCPUs();
|
||||
json getCPU(int index);
|
||||
int getMasterCPU();
|
||||
|
||||
int getNumGPUs();
|
||||
json getGPU(int index);
|
||||
int getMasterGPU();
|
||||
|
||||
int getNumDisplays();
|
||||
json getDisplay(int index);
|
||||
int getMasterDisplay();
|
||||
|
||||
json getMemory();
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ namespace platform { namespace keys{
|
|||
extern const char* model;
|
||||
extern const char* clockSpeed;
|
||||
extern const char* numCores;
|
||||
extern const char* isMaster;
|
||||
}
|
||||
namespace gpu {
|
||||
extern const char* vendor;
|
||||
|
@ -31,6 +32,7 @@ namespace platform { namespace keys{
|
|||
extern const char* videoMemory;
|
||||
extern const char* driver;
|
||||
extern const char* displays;
|
||||
extern const char* isMaster;
|
||||
}
|
||||
namespace nic {
|
||||
extern const char* mac;
|
||||
|
|
|
@ -32,9 +32,9 @@ Profiler::Tier Profiler::profilePlatform() {
|
|||
return platformTier;
|
||||
}
|
||||
|
||||
// Not filtered yet, let s try to make sense of the cpu and gpu info
|
||||
auto cpuInfo = platform::getCPU(0);
|
||||
auto gpuInfo = platform::getGPU(0);
|
||||
// Not filtered yet, let s try to make sense of the master cpu and master gpu info
|
||||
auto cpuInfo = platform::getCPU(platform::getMasterCPU());
|
||||
auto gpuInfo = platform::getGPU(platform::getMasterGPU());
|
||||
if (filterOnProcessors(computerInfo, cpuInfo, gpuInfo, platformTier)) {
|
||||
return platformTier;
|
||||
}
|
||||
|
@ -133,10 +133,12 @@ bool filterOnProcessors(const platform::json& computer, const platform::json& cp
|
|||
// YES on macos EXCEPT for macbookair with gpu intel iris or intel HD 6000
|
||||
bool Profiler::isRenderMethodDeferredCapable() {
|
||||
#if defined(Q_OS_MAC)
|
||||
// Deferred works correctly on every supported macos platform at the moment, let s enable it
|
||||
/*
|
||||
auto computer = platform::getComputer();
|
||||
const auto computerModel = (computer.count(keys::computer::model) ? computer[keys::computer::model].get<std::string>() : "");
|
||||
|
||||
auto gpuInfo = platform::getGPU(0);
|
||||
auto gpuInfo = platform::getGPU(getMasterGPU());
|
||||
const auto gpuModel = (gpuInfo.count(keys::gpu::model) ? gpuInfo[keys::gpu::model].get<std::string>() : "");
|
||||
|
||||
|
||||
|
@ -154,7 +156,7 @@ bool Profiler::isRenderMethodDeferredCapable() {
|
|||
if ((gpuModel.find("Intel ") != std::string::npos)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
*/
|
||||
return true;
|
||||
#elif defined(Q_OS_ANDROID)
|
||||
return false;
|
||||
|
|
|
@ -21,7 +21,8 @@ namespace platform { namespace keys {
|
|||
const char* model = "model";
|
||||
const char* clockSpeed = "clockSpeed";
|
||||
const char* numCores = "numCores";
|
||||
}
|
||||
const char* isMaster = "isMaster";
|
||||
}
|
||||
namespace gpu {
|
||||
const char* vendor = "vendor";
|
||||
const char* vendor_NVIDIA = "NVIDIA";
|
||||
|
@ -32,6 +33,7 @@ namespace platform { namespace keys {
|
|||
const char* videoMemory = "videoMemory";
|
||||
const char* driver = "driver";
|
||||
const char* displays = "displays";
|
||||
const char* isMaster = "isMaster";
|
||||
}
|
||||
namespace nic {
|
||||
const char* mac = "mac";
|
||||
|
@ -127,6 +129,10 @@ json platform::getCPU(int index) {
|
|||
return _instance->getCPU(index);
|
||||
}
|
||||
|
||||
int platform::getMasterCPU() {
|
||||
return _instance->getMasterCPU();
|
||||
}
|
||||
|
||||
int platform::getNumGPUs() {
|
||||
return _instance->getNumGPUs();
|
||||
}
|
||||
|
@ -135,6 +141,10 @@ json platform::getGPU(int index) {
|
|||
return _instance->getGPU(index);
|
||||
}
|
||||
|
||||
int platform::getMasterGPU() {
|
||||
return _instance->getMasterGPU();
|
||||
}
|
||||
|
||||
int platform::getNumDisplays() {
|
||||
return _instance->getNumDisplays();
|
||||
}
|
||||
|
@ -143,6 +153,10 @@ json platform::getDisplay(int index) {
|
|||
return _instance->getDisplay(index);
|
||||
}
|
||||
|
||||
int platform::getMasterDisplay() {
|
||||
return _instance->getMasterDisplay();
|
||||
}
|
||||
|
||||
json platform::getMemory() {
|
||||
return _instance->getMemory();
|
||||
}
|
||||
|
|
|
@ -16,17 +16,83 @@
|
|||
using namespace platform;
|
||||
|
||||
bool Instance::enumeratePlatform() {
|
||||
//clear all knowledge
|
||||
_computer.clear();
|
||||
_memory.clear();
|
||||
_cpus.clear();
|
||||
_gpus.clear();
|
||||
_displays.clear();
|
||||
_nics.clear();
|
||||
|
||||
// enumerate platform components
|
||||
enumerateComputer();
|
||||
enumerateMemory();
|
||||
enumerateCpus();
|
||||
enumerateGpusAndDisplays();
|
||||
enumerateNics();
|
||||
|
||||
// eval the master index for each platform scopes
|
||||
updateMasterIndices();
|
||||
|
||||
// And profile the platform and put the tier in "computer"
|
||||
_computer[keys::computer::profileTier] = Profiler::TierNames[Profiler::profilePlatform()];
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Instance::updateMasterIndices() {
|
||||
// We assume a single CPU at the moment:
|
||||
{
|
||||
if (!_cpus.empty()) {
|
||||
_masterCPU = 0;
|
||||
_cpus[0][keys::cpu::isMaster] = true;
|
||||
} else {
|
||||
_masterCPU = NOT_FOUND;
|
||||
}
|
||||
}
|
||||
|
||||
// Go through the displays list
|
||||
{
|
||||
_masterDisplay = NOT_FOUND;
|
||||
for (int i = 0; i < _displays.size(); ++i) {
|
||||
const auto& display = _displays[i];
|
||||
if (display.count(keys::display::isMaster)) {
|
||||
if (display[keys::display::isMaster].get<bool>()) {
|
||||
_masterDisplay = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// NO master display found, return the first one or NOT_FOUND if no display
|
||||
if (_masterDisplay == NOT_FOUND) {
|
||||
if (!_displays.empty()) {
|
||||
_masterDisplay = 0;
|
||||
_displays[0][keys::display::isMaster] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// From the master display decide the master gpu
|
||||
{
|
||||
_masterGPU = NOT_FOUND;
|
||||
if (_masterDisplay != NOT_FOUND) {
|
||||
const auto& display = _displays[_masterDisplay];
|
||||
// FInd the GPU index of the master display
|
||||
if (display.count(keys::display::gpu)) {
|
||||
_masterGPU = display[keys::display::gpu];
|
||||
_gpus[_masterGPU][keys::gpu::isMaster] = true;
|
||||
}
|
||||
}
|
||||
// NO master GPU found from master display, bummer, return the first one or NOT_FOUND if no display
|
||||
if (_masterGPU == NOT_FOUND) {
|
||||
if (!_gpus.empty()) {
|
||||
_masterGPU = 0;
|
||||
_gpus[0][keys::gpu::isMaster] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Instance::enumerateNics() {
|
||||
QNetworkInterface interface;
|
||||
foreach(interface, interface.allInterfaces()) {
|
||||
|
@ -56,6 +122,7 @@ json Instance::getGPU(int index) {
|
|||
return _gpus.at(index);
|
||||
}
|
||||
|
||||
|
||||
json Instance::getDisplay(int index) {
|
||||
assert(index <(int) _displays.size());
|
||||
|
||||
|
@ -99,8 +166,6 @@ json Instance::listAllKeys() {
|
|||
keys::gpu::driver,
|
||||
keys::gpu::displays,
|
||||
|
||||
keys::display::description,
|
||||
keys::display::name,
|
||||
keys::display::boundsLeft,
|
||||
keys::display::boundsRight,
|
||||
keys::display::boundsTop,
|
||||
|
|
|
@ -17,16 +17,21 @@ namespace platform {
|
|||
|
||||
class Instance {
|
||||
public:
|
||||
const int NOT_FOUND { -1 };
|
||||
|
||||
bool virtual enumeratePlatform();
|
||||
|
||||
int getNumCPUs() { return (int)_cpus.size(); }
|
||||
json getCPU(int index);
|
||||
int getMasterCPU() const { return _masterCPU; }
|
||||
|
||||
int getNumGPUs() { return (int)_gpus.size(); }
|
||||
json getGPU(int index);
|
||||
int getMasterGPU() const { return _masterGPU; }
|
||||
|
||||
int getNumDisplays() { return (int)_displays.size(); }
|
||||
json getDisplay(int index);
|
||||
int getMasterDisplay() const { return _masterDisplay; }
|
||||
|
||||
json getMemory() { return _memory; }
|
||||
|
||||
|
@ -54,6 +59,14 @@ protected:
|
|||
std::vector<json> _nics;
|
||||
json _memory;
|
||||
json _computer;
|
||||
|
||||
int _masterCPU{ -1 };
|
||||
int _masterGPU{ -1 };
|
||||
int _masterDisplay{ -1 };
|
||||
|
||||
// Traverse the cpus, gpus and displays to update the "master" index in each domain
|
||||
void updateMasterIndices();
|
||||
|
||||
};
|
||||
|
||||
} // namespace platform
|
||||
|
|
|
@ -289,7 +289,7 @@ GPUIdent* GPUIdent::ensureQuery(const QString& vendor, const QString& renderer)
|
|||
|
||||
nlohmann::json output = {};
|
||||
output["model"] = deviceName;
|
||||
output["coordinatesleft"] = test->DesktopCoordinates.left;
|
||||
output["coordsinatesleft"] = test->DesktopCoordinates.left;
|
||||
output["coordinatesright"] = test->DesktopCoordinates.right;
|
||||
output["coordinatestop"] = test->DesktopCoordinates.top;
|
||||
output["coordinatesbottom"] = test->DesktopCoordinates.bottom;
|
||||
|
|
Loading…
Reference in a new issue