mirror of
https://github.com/Lurkki14/tuxclocker.git
synced 2025-02-16 14:34:46 -06:00
start adding pstate editor
This commit is contained in:
parent
bb631e6952
commit
b0c28bd055
15
amd.cpp
15
amd.cpp
@ -53,6 +53,7 @@ bool amd::setupGPU()
|
||||
char tempname[64];
|
||||
strcpy(tempname, name);
|
||||
gpu.name = tempname;
|
||||
gpu.displayName = QString::fromUtf8(name);
|
||||
gpu.dev = &handle;
|
||||
qDebug() << gpu.name;
|
||||
gpuCount++;
|
||||
@ -73,6 +74,20 @@ bool amd::setupGPU()
|
||||
}
|
||||
return retb;
|
||||
}
|
||||
void amd::calculateUIProperties(int GPUIndex)
|
||||
{
|
||||
GPUList[GPUIndex].voltageSliderMin = GPUList[GPUIndex].minVoltageLimit;
|
||||
GPUList[GPUIndex].voltageSliderMax = GPUList[GPUIndex].maxVoltageLimit;
|
||||
|
||||
GPUList[GPUIndex].coreClkSliderMin = GPUList[GPUIndex].minCoreClkLimit;
|
||||
GPUList[GPUIndex].coreClkSliderMax = GPUList[GPUIndex].maxCoreClkLimit;
|
||||
|
||||
GPUList[GPUIndex].memClkSliderMin = GPUList[GPUIndex].minMemClkLimit;
|
||||
GPUList[GPUIndex].memClkSliderMax = GPUList[GPUIndex].maxMemClkLimit;
|
||||
|
||||
GPUList[GPUIndex].powerLimSliderMax = static_cast<int>(GPUList[GPUIndex].maxPowerLim);
|
||||
GPUList[GPUIndex].powerLimSliderMin = static_cast<int>(GPUList[GPUIndex].minPowerLim);
|
||||
}
|
||||
bool amd::setupGPUSecondary(int GPUIndex){return true;}
|
||||
void amd::queryGPUCount(){}
|
||||
void amd::queryGPUNames()
|
||||
|
26
amdpstateeditor.cpp
Normal file
26
amdpstateeditor.cpp
Normal file
@ -0,0 +1,26 @@
|
||||
#include "amdpstateeditor.h"
|
||||
#include "ui_amdpstateeditor.h"
|
||||
|
||||
amdPstateEditor::amdPstateEditor(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::amdPstateEditor)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
generateUI();
|
||||
}
|
||||
|
||||
amdPstateEditor::~amdPstateEditor()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
void amdPstateEditor::generateUI()
|
||||
{
|
||||
QHBoxLayout *coreClkPstateLayout = new QHBoxLayout;
|
||||
for (int i=0; i<5; i++) {
|
||||
QSlider *sl = new QSlider;
|
||||
sl->setOrientation(Qt::Vertical);
|
||||
coreClkPstateLayout->addWidget(sl);
|
||||
}
|
||||
ui->coreClkPstateView->setLayout(coreClkPstateLayout);
|
||||
ui->memClkPstateView->setLayout(coreClkPstateLayout);
|
||||
}
|
27
amdpstateeditor.h
Normal file
27
amdpstateeditor.h
Normal file
@ -0,0 +1,27 @@
|
||||
#ifndef AMDPSTATEEDITOR_H
|
||||
#define AMDPSTATEEDITOR_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QWidget>
|
||||
#include <QSlider>
|
||||
#include <QHBoxLayout>
|
||||
#include "gputypes.h"
|
||||
|
||||
namespace Ui {
|
||||
class amdPstateEditor;
|
||||
}
|
||||
|
||||
class amdPstateEditor : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit amdPstateEditor(QWidget *parent = nullptr);
|
||||
~amdPstateEditor();
|
||||
|
||||
private:
|
||||
Ui::amdPstateEditor *ui;
|
||||
void generateUI();
|
||||
};
|
||||
|
||||
#endif // AMDPSTATEEDITOR_H
|
35
amdpstateeditor.ui
Normal file
35
amdpstateeditor.ui
Normal file
@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>amdPstateEditor</class>
|
||||
<widget class="QDialog" name="amdPstateEditor">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>713</width>
|
||||
<height>550</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QWidget" name="coreClkPstateView" native="true">
|
||||
<widget class="QWidget" name="memClkPstateView" native="true">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>60</x>
|
||||
<y>320</y>
|
||||
<width>571</width>
|
||||
<height>201</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
16
gputypes.h
16
gputypes.h
@ -28,6 +28,17 @@ public:
|
||||
enum Type{NV, AMDGPU};
|
||||
struct GPU
|
||||
{
|
||||
// UI variables
|
||||
int powerLimSliderMin;
|
||||
int powerLimSliderMax;
|
||||
int memClkSliderMin;
|
||||
int memClkSliderMax;
|
||||
int coreClkSliderMin;
|
||||
int coreClkSliderMax;
|
||||
int voltageSliderMax;
|
||||
int voltageSliderMin;
|
||||
QString displayName;
|
||||
|
||||
int gputype;
|
||||
char *name;
|
||||
char *uuid;
|
||||
@ -93,7 +104,7 @@ public:
|
||||
nvmlDevice_t *device;
|
||||
#endif
|
||||
|
||||
|
||||
virtual void calculateUIProperties(int GPUIndex) = 0;
|
||||
|
||||
virtual bool setupGPU() = 0;
|
||||
virtual bool setupGPUSecondary(int GPUIndex) = 0;
|
||||
@ -135,6 +146,8 @@ public:
|
||||
nvidia();
|
||||
signals:
|
||||
public slots:
|
||||
void calculateUIProperties();
|
||||
|
||||
bool setupGPU();
|
||||
bool setupGPUSecondary(int GPUIndex);
|
||||
void queryGPUCount();
|
||||
@ -176,6 +189,7 @@ public:
|
||||
amd();
|
||||
signals:
|
||||
public slots:
|
||||
void calculateUIProperties(int GPUIndex);
|
||||
bool setupGPU();
|
||||
bool setupGPUSecondary(int GPUIndex);
|
||||
void queryGPUCount();
|
||||
|
@ -39,9 +39,12 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
types->queryGPUPowerLimitAvailability(currentGPUIndex);
|
||||
types->queryGPUPowerLimitLimits(currentGPUIndex);
|
||||
types->queryGPUCurrentMaxClocks(currentGPUIndex);
|
||||
if (types->GPUList[currentGPUIndex].gputype == types->AMDGPU) {
|
||||
types->calculateUIProperties(currentGPUIndex);
|
||||
}
|
||||
// Populate the GPU combo box
|
||||
for (int i=0; i<types->gpuCount; i++) {
|
||||
ui->GPUComboBox->addItem("GPU-" + QString::number(i) + ": " + types->GPUList[i].name);
|
||||
ui->GPUComboBox->addItem("GPU-" + QString::number(i) + ": " + types->GPUList[i].displayName);
|
||||
}
|
||||
/*
|
||||
loadProfileSettings();
|
||||
@ -103,17 +106,18 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
}*/
|
||||
|
||||
// Testing code
|
||||
ui->voltageSlider->setRange(types->GPUList[currentGPUIndex].minVoltageLimit, types->GPUList[currentGPUIndex].maxVoltageOffset);
|
||||
ui->voltageSpinBox->setRange(types->GPUList[currentGPUIndex].minVoltageLimit, types->GPUList[currentGPUIndex].maxVoltageOffset);
|
||||
|
||||
ui->powerLimSlider->setRange(types->GPUList[currentGPUIndex].minPowerLim, types->GPUList[currentGPUIndex].maxPowerLim);
|
||||
ui->powerLimSpinBox->setRange(types->GPUList[currentGPUIndex].minPowerLim, types->GPUList[currentGPUIndex].maxPowerLim);
|
||||
ui->voltageSlider->setRange(types->GPUList[currentGPUIndex].voltageSliderMin, types->GPUList[currentGPUIndex].voltageSliderMax);
|
||||
ui->voltageSpinBox->setRange(types->GPUList[currentGPUIndex].voltageSliderMin, types->GPUList[currentGPUIndex].voltageSliderMax);
|
||||
|
||||
ui->frequencySpinBox->setRange(types->GPUList[currentGPUIndex].minCoreClkLimit, types->GPUList[currentGPUIndex].maxCoreClkLimit);
|
||||
ui->frequencySlider->setRange(types->GPUList[currentGPUIndex].minCoreClkLimit, types->GPUList[currentGPUIndex].maxCoreClkLimit);
|
||||
ui->powerLimSlider->setRange(types->GPUList[currentGPUIndex].powerLimSliderMin, types->GPUList[currentGPUIndex].powerLimSliderMax);
|
||||
ui->powerLimSpinBox->setRange(types->GPUList[currentGPUIndex].powerLimSliderMin, types->GPUList[currentGPUIndex].powerLimSliderMax);
|
||||
|
||||
ui->memClkSlider->setRange(types->GPUList[currentGPUIndex].minMemClkLimit, types->GPUList[currentGPUIndex].maxMemClkLimit);
|
||||
ui->memClkSpinBox->setRange(types->GPUList[currentGPUIndex].minMemClkLimit, types->GPUList[currentGPUIndex].maxMemClkLimit);
|
||||
ui->frequencySpinBox->setRange(types->GPUList[currentGPUIndex].coreClkSliderMin, types->GPUList[currentGPUIndex].coreClkSliderMax);
|
||||
ui->frequencySlider->setRange(types->GPUList[currentGPUIndex].coreClkSliderMin, types->GPUList[currentGPUIndex].coreClkSliderMin);
|
||||
|
||||
ui->memClkSlider->setRange(types->GPUList[currentGPUIndex].memClkSliderMin, types->GPUList[currentGPUIndex].memClkSliderMax);
|
||||
ui->memClkSpinBox->setRange(types->GPUList[currentGPUIndex].memClkSliderMin, types->GPUList[currentGPUIndex].memClkSliderMax);
|
||||
|
||||
/*ui->memClkSlider->setValue(types->GPUList[currentGPUIndex].memclocks[types->GPUList[currentGPUIndex].memclocks.size()-1]);
|
||||
ui->frequencySlider->setValue(types->GPUList[currentGPUIndex].corecloks[types->GPUList[currentGPUIndex].corecloks.size()-1]);
|
||||
@ -1102,3 +1106,10 @@ void MainWindow::on_GPUComboBox_currentIndexChanged(int index)
|
||||
curmaxmemclk->setText(1, QString::number(types->GPUList[index].maxMemClk) + "MHz");
|
||||
curmaxclk->setText(1, QString::number(types->GPUList[index].maxCoreClk) + "MHz");
|
||||
}
|
||||
|
||||
void MainWindow::on_amdPstateButton_pressed()
|
||||
{
|
||||
amdPstateEditor *ps = new amdPstateEditor;
|
||||
ps->setModal(false);
|
||||
ps->exec();
|
||||
}
|
||||
|
@ -7,6 +7,9 @@
|
||||
#include <QList>
|
||||
#include <QByteArray>
|
||||
#include "gputypes.h"
|
||||
#ifdef AMD
|
||||
#include "amdpstateeditor.h"
|
||||
#endif
|
||||
|
||||
namespace Ui {
|
||||
class MainWindow;
|
||||
@ -149,6 +152,8 @@ private slots:
|
||||
|
||||
void on_GPUComboBox_currentIndexChanged(int index);
|
||||
|
||||
void on_amdPstateButton_pressed();
|
||||
|
||||
private:
|
||||
Ui::MainWindow *ui;
|
||||
bool noProfiles = true;
|
||||
|
@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>507</width>
|
||||
<height>672</height>
|
||||
<width>517</width>
|
||||
<height>677</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@ -173,6 +173,13 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="5">
|
||||
<widget class="QPushButton" name="amdPstateButton">
|
||||
<property name="text">
|
||||
<string>Edit Pstates</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="monitorTab">
|
||||
@ -216,7 +223,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>507</width>
|
||||
<width>517</width>
|
||||
<height>28</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
@ -5,6 +5,10 @@
|
||||
|
||||
nvidia::nvidia()
|
||||
{
|
||||
}
|
||||
void nvidia::calculateUIProperties()
|
||||
{
|
||||
|
||||
}
|
||||
bool nvidia::setupGPU()
|
||||
{
|
||||
|
@ -39,7 +39,8 @@ SOURCES += \
|
||||
plotwidget.cpp \
|
||||
nvidia.cpp \
|
||||
gputypes.cpp \
|
||||
amd.cpp
|
||||
amd.cpp \
|
||||
amdpstateeditor.cpp
|
||||
|
||||
HEADERS += \
|
||||
mainwindow.h \
|
||||
@ -51,11 +52,13 @@ HEADERS += \
|
||||
nvml.h \
|
||||
gputypes.h \
|
||||
#xlibvars.h
|
||||
amdpstateeditor.h
|
||||
|
||||
FORMS += \
|
||||
mainwindow.ui \
|
||||
editprofile.ui \
|
||||
newprofile.ui
|
||||
newprofile.ui \
|
||||
amdpstateeditor.ui
|
||||
|
||||
INCLUDEPATH += "/usr/lib"
|
||||
INCLUDEPATH += $$(INCLUDEPATH)
|
||||
|
Loading…
Reference in New Issue
Block a user