mirror of
https://github.com/Lurkki14/tuxclocker.git
synced 2025-02-25 18:55:24 -06:00
crash fix
This commit is contained in:
parent
b47de54ac9
commit
377dd332a4
36
amd.cpp
36
amd.cpp
@ -30,7 +30,7 @@ bool amd::setupGPU()
|
|||||||
amdgpu_device_handle handle;
|
amdgpu_device_handle handle;
|
||||||
int ret = amdgpu_device_initialize(fd, &major, &minor, &handle);
|
int ret = amdgpu_device_initialize(fd, &major, &minor, &handle);
|
||||||
qDebug() << major;
|
qDebug() << major;
|
||||||
if (ret > -1) {
|
if (ret == 0) {
|
||||||
// Create a gpu object with the correct paremeters
|
// Create a gpu object with the correct paremeters
|
||||||
GPU gpu;
|
GPU gpu;
|
||||||
gpu.fsindex = i;
|
gpu.fsindex = i;
|
||||||
@ -56,8 +56,14 @@ bool amd::setupGPU()
|
|||||||
gpu.displayName = QString::fromUtf8(name);
|
gpu.displayName = QString::fromUtf8(name);
|
||||||
gpu.dev = &handle;
|
gpu.dev = &handle;
|
||||||
qDebug() << gpu.name;
|
qDebug() << gpu.name;
|
||||||
gpuCount++;
|
|
||||||
|
int reading = 0;
|
||||||
|
uint size = sizeof (int);
|
||||||
|
ret = amdgpu_query_sensor_info(handle, AMDGPU_INFO_SENSOR_GFX_SCLK, size, &reading);
|
||||||
|
qDebug() << "coreclk" << reading << ret;
|
||||||
|
|
||||||
GPUList.append(gpu);
|
GPUList.append(gpu);
|
||||||
|
gpuCount++;
|
||||||
|
|
||||||
retb = true;
|
retb = true;
|
||||||
}
|
}
|
||||||
@ -87,6 +93,11 @@ void amd::calculateUIProperties(int GPUIndex)
|
|||||||
|
|
||||||
GPUList[GPUIndex].powerLimSliderMax = static_cast<int>(GPUList[GPUIndex].maxPowerLim);
|
GPUList[GPUIndex].powerLimSliderMax = static_cast<int>(GPUList[GPUIndex].maxPowerLim);
|
||||||
GPUList[GPUIndex].powerLimSliderMin = static_cast<int>(GPUList[GPUIndex].minPowerLim);
|
GPUList[GPUIndex].powerLimSliderMin = static_cast<int>(GPUList[GPUIndex].minPowerLim);
|
||||||
|
|
||||||
|
/*GPUList[GPUIndex].voltageSliderCur = GPUList[GPUIndex].corevolts[GPUList[GPUIndex].corevolts.size()-1];
|
||||||
|
GPUList[GPUIndex].powerLimSliderCur = static_cast<int>(GPUList[GPUIndex].powerLim);
|
||||||
|
GPUList[GPUIndex].memClkSliderCur = GPUList[GPUIndex].memvolts[GPUList[GPUIndex].memclocks.size()-1];
|
||||||
|
GPUList[GPUIndex].coreClkSliderCur = GPUList[GPUIndex].coreclocks[GPUList[GPUIndex].coreclocks.size()-1];*/
|
||||||
}
|
}
|
||||||
bool amd::setupGPUSecondary(int GPUIndex){return true;}
|
bool amd::setupGPUSecondary(int GPUIndex){return true;}
|
||||||
void amd::queryGPUCount(){}
|
void amd::queryGPUCount(){}
|
||||||
@ -185,29 +196,32 @@ void amd::queryGPUVoltage(int GPUIndex)
|
|||||||
AMDGPU_INFO_SENSOR_VDDGFX,
|
AMDGPU_INFO_SENSOR_VDDGFX,
|
||||||
sizeof (GPUList[GPUIndex].voltage),
|
sizeof (GPUList[GPUIndex].voltage),
|
||||||
&GPUList[GPUIndex].voltage);
|
&GPUList[GPUIndex].voltage);
|
||||||
if (ret < 0) qDebug("Failed to query voltage");
|
if (ret != 0) qDebug("Failed to query voltage");
|
||||||
}
|
}
|
||||||
void amd::queryGPUTemp(int GPUIndex)
|
void amd::queryGPUTemp(int GPUIndex)
|
||||||
{
|
{
|
||||||
|
qDebug() << "querying GPU" << GPUIndex << GPUList[GPUIndex].displayName;
|
||||||
int ret = amdgpu_query_sensor_info(*GPUList[GPUIndex].dev,
|
int ret = amdgpu_query_sensor_info(*GPUList[GPUIndex].dev,
|
||||||
AMDGPU_INFO_SENSOR_GPU_TEMP,
|
AMDGPU_INFO_SENSOR_GPU_TEMP,
|
||||||
sizeof (GPUList[GPUIndex].temp),
|
sizeof (GPUList[GPUIndex].temp),
|
||||||
&GPUList[GPUIndex].temp);
|
&GPUList[GPUIndex].temp);
|
||||||
if (ret < 0) qDebug("Failed to query GPU temperature");
|
if (ret != 0) qDebug("Failed to query GPU temperature");
|
||||||
}
|
}
|
||||||
void amd::queryGPUFrequencies(int GPUIndex)
|
void amd::queryGPUFrequencies(int GPUIndex)
|
||||||
{
|
{
|
||||||
|
int reading;
|
||||||
int ret = amdgpu_query_sensor_info(*GPUList[GPUIndex].dev,
|
int ret = amdgpu_query_sensor_info(*GPUList[GPUIndex].dev,
|
||||||
AMDGPU_INFO_SENSOR_GFX_SCLK,
|
AMDGPU_INFO_SENSOR_GFX_SCLK,
|
||||||
sizeof (GPUList[GPUIndex].coreFreq),
|
sizeof (GPUList[GPUIndex].coreFreq),
|
||||||
&GPUList[GPUIndex].coreFreq);
|
&reading);
|
||||||
if (ret < 0) qDebug("Failed to query GPU core clock");
|
qDebug() << reading << ret;
|
||||||
|
if (ret != 0) qDebug("Failed to query GPU core clock");
|
||||||
|
|
||||||
ret = amdgpu_query_sensor_info(*GPUList[GPUIndex].dev,
|
ret = amdgpu_query_sensor_info(*GPUList[GPUIndex].dev,
|
||||||
AMDGPU_INFO_SENSOR_GFX_MCLK,
|
AMDGPU_INFO_SENSOR_GFX_MCLK,
|
||||||
sizeof (GPUList[GPUIndex].memFreq),
|
sizeof (GPUList[GPUIndex].memFreq),
|
||||||
&GPUList[GPUIndex].memFreq);
|
&GPUList[GPUIndex].memFreq);
|
||||||
if (ret < 0) qDebug("Failed to query GPU memory clock");
|
if (ret != 0) qDebug("Failed to query GPU memory clock");
|
||||||
}
|
}
|
||||||
void amd::queryGPUFanSpeed(int GPUIndex)
|
void amd::queryGPUFanSpeed(int GPUIndex)
|
||||||
{
|
{
|
||||||
@ -232,7 +246,7 @@ void amd::queryGPUUtils(int GPUIndex)
|
|||||||
AMDGPU_INFO_SENSOR_GPU_LOAD,
|
AMDGPU_INFO_SENSOR_GPU_LOAD,
|
||||||
sizeof (GPUList[GPUIndex].coreUtil),
|
sizeof (GPUList[GPUIndex].coreUtil),
|
||||||
&GPUList[GPUIndex].coreUtil);
|
&GPUList[GPUIndex].coreUtil);
|
||||||
if (ret < 0) qDebug("Failed to query GPU Utilization");
|
if (ret != 0) qDebug("Failed to query GPU Utilization");
|
||||||
}
|
}
|
||||||
void amd::queryGPUPowerDraw(int GPUIndex)
|
void amd::queryGPUPowerDraw(int GPUIndex)
|
||||||
{
|
{
|
||||||
@ -240,7 +254,7 @@ void amd::queryGPUPowerDraw(int GPUIndex)
|
|||||||
AMDGPU_INFO_SENSOR_GPU_AVG_POWER,
|
AMDGPU_INFO_SENSOR_GPU_AVG_POWER,
|
||||||
sizeof (GPUList[GPUIndex].powerDraw),
|
sizeof (GPUList[GPUIndex].powerDraw),
|
||||||
&GPUList[GPUIndex].powerDraw);
|
&GPUList[GPUIndex].powerDraw);
|
||||||
if (ret < 0) qDebug("failed to query GPU power draw");
|
if (ret != 0) qDebug("failed to query GPU power draw");
|
||||||
}
|
}
|
||||||
void amd::queryGPUPowerLimit(int GPUIndex)
|
void amd::queryGPUPowerLimit(int GPUIndex)
|
||||||
{
|
{
|
||||||
@ -273,7 +287,7 @@ void amd::queryGPUPowerLimitLimits(int GPUIndex)
|
|||||||
}
|
}
|
||||||
void amd::queryGPUCurrentMaxClocks(int GPUIndex)
|
void amd::queryGPUCurrentMaxClocks(int GPUIndex)
|
||||||
{
|
{
|
||||||
amdgpu_gpu_info info;
|
/*amdgpu_gpu_info info;
|
||||||
int ret = amdgpu_query_gpu_info(*GPUList[GPUIndex].dev, &info);
|
int ret = amdgpu_query_gpu_info(*GPUList[GPUIndex].dev, &info);
|
||||||
if (ret < 0) qDebug("Failed to query GPU maximum clocks");
|
if (ret < 0) qDebug("Failed to query GPU maximum clocks");
|
||||||
else {
|
else {
|
||||||
@ -282,7 +296,7 @@ void amd::queryGPUCurrentMaxClocks(int GPUIndex)
|
|||||||
|
|
||||||
clock = static_cast<uint>(info.max_memory_clk);
|
clock = static_cast<uint>(info.max_memory_clk);
|
||||||
GPUList[GPUIndex].maxMemClk = clock/1000;
|
GPUList[GPUIndex].maxMemClk = clock/1000;
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
void amd::queryGPUPowerLimitAvailability(int GPUIndex){}
|
void amd::queryGPUPowerLimitAvailability(int GPUIndex){}
|
||||||
|
|
||||||
|
@ -37,6 +37,11 @@ public:
|
|||||||
int coreClkSliderMax;
|
int coreClkSliderMax;
|
||||||
int voltageSliderMax;
|
int voltageSliderMax;
|
||||||
int voltageSliderMin;
|
int voltageSliderMin;
|
||||||
|
|
||||||
|
int voltageSliderCur;
|
||||||
|
int powerLimSliderCur;
|
||||||
|
int memClkSliderCur;
|
||||||
|
int coreClkSliderCur;
|
||||||
QString displayName;
|
QString displayName;
|
||||||
|
|
||||||
int gputype;
|
int gputype;
|
||||||
|
@ -33,13 +33,13 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
// This is for NVML
|
// This is for NVML
|
||||||
types->setupGPUSecondary(currentGPUIndex);
|
types->setupGPUSecondary(currentGPUIndex);
|
||||||
types->queryGPUFeatures();
|
types->queryGPUFeatures();
|
||||||
types->queryGPUFreqOffset(currentGPUIndex);
|
//types->queryGPUFreqOffset(currentGPUIndex);
|
||||||
types->queryGPUMemClkOffset(currentGPUIndex);
|
//types->queryGPUMemClkOffset(currentGPUIndex);
|
||||||
types->queryGPUVoltageOffset(currentGPUIndex);
|
//types->queryGPUVoltageOffset(currentGPUIndex);
|
||||||
//types->queryGPUPowerLimit(currentGPUIndex);
|
//types->queryGPUPowerLimit(currentGPUIndex);
|
||||||
//types->queryGPUPowerLimitAvailability(currentGPUIndex);
|
//types->queryGPUPowerLimitAvailability(currentGPUIndex);
|
||||||
//types->queryGPUPowerLimitLimits(currentGPUIndex);
|
//types->queryGPUPowerLimitLimits(currentGPUIndex);
|
||||||
types->queryGPUCurrentMaxClocks(currentGPUIndex);
|
//types->queryGPUCurrentMaxClocks(currentGPUIndex);
|
||||||
if (types->GPUList[currentGPUIndex].gputype == types->AMDGPU) {
|
if (types->GPUList[currentGPUIndex].gputype == types->AMDGPU) {
|
||||||
types->calculateUIProperties(currentGPUIndex);
|
types->calculateUIProperties(currentGPUIndex);
|
||||||
}
|
}
|
||||||
@ -47,11 +47,11 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
for (int i=0; i<types->gpuCount; i++) {
|
for (int i=0; i<types->gpuCount; i++) {
|
||||||
ui->GPUComboBox->addItem("GPU-" + QString::number(i) + ": " + types->GPUList[i].displayName);
|
ui->GPUComboBox->addItem("GPU-" + QString::number(i) + ": " + types->GPUList[i].displayName);
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
loadProfileSettings();
|
//loadProfileSettings();
|
||||||
setupMonitorTab();
|
//setupMonitorTab();
|
||||||
setupGraphMonitorTab();
|
setupGraphMonitorTab();
|
||||||
*/
|
|
||||||
|
|
||||||
// Enable sliders according to GPU properties
|
// Enable sliders according to GPU properties
|
||||||
/*
|
/*
|
||||||
@ -108,7 +108,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
|
|
||||||
// Testing code
|
// Testing code
|
||||||
|
|
||||||
ui->voltageSlider->setRange(types->GPUList[currentGPUIndex].voltageSliderMin, types->GPUList[currentGPUIndex].voltageSliderMax);
|
/*ui->voltageSlider->setRange(types->GPUList[currentGPUIndex].voltageSliderMin, types->GPUList[currentGPUIndex].voltageSliderMax);
|
||||||
ui->voltageSpinBox->setRange(types->GPUList[currentGPUIndex].voltageSliderMin, types->GPUList[currentGPUIndex].voltageSliderMax);
|
ui->voltageSpinBox->setRange(types->GPUList[currentGPUIndex].voltageSliderMin, types->GPUList[currentGPUIndex].voltageSliderMax);
|
||||||
|
|
||||||
ui->powerLimSlider->setRange(types->GPUList[currentGPUIndex].powerLimSliderMin, types->GPUList[currentGPUIndex].powerLimSliderMax);
|
ui->powerLimSlider->setRange(types->GPUList[currentGPUIndex].powerLimSliderMin, types->GPUList[currentGPUIndex].powerLimSliderMax);
|
||||||
@ -118,7 +118,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
ui->frequencySlider->setRange(types->GPUList[currentGPUIndex].coreClkSliderMin, types->GPUList[currentGPUIndex].coreClkSliderMin);
|
ui->frequencySlider->setRange(types->GPUList[currentGPUIndex].coreClkSliderMin, types->GPUList[currentGPUIndex].coreClkSliderMin);
|
||||||
|
|
||||||
ui->memClkSlider->setRange(types->GPUList[currentGPUIndex].memClkSliderMin, types->GPUList[currentGPUIndex].memClkSliderMax);
|
ui->memClkSlider->setRange(types->GPUList[currentGPUIndex].memClkSliderMin, types->GPUList[currentGPUIndex].memClkSliderMax);
|
||||||
ui->memClkSpinBox->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->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]);
|
ui->frequencySlider->setValue(types->GPUList[currentGPUIndex].corecloks[types->GPUList[currentGPUIndex].corecloks.size()-1]);
|
||||||
@ -143,7 +143,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
connect(ui->voltageSpinBox, SIGNAL(valueChanged(int)), SLOT(resetTimer()));
|
connect(ui->voltageSpinBox, SIGNAL(valueChanged(int)), SLOT(resetTimer()));
|
||||||
|
|
||||||
connect(ui->tabWidget, SIGNAL(currentChanged(int)), SLOT(tabHandler(int)));
|
connect(ui->tabWidget, SIGNAL(currentChanged(int)), SLOT(tabHandler(int)));
|
||||||
//connect(monitorUpdater, SIGNAL(timeout()), SLOT(updateMonitor()));
|
connect(monitorUpdater, SIGNAL(timeout()), SLOT(updateMonitor()));
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow::~MainWindow()
|
MainWindow::~MainWindow()
|
||||||
|
Loading…
Reference in New Issue
Block a user