Add `checkNvidia` for nvml/xnvctrl/nvapi checks, for header cleanup

pull/337/head^2
jackun 4 years ago
parent a6dc259ea4
commit c15133b82f
No known key found for this signature in database
GPG Key ID: 119DB3F1D05A9ED3

@ -1,9 +1,29 @@
#include "memory.h"
#include "gpu.h"
#include <inttypes.h>
#include "nvctrl.h"
#ifdef HAVE_NVML
#include "nvidia_info.h"
#endif
struct gpuInfo gpu_info;
amdgpu_files amdgpu {};
bool checkNvidia(const char *pci_dev){
bool nvSuccess = false;
#ifdef HAVE_NVML
nvSuccess = checkNVML(pci_dev) && getNVMLInfo();
#endif
#ifdef HAVE_XNVCTRL
if (!nvSuccess)
nvSuccess = checkXNVCtrl();
#endif
#ifdef _WIN32
if (!nvSuccess)
nvSuccess = checkNVAPI();
#endif
return nvSuccess;
}
void getNvidiaGpuInfo(){
#ifdef HAVE_NVML
if (nvmlSuccess){

@ -2,14 +2,7 @@
#ifndef MANGOHUD_GPU_H
#define MANGOHUD_GPU_H
#include <thread>
#include <inttypes.h>
#include <stdlib.h>
#include <stdio.h>
#include "nvctrl.h"
#ifdef HAVE_NVML
#include "nvidia_info.h"
#endif
struct amdgpu_files
{
@ -38,6 +31,7 @@ extern struct gpuInfo gpu_info;
void getNvidiaGpuInfo(void);
void getAmdGpuInfo(void);
bool checkNvidia(const char *pci_dev);
extern void nvapi_util();
extern bool checkNVAPI();
#endif //MANGOHUD_GPU_H

@ -518,26 +518,12 @@ void init_gpu_stats(uint32_t& vendorID, overlay_params& params)
if (vendorID == 0x8086
|| vendorID == 0x10de) {
bool nvSuccess = false;
#ifdef HAVE_NVML
nvSuccess = checkNVML(pci_dev) && getNVMLInfo();
#endif
#ifdef HAVE_XNVCTRL
if (!nvSuccess)
nvSuccess = checkXNVCtrl();
#endif
#ifdef _WIN32
if (!nvSuccess)
nvSuccess = checkNVAPI();
#endif
if(not nvSuccess) {
params.enabled[OVERLAY_PARAM_ENABLED_gpu_stats] = false;
}
else {
if(checkNvidia(pci_dev))
vendorID = 0x10de;
}
else
params.enabled[OVERLAY_PARAM_ENABLED_gpu_stats] = false;
}
#ifdef __gnu_linux__
if (vendorID == 0x8086 || vendorID == 0x1002
|| gpu.find("Radeon") != std::string::npos

Loading…
Cancel
Save