mirror of
https://github.com/Lurkki14/tuxclocker.git
synced 2025-02-25 18:55:24 -06:00
Apply values in pstate dialog and add error checking
This commit is contained in:
parent
85464d12a4
commit
7c3828fdf7
91
amd.cpp
91
amd.cpp
@ -275,6 +275,14 @@ QString amd::applySettings(int GPUIndex)
|
|||||||
}
|
}
|
||||||
// Core clock/voltage
|
// Core clock/voltage
|
||||||
if ((coreClockSlider->value() != GPUList[GPUIndex].coreclocks.last()) || (voltageSlider->value() != GPUList[GPUIndex].corevolts.last())) {
|
if ((coreClockSlider->value() != GPUList[GPUIndex].coreclocks.last()) || (voltageSlider->value() != GPUList[GPUIndex].corevolts.last())) {
|
||||||
|
queryPstates();
|
||||||
|
if ((coreClockSlider->value() != GPUList[GPUIndex].coreclocks.last()) || (voltageSlider->value() != GPUList[GPUIndex].corevolts.last())) {
|
||||||
|
hadErrors = true;
|
||||||
|
errStr.append("Core pstate, ");
|
||||||
|
} else {
|
||||||
|
latestVoltageSlider = voltageSlider->value();
|
||||||
|
latestCoreClkSlider = coreClockSlider->value();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hadErrors) {
|
if (hadErrors) {
|
||||||
@ -305,9 +313,12 @@ void amd::queryGPUFeatures()
|
|||||||
int breakcount = 0;
|
int breakcount = 0;
|
||||||
QString path;
|
QString path;
|
||||||
QString line;
|
QString line;
|
||||||
|
|
||||||
|
queryPstates();
|
||||||
|
|
||||||
for (int i=0; i<gpuCount; i++) {
|
for (int i=0; i<gpuCount; i++) {
|
||||||
if (GPUList[i].gputype == Type::AMDGPU) {
|
if (GPUList[i].gputype == Type::AMDGPU) {
|
||||||
path = "/sys/class/drm/card"+QString::number(GPUList[i].fsindex)+"/device/pp_od_clk_voltage";
|
/*path = "/sys/class/drm/card"+QString::number(GPUList[i].fsindex)+"/device/pp_od_clk_voltage";
|
||||||
QFile tablefile(path);
|
QFile tablefile(path);
|
||||||
bool ret = tablefile.open(QFile::ReadOnly | QFile::Text);
|
bool ret = tablefile.open(QFile::ReadOnly | QFile::Text);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
@ -369,7 +380,7 @@ void amd::queryGPUFeatures()
|
|||||||
breakcount++;
|
breakcount++;
|
||||||
}
|
}
|
||||||
tablefile.close();
|
tablefile.close();
|
||||||
}
|
}*/
|
||||||
// If the pstate vectors are empty after searching, set the features disabled
|
// If the pstate vectors are empty after searching, set the features disabled
|
||||||
if (!GPUList[i].corevolts.isEmpty()) GPUList[i].overVoltAvailable = true;
|
if (!GPUList[i].corevolts.isEmpty()) GPUList[i].overVoltAvailable = true;
|
||||||
|
|
||||||
@ -452,6 +463,82 @@ void amd::queryGPUFeatures()
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
void amd::queryPstates()
|
||||||
|
{
|
||||||
|
QString path;
|
||||||
|
int breakcount = 0;
|
||||||
|
QString line;
|
||||||
|
int column = 0;
|
||||||
|
int type = 0;
|
||||||
|
QRegularExpression numexp("\\d+\\d");
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
void amd::queryGPUVoltage(int GPUIndex)
|
void amd::queryGPUVoltage(int GPUIndex)
|
||||||
{
|
{
|
||||||
int ret = amdgpu_query_sensor_info(*GPUList[GPUIndex].dev,
|
int ret = amdgpu_query_sensor_info(*GPUList[GPUIndex].dev,
|
||||||
|
@ -168,7 +168,7 @@ bool amdPstateEditor::applyValues()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!changedMemPstates.isEmpty() || !changedCorePstates.isEmpty()) {
|
if (!changedMemPstates.isEmpty() || !changedCorePstates.isEmpty()) {
|
||||||
cmd.append("\"");
|
cmd.append("echo 'c' > /sys/class/drm/card" + QString::number(types->GPUList[gpuidx].fsindex) + "/device_pp_od_clk_voltage\"");
|
||||||
proc.start(cmd);
|
proc.start(cmd);
|
||||||
proc.waitForFinished(-1);
|
proc.waitForFinished(-1);
|
||||||
if (proc.exitCode() != 0) {
|
if (proc.exitCode() != 0) {
|
||||||
|
@ -282,6 +282,7 @@ public slots:
|
|||||||
bool assignGPUMemClockOffset(int GPUIndex, int targetValue);
|
bool assignGPUMemClockOffset(int GPUIndex, int targetValue);
|
||||||
bool assignGPUVoltageOffset(int GPUIndex, int targetValue);
|
bool assignGPUVoltageOffset(int GPUIndex, int targetValue);
|
||||||
bool assignGPUPowerLimit(int GPUIndex, uint targetValue);
|
bool assignGPUPowerLimit(int GPUIndex, uint targetValue);
|
||||||
|
void queryPstates();
|
||||||
private slots:
|
private slots:
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user