diff --git a/amd.cpp b/amd.cpp index 85bb7e1..226500a 100644 --- a/amd.cpp +++ b/amd.cpp @@ -97,7 +97,9 @@ void amd::calculateUIProperties(int GPUIndex) if (GPUList[GPUIndex].overVoltAvailable) { GPUList[GPUIndex].voltageSliderCur = GPUList[GPUIndex].corevolts[GPUList[GPUIndex].corevolts.size()-1]; } - /*GPUList[GPUIndex].powerLimSliderCur = static_cast(GPUList[GPUIndex].powerLim);*/ + if (GPUList[GPUIndex].powerLimitAvailable) { + GPUList[GPUIndex].powerLimSliderCur = static_cast(GPUList[GPUIndex].powerLim); + } if (GPUList[GPUIndex].overClockAvailable) { GPUList[GPUIndex].memClkSliderCur = GPUList[GPUIndex].memvolts[GPUList[GPUIndex].memclocks.size()-1]; GPUList[GPUIndex].coreClkSliderCur = GPUList[GPUIndex].coreclocks[GPUList[GPUIndex].coreclocks.size()-1]; @@ -336,12 +338,16 @@ void amd::queryGPUUtils(int GPUIndex) } void amd::queryGPUPowerDraw(int GPUIndex) { + int reading = 0; int ret = amdgpu_query_sensor_info(*GPUList[GPUIndex].dev, AMDGPU_INFO_SENSOR_GPU_AVG_POWER, - sizeof (GPUList[GPUIndex].powerDraw), - &GPUList[GPUIndex].powerDraw); + sizeof (reading), + &reading); if (ret != 0) qDebug("failed to query GPU power draw"); - else qDebug() << GPUList[GPUIndex].powerDraw << "power draw"; + else { + qDebug() << GPUList[GPUIndex].powerDraw << "power draw"; + GPUList[GPUIndex].powerDraw = static_cast(reading); + } } void amd::queryGPUPowerLimit(int GPUIndex) { @@ -420,6 +426,9 @@ 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){} +bool amd::assignGPUPowerLimit(uint targetValue) +{ + +} #endif diff --git a/amdpstateeditor.cpp b/amdpstateeditor.cpp index 3e9d492..f3e2ebf 100644 --- a/amdpstateeditor.cpp +++ b/amdpstateeditor.cpp @@ -105,16 +105,20 @@ void amdPstateEditor::generateUI(gputypes *newtypes, int GPUIndex) state.freqspinbox = freqspinbox; memPstates.append(state); } + QWidget *buttonwidget = new QWidget; + QVBoxLayout *buttonlo = new QVBoxLayout; // Add an apply button QPushButton *applyButton = new QPushButton; connect(applyButton, SIGNAL(clicked()), SLOT(applyValues())); applyButton->setText("Apply values"); - llo->addWidget(applyButton); + buttonlo->addWidget(applyButton); // Add a reset button QPushButton *resetButton = new QPushButton; connect(resetButton, SIGNAL(clicked()), SLOT(resetPstates())); resetButton->setText("Reset to defaults"); - llo->addWidget(resetButton); + buttonlo->addWidget(resetButton); + buttonwidget->setLayout(buttonlo); + llo->addWidget(buttonwidget); lower->setLayout(llo); upper->setLayout(ulo);