mirror of
https://github.com/GOSTSec/ccminer
synced 2025-01-10 14:57:53 +00:00
nvapi: get vid/pid like nvml + driver version
remove vbios revision, goal was to find the vendor...
This commit is contained in:
parent
a33058b554
commit
d0ad1017e9
5
api.cpp
5
api.cpp
@ -109,6 +109,7 @@ extern uint32_t rejected_count;
|
||||
extern int device_map[8];
|
||||
extern char *device_name[8];
|
||||
extern int num_cpus;
|
||||
extern char driver_version[32];
|
||||
|
||||
// sysinfos.cpp
|
||||
extern float cpu_temp(int);
|
||||
@ -245,10 +246,10 @@ static void gpuhwinfos(int gpu_id)
|
||||
|
||||
snprintf(buf, sizeof(buf), "GPU=%d;BUS=%hd;CARD=%s;MEM=%lu;"
|
||||
"TEMP=%.1f;FAN=%d;FREQ=%d;MEMFREQ=%d;PST=%s;"
|
||||
"VID=%hx;PID=%hx;NVML=%d;NVAPI=%d;BIOS=%s|",
|
||||
"VID=%hx;PID=%hx;NVML=%d;NVAPI=%d;DRIVER=%s|",
|
||||
gpu_id, cgpu->gpu_bus, card, cgpu->gpu_mem,
|
||||
cgpu->gpu_temp, cgpu->gpu_fan, cgpu->gpu_clock, cgpu->gpu_memclock,
|
||||
pstate, cgpu->gpu_vid, cgpu->gpu_pid, cgpu->nvml_id, cgpu->nvapi_id, cgpu->gpu_desc);
|
||||
pstate, cgpu->gpu_vid, cgpu->gpu_pid, cgpu->nvml_id, cgpu->nvapi_id, driver_version);
|
||||
|
||||
strcat(buffer, buf);
|
||||
}
|
||||
|
24
nvml.cpp
24
nvml.cpp
@ -28,6 +28,9 @@
|
||||
// cuda.cpp
|
||||
int cuda_num_devices();
|
||||
|
||||
// geforce driver version
|
||||
char driver_version[32] = { 0 };
|
||||
|
||||
#ifdef USE_WRAPNVML
|
||||
|
||||
#include "nvml.h"
|
||||
@ -460,22 +463,26 @@ int nvapi_getusage(unsigned int devNum, unsigned int *pct)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int nvapi_getinfo(unsigned int devNum, char *desc)
|
||||
int nvapi_getinfo(unsigned int devNum, uint16_t *vid, uint16_t *pid)
|
||||
{
|
||||
NvAPI_Status ret;
|
||||
NvU32 pDeviceId, pSubSystemId, pRevisionId, pExtDeviceId;
|
||||
|
||||
if (devNum >= nvapi_dev_cnt)
|
||||
return -1;
|
||||
|
||||
// bios rev
|
||||
ret = NvAPI_GPU_GetVbiosVersionString(phys[devNum], desc);
|
||||
ret = NvAPI_GPU_GetPCIIdentifiers(phys[devNum], &pDeviceId, &pSubSystemId, &pRevisionId, &pExtDeviceId);
|
||||
if (ret != NVAPI_OK) {
|
||||
NvAPI_ShortString string;
|
||||
NvAPI_GetErrorMessage(ret, string);
|
||||
if (opt_debug)
|
||||
applog(LOG_DEBUG, "NVAPI GetVbiosVersionString: %s", string);
|
||||
applog(LOG_DEBUG, "NVAPI GetPCIIdentifiers: %s", string);
|
||||
return -1;
|
||||
}
|
||||
|
||||
(*pid) = pDeviceId >> 16;
|
||||
(*vid) = pDeviceId & 0xFFFF;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -536,6 +543,13 @@ int wrap_nvapi_init()
|
||||
applog(LOG_DEBUG, "NVAPI Version: %s", ver);
|
||||
#endif
|
||||
|
||||
NvU32 udv;
|
||||
NvAPI_ShortString str;
|
||||
ret = NvAPI_SYS_GetDriverAndBranchVersion(&udv, str);
|
||||
if (ret == NVAPI_OK) {
|
||||
sprintf(driver_version,"%d.%d", udv/100, udv % 100);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
@ -638,7 +652,7 @@ int gpu_info(struct cgpu_info *gpu)
|
||||
wrap_nvml_get_info(hnvml, gpu->gpu_id, &gpu->gpu_vid, &gpu->gpu_pid);
|
||||
}
|
||||
#ifdef WIN32
|
||||
nvapi_getinfo(nvapi_dev_map[gpu->gpu_id], &gpu->gpu_desc[0]);
|
||||
nvapi_getinfo(nvapi_dev_map[gpu->gpu_id], &gpu->gpu_vid, &gpu->gpu_pid);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user