Cleaning up the interface for the Performance PRESET and the associated debug ui

This commit is contained in:
Sam Gateau 2019-05-30 12:03:44 -07:00
parent a212a8a36a
commit b88deb52b0
13 changed files with 225 additions and 141 deletions

View file

@ -5366,18 +5366,18 @@ void Application::loadSettings() {
// A bunch of Performance, Simulation and Render settings will be set to a matching default value from this // A bunch of Performance, Simulation and Render settings will be set to a matching default value from this
// Here is the mapping between pelatformTIer and performance profile // Here is the mapping between pelatformTIer and performance profile
const std::array<PerformanceManager::PerformanceProfile, platform::Profiler::NumTiers> platformToPerformanceProfileMap = {{ const std::array<PerformanceManager::PerformancePreset, platform::Profiler::NumTiers> platformToPerformancePresetMap = {{
PerformanceManager::PerformanceProfile::MID, // platform::Profiler::UNKNOWN PerformanceManager::PerformancePreset::MID, // platform::Profiler::UNKNOWN
PerformanceManager::PerformanceProfile::LOW, // platform::Profiler::LOW PerformanceManager::PerformancePreset::LOW, // platform::Profiler::LOW
PerformanceManager::PerformanceProfile::MID, // platform::Profiler::MID PerformanceManager::PerformancePreset::MID, // platform::Profiler::MID
PerformanceManager::PerformanceProfile::HIGH // platform::Profiler::HIGH PerformanceManager::PerformancePreset::HIGH // platform::Profiler::HIGH
}}; }};
// What is our profile? // What is our profile?
auto platformTier = platform::Profiler::profilePlatform(); auto platformTier = platform::Profiler::profilePlatform();
// Then let's assign the performance profile setting from it // Then let's assign the performance preset setting from it
getPerformanceManager().setPerformanceProfile(platformToPerformanceProfileMap[platformTier]); getPerformanceManager().setPerformancePreset(platformToPerformancePresetMap[platformTier]);
} }

View file

