mirror of
https://github.com/Lurkki14/tuxclocker.git
synced 2024-11-28 02:43:49 -06:00
Load pstates from settings in the editor
This commit is contained in:
parent
90d7741840
commit
360f387755
63
amd.cpp
63
amd.cpp
@ -420,69 +420,6 @@ void amd::queryGPUFeatures()
|
||||
|
||||
for (int i=0; i<gpuCount; i++) {
|
||||
if (GPUList[i].gputype == Type::AMDGPU) {
|
||||
/*path = "/sys/class/drm/card"+QString::number(GPUList[i].fsindex)+"/device/pp_od_clk_voltage";
|
||||
QFile tablefile(path);
|
||||
bool ret = tablefile.open(QFile::ReadOnly | QFile::Text);
|
||||
if (ret) {
|
||||
QTextStream str(&tablefile);
|
||||
while (!str.atEnd() && breakcount < 30) {
|
||||
line = str.readLine();
|
||||
if (line.contains("OD_SCLK")) type = 1;
|
||||
if (line.contains("OD_MCLK")) type = 2;
|
||||
if (line.contains("OD_RANGE")) type = 3;
|
||||
QRegularExpressionMatchIterator iter = numexp.globalMatch(line);
|
||||
// Read all matches for the line
|
||||
while (iter.hasNext()) {
|
||||
QRegularExpressionMatch nummatch = iter.next();
|
||||
QString capline = nummatch.captured();
|
||||
int num = capline.toInt();
|
||||
|
||||
if (type == 1) {
|
||||
if (column == 0) {
|
||||
GPUList[i].coreclocks.append(num);
|
||||
} else {
|
||||
GPUList[i].corevolts.append(num);
|
||||
}
|
||||
}
|
||||
|
||||
if (type == 2) {
|
||||
if (column == 0) {
|
||||
GPUList[i].memclocks.append(num);
|
||||
} else {
|
||||
GPUList[i].memvolts.append(num);
|
||||
}
|
||||
}
|
||||
|
||||
if (type == 3) {
|
||||
if (line.contains("sclk", Qt::CaseInsensitive)) {
|
||||
if (column == 0) {
|
||||
GPUList[i].minCoreClkLimit = num;
|
||||
} else {
|
||||
GPUList[i].maxCoreClkLimit = num;
|
||||
}
|
||||
}
|
||||
if (line.contains("mclk", Qt::CaseInsensitive)) {
|
||||
if (column == 0) {
|
||||
GPUList[i].minMemClkLimit = num;
|
||||
} else {
|
||||
GPUList[i].maxMemClkLimit = num;
|
||||
}
|
||||
}
|
||||
if (line.contains("vdd", Qt::CaseInsensitive)) {
|
||||
if (column == 0) {
|
||||
GPUList[i].minVoltageLimit = num;
|
||||
} else {
|
||||
GPUList[i].maxVoltageLimit = num;
|
||||
}
|
||||
}
|
||||
}
|
||||
column++;
|
||||
}
|
||||
column = 0;
|
||||
breakcount++;
|
||||
}
|
||||
tablefile.close();
|
||||
}*/
|
||||
// If the pstate vectors are empty after searching, set the features disabled
|
||||
if (!GPUList[i].corevolts.isEmpty()) GPUList[i].overVoltAvailable = true;
|
||||
else GPUList[i].overVoltAvailable = false;
|
||||
|
@ -16,11 +16,11 @@ void amdPstateEditor::generateUI(gputypes *newtypes, int GPUIndex)
|
||||
{
|
||||
types = newtypes;
|
||||
gpuidx = GPUIndex;
|
||||
qDebug() << newtypes->gpuCount << "gpus in pointer";
|
||||
QWidget *lower = new QWidget;
|
||||
QWidget *upper = new QWidget;
|
||||
QHBoxLayout *ulo = new QHBoxLayout;
|
||||
QHBoxLayout *llo = new QHBoxLayout;
|
||||
|
||||
for (int i=0; i<newtypes->GPUList[gpuidx].coreclocks.size(); i++) {
|
||||
corePstate state;
|
||||
QGridLayout *glo = new QGridLayout;
|
||||
@ -105,6 +105,41 @@ void amdPstateEditor::generateUI(gputypes *newtypes, int GPUIndex)
|
||||
state.freqspinbox = freqspinbox;
|
||||
memPstates.append(state);
|
||||
}
|
||||
|
||||
// Load the existing changes from settings
|
||||
QSettings settings("tuxclocker");
|
||||
QString profile = settings.value("currentProfile").toString();
|
||||
QString UUID = settings.value("latestUUID").toString();
|
||||
settings.beginGroup(profile);
|
||||
settings.beginGroup(UUID);
|
||||
// Read memory pstates
|
||||
settings.beginGroup("memPstates");
|
||||
// Get the indices of pstates
|
||||
QStringList memPstateIndices = settings.childGroups();
|
||||
for (int i=0; i<memPstateIndices.size(); i++) {
|
||||
settings.beginGroup(memPstateIndices[i]);
|
||||
// Set the appropriate slider values for the pstate
|
||||
int frequency = settings.value("frequency").toInt();
|
||||
int voltage = settings.value("voltage").toInt();
|
||||
memPstates[memPstateIndices[i].toInt()].freqspinbox->setValue(frequency);
|
||||
memPstates[memPstateIndices[i].toInt()].voltspinbox->setValue(voltage);
|
||||
settings.endGroup();
|
||||
}
|
||||
settings.endGroup();
|
||||
|
||||
// Read core pstates
|
||||
settings.beginGroup("corePstates");
|
||||
QStringList corePstateIndices = settings.childGroups();
|
||||
for (int i=0; i<corePstateIndices.size(); i++) {
|
||||
settings.beginGroup(corePstateIndices[i]);
|
||||
int frequency = settings.value("frequency").toInt();
|
||||
int voltage = settings.value("voltage").toInt();
|
||||
corePstates[corePstateIndices[i].toInt()].freqspinbox->setValue(frequency);
|
||||
corePstates[corePstateIndices[i].toInt()].voltspinbox->setValue(voltage);
|
||||
settings.endGroup();
|
||||
}
|
||||
settings.endGroup();
|
||||
|
||||
QWidget *buttonwidget = new QWidget;
|
||||
QVBoxLayout *buttonlo = new QVBoxLayout;
|
||||
// Add an apply button
|
||||
|
@ -81,6 +81,7 @@ editProfile::editProfile(QWidget *parent, int GPUIndex, gputypes *types) :
|
||||
QString UUID = settings.value("latestUUID").toString();
|
||||
settings.beginGroup(profile);
|
||||
settings.beginGroup(UUID);
|
||||
|
||||
int size = settings.beginReadArray("curvepoints");
|
||||
for (int i=0; i<size; i++) {
|
||||
settings.setArrayIndex(i);
|
||||
|
Loading…
Reference in New Issue
Block a user