From 882a37dff2a041959acdcb79f17b519ccdb7cdcf Mon Sep 17 00:00:00 2001 From: jussi Date: Sun, 10 Feb 2019 11:59:33 +0200 Subject: [PATCH] Add AMD placeholder functions --- amd.cpp | 37 +++++++++++++++++++++++++++++++++++++ gputypes.h | 44 +++++++++++++++++++++++++++++++++++++++++++- mainwindow.cpp | 11 ++++++++--- mainwindow.h | 3 +++ rojekti.pro | 8 +++++--- 5 files changed, 96 insertions(+), 7 deletions(-) create mode 100644 amd.cpp diff --git a/amd.cpp b/amd.cpp new file mode 100644 index 0000000..18bbabe --- /dev/null +++ b/amd.cpp @@ -0,0 +1,37 @@ +#ifdef AMD +#include "gputypes.h" + +amd::amd() {} +bool amd::setupGPU() +{ + return true; +} +bool amd::setupGPUSecondary(int GPUIndex){return true;} +void amd::queryGPUCount(){} +void amd::queryGPUNames(){} +void amd::queryGPUUIDs(){} +void amd::queryGPUFeatures(){} +void amd::queryGPUVoltage(int GPUIndex){} +void amd::queryGPUTemp(int GPUIndex){} +void amd::queryGPUFrequencies(int GPUIndex){} +void amd::queryGPUFanSpeed(int GPUIndex){} +void amd::queryGPUUsedVRAM(int GPUIndex){} +void amd::queryGPUFreqOffset(int GPUIndex){} +void amd::queryGPUMemClkOffset(int GPUIndex){} +void amd::queryGPUVoltageOffset(int GPUIndex){} + +void amd::queryGPUUtils(int GPUIndex){} +void amd::queryGPUPowerDraw(int GPUIndex){} +void amd::queryGPUPowerLimit(int GPUIndex){} +void amd::queryGPUPowerLimitLimits(int GPUIndex){} +void amd::queryGPUCurrentMaxClocks(int GPUIndex){} +void amd::queryGPUPowerLimitAvailability(int GPUIndex){} + +bool amd::assignGPUFanSpeed(int GPUIndex, int targetValue){} +bool amd::assignGPUFanCtlMode(int GPUIndex, bool manual){} +bool amd::assignGPUFreqOffset(int GPUIndex, int targetValue){} +bool amd::assignGPUMemClockOffset(int GPUIndex, int targetValue){} +bool amd::assignGPUVoltageOffset(int GPUIndex, int targetValue){} +bool amd::assignGPUPowerLimit(uint targetValue){} + +#endif diff --git a/gputypes.h b/gputypes.h index 5beb203..424b26b 100644 --- a/gputypes.h +++ b/gputypes.h @@ -14,7 +14,7 @@ class gputypes : public QObject Q_OBJECT public: gputypes(); - enum Type{NV, AMD}; + //enum Type{NV, AMD}; struct GPU { int gputype; @@ -137,4 +137,46 @@ public slots: private slots: }; #endif + +#ifdef AMD +class amd : public gputypes +{ + Q_OBJECT +public: + amd(); +signals: +public slots: + bool setupGPU(); + bool setupGPUSecondary(int GPUIndex); + void queryGPUCount(); + void queryGPUNames(); + void queryGPUUIDs(); + void queryGPUFeatures(); + void queryGPUVoltage(int GPUIndex); + void queryGPUTemp(int GPUIndex); + void queryGPUFrequencies(int GPUIndex); + void queryGPUFanSpeed(int GPUIndex); + void queryGPUUsedVRAM(int GPUIndex); + void queryGPUFreqOffset(int GPUIndex); + void queryGPUMemClkOffset(int GPUIndex); + void queryGPUVoltageOffset(int GPUIndex); + + void queryGPUUtils(int GPUIndex); + void queryGPUPowerDraw(int GPUIndex); + void queryGPUPowerLimit(int GPUIndex); + void queryGPUPowerLimitLimits(int GPUIndex); + void queryGPUCurrentMaxClocks(int GPUIndex); + void queryGPUPowerLimitAvailability(int GPUIndex); + + bool assignGPUFanSpeed(int GPUIndex, int targetValue); + bool assignGPUFanCtlMode(int GPUIndex, bool manual); + bool assignGPUFreqOffset(int GPUIndex, int targetValue); + bool assignGPUMemClockOffset(int GPUIndex, int targetValue); + bool assignGPUVoltageOffset(int GPUIndex, int targetValue); + // NVML functions know the GPU index already based on the dev object passed in setupNVML() + bool assignGPUPowerLimit(uint targetValue); +private slots: +}; +#endif + #endif // GPUTYPES_H diff --git a/mainwindow.cpp b/mainwindow.cpp index bd27bc4..599bc2e 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -22,12 +22,16 @@ MainWindow::MainWindow(QWidget *parent) : #ifdef NVIDIA nv = new nvidia; types = nv; +#endif +#ifdef AMD + amdptr = new amd; + types = amdptr; #endif // This is for libxnvctrl types->setupGPU(); // This is for NVML types->setupGPUSecondary(currentGPUIndex); - types->queryGPUFeatures(); + /*types->queryGPUFeatures(); types->queryGPUFreqOffset(currentGPUIndex); types->queryGPUMemClkOffset(currentGPUIndex); types->queryGPUVoltageOffset(currentGPUIndex); @@ -39,10 +43,11 @@ MainWindow::MainWindow(QWidget *parent) : for (int i=0; igpuCount; i++) { ui->GPUComboBox->addItem("GPU-" + QString::number(i) + ": " + types->GPUList[i].name); } + */ loadProfileSettings(); setupMonitorTab(); setupGraphMonitorTab(); - + /* // Enable sliders according to GPU properties if (types->GPUList[currentGPUIndex].overClockAvailable) { ui->frequencySlider->setRange(types->GPUList[currentGPUIndex].minCoreClkOffset, types->GPUList[currentGPUIndex].maxCoreClkOffset); @@ -103,7 +108,7 @@ MainWindow::MainWindow(QWidget *parent) : manualMode->setEnabled(false); manualMode->setToolTip("Manual fan control is not available for current GPU"); } - + */ connect(fanUpdateTimer, SIGNAL(timeout()), this, SLOT(fanSpeedUpdater())); fanUpdateTimer->start(2000); diff --git a/mainwindow.h b/mainwindow.h index 1daa522..5b0ba67 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -157,6 +157,9 @@ private: QString latestUUID; #ifdef NVIDIA nvidia *nv; +#endif +#ifdef AMD + amd *amdptr; #endif gputypes *types; diff --git a/rojekti.pro b/rojekti.pro index 7b18be0..72de848 100644 --- a/rojekti.pro +++ b/rojekti.pro @@ -27,7 +27,8 @@ CONFIG (release, debug|release) { DEFINES += QT_NO_DEBUG_OUTPUT } -DEFINES += NVIDIA +#DEFINES += NVIDIA +DEFINES += AMD SOURCES += \ main.cpp \ @@ -37,7 +38,8 @@ SOURCES += \ newprofile.cpp \ plotwidget.cpp \ nvidia.cpp \ - gputypes.cpp + gputypes.cpp \ + amd.cpp HEADERS += \ mainwindow.h \ @@ -58,7 +60,7 @@ FORMS += \ INCLUDEPATH += "/usr/lib" INCLUDEPATH += $$(INCLUDEPATH) -LIBS += -lXext -lXNVCtrl -lX11 -lnvidia-ml +#LIBS += -lXext -lXNVCtrl -lX11 -lnvidia-ml # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin