mirror of
https://github.com/Lurkki14/tuxclocker.git
synced 2025-02-25 18:55:24 -06:00
more amd functionality
This commit is contained in:
parent
41438d23b4
commit
30459629f1
78
amd.cpp
78
amd.cpp
@ -36,16 +36,39 @@ bool amd::setupGPU()
|
|||||||
GPU gpu;
|
GPU gpu;
|
||||||
gpu.fsindex = i;
|
gpu.fsindex = i;
|
||||||
gpu.gputype = Type::AMDGPU;
|
gpu.gputype = Type::AMDGPU;
|
||||||
|
// Get the hwmon folder name
|
||||||
|
QString monpath = "/sys/class/drm/card0/device/hwmon";
|
||||||
|
QDir mondir(monpath);
|
||||||
|
qDebug() << mondir.entryList() << "mondir";
|
||||||
|
QStringList list = mondir.entryList();
|
||||||
|
for (int i=0; i<list.size(); i++) {
|
||||||
|
if (list[i].contains("hwmon")) {
|
||||||
|
qDebug() << list[i];
|
||||||
|
gpu.hwmonpath = monpath+"/"+list[i];
|
||||||
|
qDebug() << gpu.hwmonpath;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *name = amdgpu_get_marketing_name(*dev);
|
||||||
|
char tempname[64];
|
||||||
|
strcpy(tempname, name);
|
||||||
|
gpu.name = tempname;
|
||||||
|
qDebug() << gpu.name;
|
||||||
GPUList.append(gpu);
|
GPUList.append(gpu);
|
||||||
|
|
||||||
retb = true;
|
retb = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if (!retb) {
|
if (!retb) {
|
||||||
qDebug("No AMD GPUs using amdgpu found");
|
qDebug("No AMD GPUs using amdgpu found");
|
||||||
} else {
|
} else {
|
||||||
queryGPUNames();
|
queryGPUTemp(0);
|
||||||
|
queryGPUPowerLimit(0);
|
||||||
|
queryGPUFanSpeed(0);
|
||||||
|
queryGPUPowerLimitLimits(0);
|
||||||
}
|
}
|
||||||
return retb;
|
return retb;
|
||||||
}
|
}
|
||||||
@ -53,14 +76,14 @@ bool amd::setupGPUSecondary(int GPUIndex){return true;}
|
|||||||
void amd::queryGPUCount(){}
|
void amd::queryGPUCount(){}
|
||||||
void amd::queryGPUNames()
|
void amd::queryGPUNames()
|
||||||
{
|
{
|
||||||
for (int i=0; i<GPUList.size(); i++) {
|
/*for (int i=0; i<GPUList.size(); i++) {
|
||||||
if (GPUList[i].gputype == Type::AMDGPU) {
|
if (GPUList[i].gputype == Type::AMDGPU) {
|
||||||
const char *name;
|
const char *name;
|
||||||
name = amdgpu_get_marketing_name(*dev);
|
name = amdgpu_get_marketing_name(*dev);
|
||||||
//strcpy(GPUList[i].name, name);
|
//strcpy(GPUList[i].name, name);
|
||||||
qDebug() << name;
|
qDebug() << name;
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
void amd::queryGPUUIDs(){}
|
void amd::queryGPUUIDs(){}
|
||||||
void amd::queryGPUFeatures(){}
|
void amd::queryGPUFeatures(){}
|
||||||
@ -94,7 +117,18 @@ void amd::queryGPUFrequencies(int GPUIndex)
|
|||||||
&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)
|
||||||
|
{
|
||||||
|
QFile pwmfile(GPUList[GPUIndex].hwmonpath+"/pwm1");
|
||||||
|
bool ret = pwmfile.open(QFile::ReadOnly | QFile::Text);
|
||||||
|
if (ret) {
|
||||||
|
QString fanspeed = pwmfile.readLine().trimmed();
|
||||||
|
double percspeed = (fanspeed.toDouble()/255)*100;
|
||||||
|
GPUList[GPUIndex].fanSpeed = static_cast<int>(percspeed);
|
||||||
|
qDebug() << GPUList[GPUIndex].fanSpeed << "fanspeed";
|
||||||
|
}
|
||||||
|
else qDebug("Failed to query fan speed");
|
||||||
|
}
|
||||||
void amd::queryGPUUsedVRAM(int GPUIndex){}
|
void amd::queryGPUUsedVRAM(int GPUIndex){}
|
||||||
void amd::queryGPUFreqOffset(int GPUIndex){}
|
void amd::queryGPUFreqOffset(int GPUIndex){}
|
||||||
void amd::queryGPUMemClkOffset(int GPUIndex){}
|
void amd::queryGPUMemClkOffset(int GPUIndex){}
|
||||||
@ -116,8 +150,35 @@ void amd::queryGPUPowerDraw(int GPUIndex)
|
|||||||
&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)
|
||||||
void amd::queryGPUPowerLimitLimits(int GPUIndex){}
|
{
|
||||||
|
QFile pcapfile(GPUList[GPUIndex].hwmonpath+"/power1_cap");
|
||||||
|
bool ret = pcapfile.open(QFile::ReadOnly | QFile::Text);
|
||||||
|
if (ret) {
|
||||||
|
QString pcap = pcapfile.readLine();
|
||||||
|
GPUList[GPUIndex].powerLim = static_cast<uint>(pcap.toInt()/1000000);
|
||||||
|
qDebug() << GPUList[GPUIndex].powerLim << "current power limit";
|
||||||
|
}
|
||||||
|
else qDebug("Failed to query power limit");
|
||||||
|
}
|
||||||
|
void amd::queryGPUPowerLimitLimits(int GPUIndex)
|
||||||
|
{
|
||||||
|
QFile maxpcapfile(GPUList[GPUIndex].hwmonpath+"/power1_cap_max");
|
||||||
|
bool ret = maxpcapfile.open(QFile::ReadOnly | QFile::Text);
|
||||||
|
if (ret) {
|
||||||
|
QString maxpcap = maxpcapfile.readLine();
|
||||||
|
GPUList[GPUIndex].maxPowerLim = static_cast<uint>(maxpcap.toInt()/1000000);
|
||||||
|
qDebug() << GPUList[GPUIndex].maxPowerLim << "max power limit";
|
||||||
|
}
|
||||||
|
|
||||||
|
QFile mincapfile(GPUList[GPUIndex].hwmonpath+"/power1_cap_min");
|
||||||
|
ret = mincapfile.open(QFile::ReadOnly | QFile::Text);
|
||||||
|
if (ret) {
|
||||||
|
QString minpcap = mincapfile.readLine();
|
||||||
|
GPUList[GPUIndex].minPowerLim = static_cast<uint>(minpcap.toInt()/1000000);
|
||||||
|
qDebug() << GPUList[GPUIndex].minPowerLim << "min power limit";
|
||||||
|
}
|
||||||
|
}
|
||||||
void amd::queryGPUCurrentMaxClocks(int GPUIndex)
|
void amd::queryGPUCurrentMaxClocks(int GPUIndex)
|
||||||
{
|
{
|
||||||
amdgpu_gpu_info info;
|
amdgpu_gpu_info info;
|
||||||
@ -134,7 +195,10 @@ void amd::queryGPUCurrentMaxClocks(int GPUIndex)
|
|||||||
void amd::queryGPUPowerLimitAvailability(int GPUIndex){}
|
void amd::queryGPUPowerLimitAvailability(int GPUIndex){}
|
||||||
|
|
||||||
bool amd::assignGPUFanSpeed(int GPUIndex, int targetValue){}
|
bool amd::assignGPUFanSpeed(int GPUIndex, int targetValue){}
|
||||||
bool amd::assignGPUFanCtlMode(int GPUIndex, bool manual){}
|
bool amd::assignGPUFanCtlMode(int GPUIndex, bool manual)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
bool amd::assignGPUFreqOffset(int GPUIndex, int targetValue){}
|
bool amd::assignGPUFreqOffset(int GPUIndex, int targetValue){}
|
||||||
bool amd::assignGPUMemClockOffset(int GPUIndex, int targetValue){}
|
bool amd::assignGPUMemClockOffset(int GPUIndex, int targetValue){}
|
||||||
bool amd::assignGPUVoltageOffset(int GPUIndex, int targetValue){}
|
bool amd::assignGPUVoltageOffset(int GPUIndex, int targetValue){}
|
||||||
|
@ -70,6 +70,8 @@ public:
|
|||||||
// AMD only:
|
// AMD only:
|
||||||
// GPU index in the filesystem eg. card0
|
// GPU index in the filesystem eg. card0
|
||||||
int fsindex;
|
int fsindex;
|
||||||
|
// name of the folder in /sys/class/drm/card(n)/device/hwmon
|
||||||
|
QString hwmonpath;
|
||||||
};
|
};
|
||||||
QVector <GPU> GPUList;
|
QVector <GPU> GPUList;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user