mirror of
https://github.com/GOSTSec/ccminer
synced 2025-01-08 22:07:56 +00:00
nvapi: fix device mapping in -D -n
and rename RVB to RGB, french typo...
This commit is contained in:
parent
036473347e
commit
174e26164a
5
cuda.cpp
5
cuda.cpp
@ -110,7 +110,10 @@ void cuda_print_devices()
|
|||||||
#ifdef USE_WRAPNVML
|
#ifdef USE_WRAPNVML
|
||||||
if (opt_debug) nvml_print_device_info(dev_id);
|
if (opt_debug) nvml_print_device_info(dev_id);
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
if (opt_debug) nvapi_pstateinfo(dev_id);
|
if (opt_debug) {
|
||||||
|
unsigned int devNum = nvapi_devnum(dev_id);
|
||||||
|
nvapi_pstateinfo(devNum);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
24
nvml.cpp
24
nvml.cpp
@ -955,7 +955,7 @@ int nvapi_getbios(unsigned int devNum, char *desc, unsigned int maxlen)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int SetGigabyteRVBLogo(unsigned int devNum, uint32_t RVB)
|
static int SetGigabyteRGBLogo(unsigned int devNum, uint32_t RGB)
|
||||||
{
|
{
|
||||||
NvAPI_Status ret;
|
NvAPI_Status ret;
|
||||||
NV_I2C_INFO_EX* i2cInfo;
|
NV_I2C_INFO_EX* i2cInfo;
|
||||||
@ -965,10 +965,10 @@ static int SetGigabyteRVBLogo(unsigned int devNum, uint32_t RVB)
|
|||||||
|
|
||||||
NvU32 readBuf[25] = { 0 };
|
NvU32 readBuf[25] = { 0 };
|
||||||
NvU32 data[5] = { 0 };
|
NvU32 data[5] = { 0 };
|
||||||
data[0] = 1; // block count or i2c send ?
|
data[0] = 1;
|
||||||
data[2] = swab32(RVB & 0xfcfcfcU) | 0x40;
|
data[2] = swab32(RGB & 0xfffffcU) | 0x40;
|
||||||
|
|
||||||
i2cInfo->i2cDevAddress = 0x48 << 1; // maybe a PCF8591
|
i2cInfo->i2cDevAddress = 0x48 << 1;
|
||||||
i2cInfo->pbI2cRegAddress = (NvU8*) (&data[2]);
|
i2cInfo->pbI2cRegAddress = (NvU8*) (&data[2]);
|
||||||
i2cInfo->regAddrSize = 4; // NVAPI_MAX_SIZEOF_I2C_REG_ADDRESS
|
i2cInfo->regAddrSize = 4; // NVAPI_MAX_SIZEOF_I2C_REG_ADDRESS
|
||||||
i2cInfo->pbData = (NvU8*) readBuf;
|
i2cInfo->pbData = (NvU8*) readBuf;
|
||||||
@ -983,14 +983,14 @@ static int SetGigabyteRVBLogo(unsigned int devNum, uint32_t RVB)
|
|||||||
return (int) ret;
|
return (int) ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int nvapi_set_led(unsigned int devNum, int32_t RVB, char *device_name)
|
int nvapi_set_led(unsigned int devNum, int32_t RGB, char *device_name)
|
||||||
{
|
{
|
||||||
uint16_t vid = 0, pid = 0;
|
uint16_t vid = 0, pid = 0;
|
||||||
NvAPI_Status ret;
|
NvAPI_Status ret;
|
||||||
if (strstr(device_name, "Gigabyte GTX 10")) {
|
if (strstr(device_name, "Gigabyte GTX 10")) {
|
||||||
if (opt_debug)
|
if (opt_debug)
|
||||||
applog(LOG_DEBUG, " Set RVB led to %06x", RVB);
|
applog(LOG_DEBUG, " Set RGB led to %06x", RGB);
|
||||||
return SetGigabyteRVBLogo(devNum, (uint32_t) RVB);
|
return SetGigabyteRGBLogo(devNum, (uint32_t) RGB);
|
||||||
} else {
|
} else {
|
||||||
NV_GPU_QUERY_ILLUMINATION_SUPPORT_PARM* illu;
|
NV_GPU_QUERY_ILLUMINATION_SUPPORT_PARM* illu;
|
||||||
NV_INIT_STRUCT_ALLOC(NV_GPU_QUERY_ILLUMINATION_SUPPORT_PARM, illu);
|
NV_INIT_STRUCT_ALLOC(NV_GPU_QUERY_ILLUMINATION_SUPPORT_PARM, illu);
|
||||||
@ -1004,8 +1004,8 @@ int nvapi_set_led(unsigned int devNum, int32_t RVB, char *device_name)
|
|||||||
led->Attribute = NV_GPU_IA_LOGO_BRIGHTNESS;
|
led->Attribute = NV_GPU_IA_LOGO_BRIGHTNESS;
|
||||||
NvAPI_GPU_GetIllumination(led);
|
NvAPI_GPU_GetIllumination(led);
|
||||||
if (opt_debug)
|
if (opt_debug)
|
||||||
applog(LOG_DEBUG, " Led level was %u, set to %d", RVB);
|
applog(LOG_DEBUG, " Led level was %u, set to %d", RGB);
|
||||||
led->Value = (uint32_t) RVB;
|
led->Value = (uint32_t) RGB;
|
||||||
ret = NvAPI_GPU_SetIllumination((NV_GPU_SET_ILLUMINATION_PARM*) led);
|
ret = NvAPI_GPU_SetIllumination((NV_GPU_SET_ILLUMINATION_PARM*) led);
|
||||||
free(led);
|
free(led);
|
||||||
}
|
}
|
||||||
@ -1603,6 +1603,12 @@ int nvapi_init_settings()
|
|||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned int nvapi_devnum(int dev_id)
|
||||||
|
{
|
||||||
|
return nvapi_dev_map[dev_id];
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* api functions -------------------------------------- */
|
/* api functions -------------------------------------- */
|
||||||
|
3
nvml.h
3
nvml.h
@ -226,6 +226,9 @@ int nvapi_init_settings();
|
|||||||
int nvapi_pstateinfo(unsigned int devNum);
|
int nvapi_pstateinfo(unsigned int devNum);
|
||||||
uint8_t nvapi_get_plimit(unsigned int devNum);
|
uint8_t nvapi_get_plimit(unsigned int devNum);
|
||||||
|
|
||||||
|
// nvapi devNum from dev_id (cuda GPU #N)
|
||||||
|
unsigned int nvapi_devnum(int dev_id);
|
||||||
|
|
||||||
// cuda Replacement for 6.5 compat
|
// cuda Replacement for 6.5 compat
|
||||||
int nvapiMemGetInfo(int dev_id, size_t *free, size_t *total);
|
int nvapiMemGetInfo(int dev_id, size_t *free, size_t *total);
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user