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
// Here is the mapping between pelatformTIer and performance profile
const std::array<PerformanceManager::PerformanceProfile, platform::Profiler::NumTiers> platformToPerformanceProfileMap = {{
PerformanceManager::PerformanceProfile::MID, // platform::Profiler::UNKNOWN
PerformanceManager::PerformanceProfile::LOW, // platform::Profiler::LOW
PerformanceManager::PerformanceProfile::MID, // platform::Profiler::MID
PerformanceManager::PerformanceProfile::HIGH // platform::Profiler::HIGH
const std::array<PerformanceManager::PerformancePreset, platform::Profiler::NumTiers> platformToPerformancePresetMap = {{
PerformanceManager::PerformancePreset::MID, // platform::Profiler::UNKNOWN
PerformanceManager::PerformancePreset::LOW, // platform::Profiler::LOW
PerformanceManager::PerformancePreset::MID, // platform::Profiler::MID
PerformanceManager::PerformancePreset::HIGH // platform::Profiler::HIGH
}};
// What is our profile?
auto platformTier = platform::Profiler::profilePlatform();
// Then let's assign the performance profile setting from it
getPerformanceManager().setPerformanceProfile(platformToPerformanceProfileMap[platformTier]);
// Then let's assign the performance preset setting from it
getPerformanceManager().setPerformancePreset(platformToPerformancePresetMap[platformTier]);
}

View file

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

View file

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

View file

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

View file

@ -22,13 +22,13 @@ class PerformanceScriptingInterface : public QObject {
Q_OBJECT
public:
// PerformanceManager PerformanceProfile tri state level enums
enum PerformanceProfile {
LOW = PerformanceManager::PerformanceProfile::LOW,
MID = PerformanceManager::PerformanceProfile::MID,
HIGH = PerformanceManager::PerformanceProfile::HIGH,
// PerformanceManager PerformancePreset tri state level enums
enum PerformancePreset {
LOW = PerformanceManager::PerformancePreset::LOW,
MID = PerformanceManager::PerformancePreset::MID,
HIGH = PerformanceManager::PerformancePreset::HIGH,
};
Q_ENUM(PerformanceProfile)
Q_ENUM(PerformancePreset)
// Must match RefreshRateManager enums
enum RefreshRateProfile {
@ -43,9 +43,9 @@ public:
public slots:
void setPerformanceProfile(PerformanceProfile performanceProfile);
PerformanceProfile getPerformanceProfile() const;
QStringList getPerformanceProfileNames() const;
void setPerformancePreset(PerformancePreset performancePreset);
PerformancePreset getPerformancePreset() const;
QStringList getPerformancePresetNames() const;
void setRefreshRateProfile(RefreshRateProfile refreshRateProfile);
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.Layouts 1.3
import controlsUit 1.0 as HifiControls
import "../../lib/prop" as Prop
Column {
anchors.fill: parent
id: theGrapchicsSettings;
anchors.left: parent.left
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 {
label: "Render Method"

View file

@ -4,4 +4,8 @@ ToneMapping 1.0 ToneMapping.qml
BoundingBoxes 1.0 BoundingBoxes.qml
Framebuffer 1.0 Framebuffer.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)
// {"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",
presentationMode: Desktop.PresentationMode.NATIVE,
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)))
}
}
}
}