@ -16,42 +16,42 @@ PerformanceManager::PerformanceManager()
{ {
} }
void PerformanceManager::setPerformanceProfile(PerformanceManager::PerformanceProfile performanceProfile) { void PerformanceManager::setPerformancePreset(PerformanceManager::PerformancePreset preset) {
if (getPerformanceProfile() != performanceProfile) { if (getPerformancePreset() != preset) {
_performanceProfileSettingLock.withWriteLock([&] { _performancePresetSettingLock.withWriteLock([&] {
_performanceProfileSetting.set((int)performanceProfile); _performancePresetSetting.set((int)preset);
}); });
applyPerformanceProfile(performanceProfile); applyPerformancePreset(preset);
} }
} }
PerformanceManager::PerformanceProfile PerformanceManager::getPerformanceProfile() const { PerformanceManager::PerformancePreset PerformanceManager::getPerformancePreset() const {
PerformanceProfile profile = PerformanceProfile::MID; PerformancePreset preset = PerformancePreset::MID;
profile = (PerformanceProfile) _performanceProfileSettingLock.resultWithReadLock<int>([&] { preset = (PerformancePreset) _performancePresetSettingLock.resultWithReadLock<int>([&] {
return _performanceProfileSetting.get(); return _performancePresetSetting.get();
}); });
return profile; return preset;
} }
void PerformanceManager::applyPerformanceProfile(PerformanceManager::PerformanceProfile performanceProfile) { void PerformanceManager::applyPerformancePreset(PerformanceManager::PerformancePreset preset) {
switch (performanceProfile) { switch (preset) {
case PerformanceProfile::HIGH: case PerformancePreset::HIGH:
RenderScriptingInterface::getInstance()->setRenderMethod(RenderScriptingInterface::RenderMethod::DEFERRED); RenderScriptingInterface::getInstance()->setRenderMethod(RenderScriptingInterface::RenderMethod::DEFERRED);
RenderScriptingInterface::getInstance()->setShadowsEnabled(true); RenderScriptingInterface::getInstance()->setShadowsEnabled(true);
qApp->getRefreshRateManager().setRefreshRateProfile(RefreshRateManager::RefreshRateProfile::INTERACTIVE); qApp->getRefreshRateManager().setRefreshRateProfile(RefreshRateManager::RefreshRateProfile::INTERACTIVE);
break; break;
case PerformanceProfile::MID: case PerformancePreset::MID:
RenderScriptingInterface::getInstance()->setRenderMethod(RenderScriptingInterface::RenderMethod::DEFERRED); RenderScriptingInterface::getInstance()->setRenderMethod(RenderScriptingInterface::RenderMethod::DEFERRED);
RenderScriptingInterface::getInstance()->setShadowsEnabled(false); RenderScriptingInterface::getInstance()->setShadowsEnabled(false);
qApp->getRefreshRateManager().setRefreshRateProfile(RefreshRateManager::RefreshRateProfile::INTERACTIVE); qApp->getRefreshRateManager().setRefreshRateProfile(RefreshRateManager::RefreshRateProfile::INTERACTIVE);
break; break;
case PerformanceProfile::LOW: case PerformancePreset::LOW:
RenderScriptingInterface::getInstance()->setRenderMethod(RenderScriptingInterface::RenderMethod::FORWARD); RenderScriptingInterface::getInstance()->setRenderMethod(RenderScriptingInterface::RenderMethod::FORWARD);
RenderScriptingInterface::getInstance()->setShadowsEnabled(false); RenderScriptingInterface::getInstance()->setShadowsEnabled(false);
qApp->getRefreshRateManager().setRefreshRateProfile(RefreshRateManager::RefreshRateProfile::ECO); qApp->getRefreshRateManager().setRefreshRateProfile(RefreshRateManager::RefreshRateProfile::ECO);

View file

@ -19,7 +19,7 @@
class PerformanceManager { class PerformanceManager {
public: public:
enum PerformanceProfile { enum PerformancePreset {
LOW = 0, LOW = 0,
MID, MID,
HIGH, HIGH,
@ -29,15 +29,15 @@ public:
PerformanceManager(); PerformanceManager();
~PerformanceManager() = default; ~PerformanceManager() = default;
void setPerformanceProfile(PerformanceProfile performanceProfile); void setPerformancePreset(PerformancePreset performancePreset);
PerformanceProfile getPerformanceProfile() const; PerformancePreset getPerformancePreset() const;
private: private:
mutable ReadWriteLockable _performanceProfileSettingLock; mutable ReadWriteLockable _performancePresetSettingLock;
Setting::Handle<int> _performanceProfileSetting { "performanceProfile", PerformanceManager::PerformanceProfile::MID }; Setting::Handle<int> _performancePresetSetting { "performancePreset", PerformanceManager::PerformancePreset::MID };
// The concrete performance profile changes // The concrete performance preset changes
void applyPerformanceProfile(PerformanceManager::PerformanceProfile performanceProfile); void applyPerformancePreset(PerformanceManager::PerformancePreset performancePreset);
}; };
#endif #endif

View file

@ -19,17 +19,17 @@ PerformanceScriptingInterface::PerformanceScriptingInterface() {
}); });
} }
void PerformanceScriptingInterface::setPerformanceProfile(PerformanceProfile performanceProfile) { void PerformanceScriptingInterface::setPerformancePreset(PerformancePreset performancePreset) {
qApp->getPerformanceManager().setPerformanceProfile((PerformanceManager::PerformanceProfile)performanceProfile); qApp->getPerformanceManager().setPerformancePreset((PerformanceManager::PerformancePreset)performancePreset);
} }
PerformanceScriptingInterface::PerformanceProfile PerformanceScriptingInterface::getPerformanceProfile() const { PerformanceScriptingInterface::PerformancePreset PerformanceScriptingInterface::getPerformancePreset() const {
return (PerformanceScriptingInterface::PerformanceProfile)qApp->getPerformanceManager().getPerformanceProfile(); return (PerformanceScriptingInterface::PerformancePreset)qApp->getPerformanceManager().getPerformancePreset();
} }
QStringList PerformanceScriptingInterface::getPerformanceProfileNames() const { QStringList PerformanceScriptingInterface::getPerformancePresetNames() const {
static const QStringList performanceProfileNames = { "Low", "Mid", "High" }; static const QStringList performancePresetNames = { "Low", "Mid", "High" };
return performanceProfileNames; return performancePresetNames;
} }
void PerformanceScriptingInterface::setRefreshRateProfile(RefreshRateProfile refreshRateProfile) { void PerformanceScriptingInterface::setRefreshRateProfile(RefreshRateProfile refreshRateProfile) {

View file

@ -22,13 +22,13 @@ class PerformanceScriptingInterface : public QObject {
Q_OBJECT Q_OBJECT
public: public:
// PerformanceManager PerformanceProfile tri state level enums // PerformanceManager PerformancePreset tri state level enums
enum PerformanceProfile { enum PerformancePreset {
LOW = PerformanceManager::PerformanceProfile::LOW, LOW = PerformanceManager::PerformancePreset::LOW,
MID = PerformanceManager::PerformanceProfile::MID, MID = PerformanceManager::PerformancePreset::MID,
HIGH = PerformanceManager::PerformanceProfile::HIGH, HIGH = PerformanceManager::PerformancePreset::HIGH,
}; };
Q_ENUM(PerformanceProfile) Q_ENUM(PerformancePreset)
// Must match RefreshRateManager enums // Must match RefreshRateManager enums
enum RefreshRateProfile { enum RefreshRateProfile {
@ -43,9 +43,9 @@ public:
public slots: public slots:
void setPerformanceProfile(PerformanceProfile performanceProfile); void setPerformancePreset(PerformancePreset performancePreset);
PerformanceProfile getPerformanceProfile() const; PerformancePreset getPerformancePreset() const;
QStringList getPerformanceProfileNames() const; QStringList getPerformancePresetNames() const;
void setRefreshRateProfile(RefreshRateProfile refreshRateProfile); void setRefreshRateProfile(RefreshRateProfile refreshRateProfile);
RefreshRateProfile getRefreshRateProfile() const; RefreshRateProfile getRefreshRateProfile() const;

View file

@ -0,0 +1,43 @@
//
// Performance Settings.qml
//
// Created by Sam Gateau on 5/28/2019
// Copyright 2019 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or https://www.apache.org/licenses/LICENSE-2.0.html
//
import QtQuick 2.7
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
import "../../lib/prop" as Prop
Column {
anchors.left: parent.left
anchors.right: parent.right
Prop.PropString {
label: "Platform Tier"
//object: Performance
valueVarSetter: function (v) {}
valueVarGetter: function () {
return PlatformInfo.getPlatformTierNames()[PlatformInfo.getTierProfiled()]; }
}
Prop.PropEnum {
label: "Performance Preset"
//object: Performance
valueVarSetter: Performance.setPerformancePreset
valueVarGetter: Performance.getPerformancePreset
enums: Performance.getPerformancePresetNames()
}
Prop.PropEnum {
label: "Refresh Rate Profile"
//object: Performance
valueVarSetter: Performance.setRefreshRateProfile
valueVarGetter: Performance.getRefreshRateProfile
enums: Performance.getRefreshRateProfileNames()
}
}

View file

@ -0,0 +1,67 @@
//
// platform.qml
//
// Created by Sam Gateau on 5/25/2019
// Copyright 2019 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or https://www.apache.org/licenses/LICENSE-2.0.html
//
import QtQuick 2.7
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
import controlsUit 1.0 as HifiControls
import "../../lib/prop" as Prop
Column {
width: parent.width
Prop.PropGroup {
id: computer
label: "Computer"
isUnfold: true
Component.onCompleted: {
computer.populateFromObjectProps(JSON.parse(PlatformInfo.getComputer()))
}
}
Prop.PropGroup {
id: cpu
label: "CPU"
isUnfold: true
Component.onCompleted: {
cpu.populateFromObjectProps(JSON.parse(PlatformInfo.getCPU(0)))
}
}
Prop.PropGroup {
id: memory
label: "Memory"
isUnfold: true
Component.onCompleted: {
memory.populateFromObjectProps(JSON.parse(PlatformInfo.getMemory()))
}
}
Prop.PropGroup {
id: gpu
label: "GPU"
isUnfold: true
Component.onCompleted: {
gpu.populateFromObjectProps(JSON.parse(PlatformInfo.getGPU(0)))
}
}
Prop.PropGroup {
id: display
label: "Display"
isUnfold: true
Component.onCompleted: {
display.populateFromObjectProps(JSON.parse(PlatformInfo.getDisplay(0)))
}
}
}

View file

@ -11,29 +11,12 @@ import QtQuick 2.7
import QtQuick.Controls 2.2 import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3 import QtQuick.Layouts 1.3
import controlsUit 1.0 as HifiControls
import "../../lib/prop" as Prop import "../../lib/prop" as Prop
Column { Column {
anchors.fill: parent anchors.left: parent.left
id: theGrapchicsSettings; anchors.right: parent.right
Prop.PropEnum {
label: "Performance Profile"
//object: Performance
valueVarSetter: Performance.setPerformanceProfile
valueVarGetter: Performance.getPerformanceProfile
enums: Performance.getPerformanceProfileNames()
}
Prop.PropEnum {
label: "Refresh Rate Profile"
//object: Performance
valueVarSetter: Performance.setRefreshRateProfile
valueVarGetter: Performance.getRefreshRateProfile
enums: Performance.getRefreshRateProfileNames()
}
Prop.PropEnum { Prop.PropEnum {
label: "Render Method" label: "Render Method"

View file

@ -4,4 +4,8 @@ ToneMapping 1.0 ToneMapping.qml
BoundingBoxes 1.0 BoundingBoxes.qml BoundingBoxes 1.0 BoundingBoxes.qml
Framebuffer 1.0 Framebuffer.qml Framebuffer 1.0 Framebuffer.qml
Antialiasing 1.0 Antialiasing.qml Antialiasing 1.0 Antialiasing.qml
Culling 1.0 Culling.qml Culling 1.0 Culling.qml
Platform 1.0 Platform.qml
RenderSettings 1.0 RenderSettings.qml
PerformanceSettings 1.0 PerformanceSettings.qml

View file

@ -0,0 +1,6 @@
var window = Desktop.createWindow(Script.resolvePath('./performanceSetup.qml'), {
title: "Performance Setup",
presentationMode: Desktop.PresentationMode.NATIVE,
size: {x: 350, y: 700}
});

View file

@ -0,0 +1,56 @@
//
// platformSetupInspector.qml
//
// Created by Sam Gateau on 5/30/2019
// Copyright 2019 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or https://www.apache.org/licenses/LICENSE-2.0.html
//
import QtQuick 2.7
import QtQuick.Controls 2.5
import QtQuick.Layouts 1.3
import controlsUit 1.0 as HifiControls
import "../lib/prop" as Prop
import "luci"
Rectangle {
anchors.fill: parent
id: platform;
Prop.Global { id: global;}
color: global.colorBack
ScrollView {
anchors.fill: parent
clip: true
Column {
anchors.left: parent.left
anchors.right: parent.right
Prop.PropFolderPanel {
label: "Performance Settings"
isUnfold: true
panelFrameData: Component {
PerformanceSettings {}
}
}
Prop.PropFolderPanel {
label: "Render Settings"
isUnfold: true
panelFrameData: Component {
RenderSettings {}
}
}
Prop.PropFolderPanel {
label: "Platform"
panelFrameData: Component {
Platform {}
}
}
}
}
}

View file

@ -10,7 +10,7 @@ PlatformInfo.getNumGPUs()
PlatformInfo.getGPU(0) PlatformInfo.getGPU(0)
// {"driver":"25.21.14.1967","model":"NVIDIA GeForce GTX 1080","vendor":"NVIDIA GeForce GTX 1080","videoMemory":8079} // {"driver":"25.21.14.1967","model":"NVIDIA GeForce GTX 1080","vendor":"NVIDIA GeForce GTX 1080","videoMemory":8079}
var window = Desktop.createWindow(Script.resolvePath('./platform.qml'), { var window = Desktop.createWindow(Script.resolvePath('./luci/Platform.qml'), {
title: "Platform", title: "Platform",
presentationMode: Desktop.PresentationMode.NATIVE, presentationMode: Desktop.PresentationMode.NATIVE,
size: {x: 350, y: 700} size: {x: 350, y: 700}

View file

@ -1,75 +0,0 @@
//
// platform.qml
//
// Created by Sam Gateau on 5/25/2019
// Copyright 2019 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or https://www.apache.org/licenses/LICENSE-2.0.html
//
import QtQuick 2.7
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
import controlsUit 1.0 as HifiControls
import "../lib/prop" as Prop
Rectangle {
anchors.fill: parent
id: platform;
Prop.Global { id: global;}
color: global.colorBack
Column {
width: parent.width
Prop.PropGroup {
id: computer
label: "Computer"
isUnfold: true
Component.onCompleted: {
computer.populateFromObjectProps(JSON.parse(PlatformInfo.getComputer()))
}
}
Prop.PropGroup {
id: cpu
label: "CPU"
isUnfold: true
Component.onCompleted: {
cpu.populateFromObjectProps(JSON.parse(PlatformInfo.getCPU(0)))
}
}
Prop.PropGroup {
id: memory
label: "Memory"
isUnfold: true
Component.onCompleted: {
memory.populateFromObjectProps(JSON.parse(PlatformInfo.getMemory()))
}
}
Prop.PropGroup {
id: gpu
label: "GPU"
isUnfold: true
Component.onCompleted: {
gpu.populateFromObjectProps(JSON.parse(PlatformInfo.getGPU(0)))
}
}
Prop.PropGroup {
id: display
label: "Display"
isUnfold: true
Component.onCompleted: {
display.populateFromObjectProps(JSON.parse(PlatformInfo.getDisplay(0)))
}
}
}
}