mirror of
https://github.com/hashcat/hashcat.git
synced 2025-01-08 14:51:10 +00:00
Merge pull request #192 from gm4tr1x/ADL_LibraryLoader
Update ADL/OpenCL Library Loader
This commit is contained in:
commit
102dee00eb
@ -51,6 +51,10 @@ typedef void *OCL_LIB;
|
||||
|
||||
#ifdef HAVE_HWMON
|
||||
typedef void *HM_LIB;
|
||||
typedef void *ADL_LIB;
|
||||
#ifdef OSX
|
||||
#define __stdcall
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif // _POSIX
|
||||
@ -78,6 +82,7 @@ typedef UINT64 uint64_t;
|
||||
|
||||
#ifdef HAVE_HWMON
|
||||
typedef HINSTANCE HM_LIB;
|
||||
typedef HINSTANCE ADL_LIB;
|
||||
#endif
|
||||
|
||||
typedef HINSTANCE OCL_LIB;
|
||||
|
@ -1,5 +1,7 @@
|
||||
/**
|
||||
* Author......: Jens Steube <jens.steube@gmail.com>
|
||||
* Authors.....: Jens Steube <jens.steube@gmail.com>
|
||||
* Gabriele Gristina <matrix@hashcat.net>
|
||||
*
|
||||
* License.....: MIT
|
||||
*/
|
||||
|
||||
@ -15,8 +17,8 @@
|
||||
*/
|
||||
|
||||
#define ADL_OK 0
|
||||
#define ADL_ERR -1
|
||||
#define ADL_ERR_NOT_SUPPORTED -8
|
||||
#define ADL_ERR -1
|
||||
#define ADL_ERR_NOT_SUPPORTED -8
|
||||
|
||||
#define ADL_MAX_PATH 256
|
||||
|
||||
@ -42,19 +44,19 @@ typedef struct AdapterInfo
|
||||
char strDisplayName[ADL_MAX_PATH];
|
||||
int iPresent;
|
||||
|
||||
#if defined (_WIN32) || defined (_WIN64)
|
||||
#if defined (_WIN32) || defined (_WIN64)
|
||||
int iExist;
|
||||
char strDriverPath[ADL_MAX_PATH];
|
||||
char strDriverPathExt[ADL_MAX_PATH];
|
||||
char strPNPString[ADL_MAX_PATH];
|
||||
int iOSDisplayIndex;
|
||||
#endif /* (_WIN32) || (_WIN64) */
|
||||
#endif /* (_WIN32) || (_WIN64) */
|
||||
|
||||
#if defined (__linux__)
|
||||
#if defined (__linux__)
|
||||
int iXScreenNum;
|
||||
int iDrvIndex;
|
||||
char strXScreenConfigName[ADL_MAX_PATH];
|
||||
#endif /* (__linux__) */
|
||||
#endif /* (__linux__) */
|
||||
} AdapterInfo, *LPAdapterInfo;
|
||||
|
||||
typedef struct ADLThermalControllerInfo
|
||||
@ -247,9 +249,7 @@ typedef void* (__stdcall *ADL_MAIN_MALLOC_CALLBACK )( int );
|
||||
|
||||
typedef int HM_ADAPTER_AMD;
|
||||
|
||||
#ifdef _POSIX
|
||||
void *GetProcAddress (void *pLibrary, const char *name);
|
||||
#endif
|
||||
#include <shared.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@ -265,22 +265,22 @@ typedef int (*ADL_ADAPTER_ADAPTERINFO_GET) (LPAdapterInfo, int);
|
||||
typedef int (*ADL_DISPLAY_DISPLAYINFO_GET) (int, int *, ADLDisplayInfo **, int);
|
||||
typedef int (*ADL_OVERDRIVE5_TEMPERATURE_GET) (int, int, ADLTemperature *);
|
||||
typedef int (*ADL_OVERDRIVE6_TEMPERATURE_GET) (int, int *);
|
||||
typedef int (*HC_ADL_OVERDRIVE5_CURRENTACTIVITY_GET) (int, ADLPMActivity *);
|
||||
typedef int (*HC_ADL_OVERDRIVE5_THERMALDEVICES_ENUM) (int, int, ADLThermalControllerInfo *);
|
||||
typedef int (*HC_ADL_ADAPTER_ID_GET) (int, int *);
|
||||
typedef int (*HC_ADL_ADAPTER_VIDEOBIOSINFO_GET) (int, ADLBiosInfo *);
|
||||
typedef int (*HC_ADL_OVERDRIVE5_FANSPEEDINFO_GET) (int, int, ADLFanSpeedInfo *);
|
||||
typedef int (*ADL_OVERDRIVE5_CURRENTACTIVITY_GET) (int, ADLPMActivity *);
|
||||
typedef int (*ADL_OVERDRIVE5_THERMALDEVICES_ENUM) (int, int, ADLThermalControllerInfo *);
|
||||
typedef int (*ADL_ADAPTER_ID_GET) (int, int *);
|
||||
typedef int (*ADL_ADAPTER_VIDEOBIOSINFO_GET) (int, ADLBiosInfo *);
|
||||
typedef int (*ADL_OVERDRIVE5_FANSPEEDINFO_GET) (int, int, ADLFanSpeedInfo *);
|
||||
typedef int (*ADL_OVERDRIVE5_FANSPEED_GET) (int, int, ADLFanSpeedValue *);
|
||||
typedef int (*ADL_OVERDRIVE6_FANSPEED_GET) (int, ADLOD6FanSpeedInfo *);
|
||||
typedef int (*ADL_OVERDRIVE5_FANSPEED_SET) (int, int, ADLFanSpeedValue *);
|
||||
typedef int (*ADL_OVERDRIVE6_FANSPEED_SET) (int, ADLOD6FanSpeedValue *);
|
||||
typedef int (*ADL_OVERDRIVE5_FANSPEEDTODEFAULT_SET) (int, int);
|
||||
typedef int (*HC_ADL_OVERDRIVE5_ODPARAMETERS_GET) (int, ADLODParameters *);
|
||||
typedef int (*HC_ADL_OVERDRIVE5_ODPERFORMANCELEVELS_GET) (int, int, ADLODPerformanceLevels *);
|
||||
typedef int (*HC_ADL_OVERDRIVE5_ODPERFORMANCELEVELS_SET) (int, ADLODPerformanceLevels *);
|
||||
typedef int (*HC_ADL_OVERDRIVE6_POWERCONTROL_SET) (int, int);
|
||||
typedef int (*HC_ADL_OVERDRIVE6_POWERCONTROL_GET) (int, int *, int *);
|
||||
typedef int (*HC_ADL_OVERDRIVE6_POWERCONTROLINFO_GET) (int, ADLOD6PowerControlInfo *);
|
||||
typedef int (*ADL_OVERDRIVE5_ODPARAMETERS_GET) (int, ADLODParameters *);
|
||||
typedef int (*ADL_OVERDRIVE5_ODPERFORMANCELEVELS_GET) (int, int, ADLODPerformanceLevels *);
|
||||
typedef int (*ADL_OVERDRIVE5_ODPERFORMANCELEVELS_SET) (int, ADLODPerformanceLevels *);
|
||||
typedef int (*ADL_OVERDRIVE6_POWERCONTROL_SET) (int, int);
|
||||
typedef int (*ADL_OVERDRIVE6_POWERCONTROL_GET) (int, int *, int *);
|
||||
typedef int (*ADL_OVERDRIVE6_POWERCONTROLINFO_GET) (int, ADLOD6PowerControlInfo *);
|
||||
typedef int (*ADL_ADAPTER_ACTIVE_GET) (int, int *);
|
||||
typedef int (*ADL_DISPLAYENABLE_SET) (int, int *, int, int);
|
||||
typedef int (*ADL_OVERDRIVE_CAPS) (int, int *, int *, int *);
|
||||
@ -291,38 +291,82 @@ typedef int (*ADL_OVERDRIVE6_STATE_SET) (int, int, ADLOD6StateInfo *);
|
||||
typedef int (*ADL_OVERDRIVE6_POWERCONTROL_CAPS) (int, int *);
|
||||
typedef int (*ADL_OVERDRIVE6_TARGETTEMPERATUREDATA_GET) (int, int *, int *);
|
||||
|
||||
int hc_ADL_Main_Control_Destroy (HM_LIB hDLL);
|
||||
int hc_ADL_Main_Control_Create (HM_LIB hDLL, ADL_MAIN_MALLOC_CALLBACK callback, int iEnumConnectedAdapters);
|
||||
int hc_ADL_Adapter_NumberOfAdapters_Get (HM_LIB hDLL, int *lpNumAdapters);
|
||||
int hc_ADL_Adapter_AdapterInfo_Get (HM_LIB hDLL, LPAdapterInfo lpInfo, int iInputSize);
|
||||
int hc_ADL_Display_DisplayInfo_Get (HM_LIB hDLL, int iAdapterIndex, int *iNumDisplays, ADLDisplayInfo **lppInfo, int iForceDetect);
|
||||
int hc_ADL_Overdrive5_Temperature_Get (HM_LIB hDLL, int iAdapterIndex, int iThermalControllerIndex, ADLTemperature *lpTemperature);
|
||||
int hc_ADL_Overdrive6_Temperature_Get (HM_LIB hDLL, int iAdapterIndex, int *iTemperature);
|
||||
int hc_ADL_Overdrive_CurrentActivity_Get (HM_LIB hDLL, int iAdapterIndex, ADLPMActivity *lpActivity);
|
||||
int hc_ADL_Overdrive_ThermalDevices_Enum (HM_LIB hDLL, int iAdapterIndex, int iThermalControllerIndex, ADLThermalControllerInfo *lpThermalControllerInfo);
|
||||
int hc_ADL_Adapter_ID_Get (HM_LIB hDLL, int iAdapterIndex, int *lpAdapterID);
|
||||
int hc_ADL_Adapter_VideoBiosInfo_Get (HM_LIB hDLL, int iAdapterIndex, ADLBiosInfo *lpBiosInfo);
|
||||
int hc_ADL_Overdrive5_FanSpeedInfo_Get (HM_LIB hDLL, int iAdapterIndex, int iThermalControllerIndex, ADLFanSpeedInfo *lpFanSpeedInfo);
|
||||
int hc_ADL_Overdrive5_FanSpeed_Get (HM_LIB hDLL, int iAdapterIndex, int iThermalControllerIndex, ADLFanSpeedValue *lpFanSpeedValue);
|
||||
int hc_ADL_Overdrive6_FanSpeed_Get (HM_LIB hDLL, int iAdapterIndex, ADLOD6FanSpeedInfo *lpFanSpeedInfo);
|
||||
int hc_ADL_Overdrive5_FanSpeed_Set (HM_LIB hDLL, int iAdapterIndex, int iThermalControllerIndex, ADLFanSpeedValue *lpFanSpeedValue);
|
||||
int hc_ADL_Overdrive6_FanSpeed_Set (HM_LIB hDLL, int iAdapterIndex, ADLOD6FanSpeedValue *lpFanSpeedValue);
|
||||
int hc_ADL_Overdrive5_FanSpeedToDefault_Set (HM_LIB hDLL, int iAdapterIndex, int iThermalControllerIndex);
|
||||
int hc_ADL_Overdrive_ODParameters_Get (HM_LIB hDLL, int iAdapterIndex, ADLODParameters *lpOdParameters);
|
||||
int hc_ADL_Overdrive_ODPerformanceLevels_Get (HM_LIB hDLL, int iAdapterIndex, int iDefault, ADLODPerformanceLevels *lpOdPerformanceLevels);
|
||||
int hc_ADL_Overdrive_ODPerformanceLevels_Set (HM_LIB hDLL, int iAdapterIndex, ADLODPerformanceLevels *lpOdPerformanceLevels);
|
||||
int hc_ADL_Overdrive_PowerControlInfo_Get (HM_LIB hDLL, int iAdapterIndex, ADLOD6PowerControlInfo *);
|
||||
int hc_ADL_Overdrive_PowerControl_Get (HM_LIB hDLL, int iAdapterIndex, int *level);
|
||||
int hc_ADL_Overdrive_PowerControl_Set (HM_LIB hDLL, int iAdapterIndex, int level);
|
||||
int hc_ADL_Adapter_Active_Get (HM_LIB hDLL, int iAdapterIndex, int *lpStatus);
|
||||
int hc_ADL_DisplayEnable_Set (HM_LIB hDLL, int iAdapterIndex, int *lpDisplayIndexList, int iDisplayListSize, int bPersistOnly);
|
||||
int hc_ADL_Overdrive_Caps (HM_LIB hDLL, int iAdapterIndex, int *od_supported, int *od_enabled, int *od_version);
|
||||
int hc_ADL_Overdrive_CurrentStatus_Get (HM_LIB hDLL, int iAdapterIndex, ADLOD6CurrentStatus *status);
|
||||
int hc_ADL_Overdrive_StateInfo_Get (HM_LIB hDLL, int iAdapterIndex, int type, ADLOD6MemClockState *state);
|
||||
int hc_ADL_Overdrive_Capabilities_Get (HM_LIB hDLL, int iAdapterIndex, ADLOD6Capabilities *caps);
|
||||
int hc_ADL_Overdrive_State_Set (HM_LIB hDLL, int iAdapterIndex, int type, ADLOD6StateInfo *state);
|
||||
int hc_ADL_Overdrive6_PowerControl_Caps (HM_LIB hDLL, int iAdapterIndex, int *lpSupported);
|
||||
int hc_ADL_Overdrive6_TargetTemperatureData_Get (HM_LIB hDLL, int iAdapterIndex, int *cur_temp, int *default_temp);
|
||||
typedef struct
|
||||
{
|
||||
ADL_LIB lib;
|
||||
|
||||
ADL_MAIN_CONTROL_DESTROY ADL_Main_Control_Destroy;
|
||||
ADL_MAIN_CONTROL_CREATE ADL_Main_Control_Create;
|
||||
ADL_ADAPTER_NUMBEROFADAPTERS_GET ADL_Adapter_NumberOfAdapters_Get;
|
||||
ADL_ADAPTER_ADAPTERINFO_GET ADL_Adapter_AdapterInfo_Get;
|
||||
ADL_DISPLAY_DISPLAYINFO_GET ADL_Display_DisplayInfo_Get;
|
||||
ADL_ADAPTER_ID_GET ADL_Adapter_ID_Get;
|
||||
ADL_ADAPTER_VIDEOBIOSINFO_GET ADL_Adapter_VideoBiosInfo_Get;
|
||||
ADL_OVERDRIVE5_THERMALDEVICES_ENUM ADL_Overdrive5_ThermalDevices_Enum;
|
||||
ADL_OVERDRIVE5_TEMPERATURE_GET ADL_Overdrive5_Temperature_Get;
|
||||
ADL_OVERDRIVE6_TEMPERATURE_GET ADL_Overdrive6_Temperature_Get;
|
||||
ADL_OVERDRIVE5_CURRENTACTIVITY_GET ADL_Overdrive5_CurrentActivity_Get;
|
||||
ADL_OVERDRIVE5_FANSPEEDINFO_GET ADL_Overdrive5_FanSpeedInfo_Get;
|
||||
ADL_OVERDRIVE5_FANSPEED_GET ADL_Overdrive5_FanSpeed_Get;
|
||||
ADL_OVERDRIVE6_FANSPEED_GET ADL_Overdrive6_FanSpeed_Get;
|
||||
ADL_OVERDRIVE5_FANSPEED_SET ADL_Overdrive5_FanSpeed_Set;
|
||||
ADL_OVERDRIVE6_FANSPEED_SET ADL_Overdrive6_FanSpeed_Set;
|
||||
ADL_OVERDRIVE5_FANSPEEDTODEFAULT_SET ADL_Overdrive5_FanSpeedToDefault_Set;
|
||||
ADL_OVERDRIVE5_ODPARAMETERS_GET ADL_Overdrive5_ODParameters_Get;
|
||||
ADL_OVERDRIVE5_ODPERFORMANCELEVELS_GET ADL_Overdrive5_ODPerformanceLevels_Get;
|
||||
ADL_OVERDRIVE5_ODPERFORMANCELEVELS_SET ADL_Overdrive5_ODPerformanceLevels_Set;
|
||||
ADL_OVERDRIVE6_POWERCONTROLINFO_GET ADL_Overdrive6_PowerControlInfo_Get;
|
||||
ADL_OVERDRIVE6_POWERCONTROL_GET ADL_Overdrive6_PowerControl_Get;
|
||||
ADL_OVERDRIVE6_POWERCONTROL_SET ADL_Overdrive6_PowerControl_Set;
|
||||
ADL_ADAPTER_ACTIVE_GET ADL_Adapter_Active_Get;
|
||||
ADL_DISPLAYENABLE_SET ADL_DisplayEnable_Set;
|
||||
ADL_OVERDRIVE_CAPS ADL_Overdrive_Caps;
|
||||
ADL_OVERDRIVE6_POWERCONTROL_CAPS ADL_Overdrive6_PowerControl_Caps;
|
||||
ADL_OVERDRIVE6_CAPABILITIES_GET ADL_Overdrive6_Capabilities_Get;
|
||||
ADL_OVERDRIVE6_STATEINFO_GET ADL_Overdrive6_StateInfo_Get;
|
||||
ADL_OVERDRIVE6_CURRENTSTATUS_GET ADL_Overdrive6_CurrentStatus_Get;
|
||||
ADL_OVERDRIVE6_STATE_SET ADL_Overdrive6_State_Set;
|
||||
ADL_OVERDRIVE6_TARGETTEMPERATUREDATA_GET ADL_Overdrive6_TargetTemperatureData_Get;
|
||||
|
||||
} hc_adl_lib_t;
|
||||
|
||||
#define ADL_PTR hc_adl_lib_t
|
||||
|
||||
int adl_init (ADL_PTR *lib);
|
||||
void adl_close (ADL_PTR *lib);
|
||||
|
||||
int hc_ADL_Main_Control_Destroy (ADL_PTR *adl);
|
||||
int hc_ADL_Main_Control_Create (ADL_PTR *adl, ADL_MAIN_MALLOC_CALLBACK callback, int iEnumConnectedAdapters);
|
||||
int hc_ADL_Adapter_NumberOfAdapters_Get (ADL_PTR *adl, int *lpNumAdapters);
|
||||
int hc_ADL_Adapter_AdapterInfo_Get (ADL_PTR *adl, LPAdapterInfo lpInfo, int iInputSize);
|
||||
int hc_ADL_Display_DisplayInfo_Get (ADL_PTR *adl, int iAdapterIndex, int *iNumDisplays, ADLDisplayInfo **lppInfo, int iForceDetect);
|
||||
int hc_ADL_Overdrive5_Temperature_Get (ADL_PTR *adl, int iAdapterIndex, int iThermalControllerIndex, ADLTemperature *lpTemperature);
|
||||
int hc_ADL_Overdrive6_Temperature_Get (ADL_PTR *adl, int iAdapterIndex, int *iTemperature);
|
||||
int hc_ADL_Overdrive_CurrentActivity_Get (ADL_PTR *adl, int iAdapterIndex, ADLPMActivity *lpActivity);
|
||||
int hc_ADL_Overdrive_ThermalDevices_Enum (ADL_PTR *adl, int iAdapterIndex, int iThermalControllerIndex, ADLThermalControllerInfo *lpThermalControllerInfo);
|
||||
int hc_ADL_Adapter_ID_Get (ADL_PTR *adl, int iAdapterIndex, int *lpAdapterID);
|
||||
int hc_ADL_Adapter_VideoBiosInfo_Get (ADL_PTR *adl, int iAdapterIndex, ADLBiosInfo *lpBiosInfo);
|
||||
int hc_ADL_Overdrive5_FanSpeedInfo_Get (ADL_PTR *adl, int iAdapterIndex, int iThermalControllerIndex, ADLFanSpeedInfo *lpFanSpeedInfo);
|
||||
int hc_ADL_Overdrive5_FanSpeed_Get (ADL_PTR *adl, int iAdapterIndex, int iThermalControllerIndex, ADLFanSpeedValue *lpFanSpeedValue);
|
||||
int hc_ADL_Overdrive6_FanSpeed_Get (ADL_PTR *adl, int iAdapterIndex, ADLOD6FanSpeedInfo *lpFanSpeedInfo);
|
||||
int hc_ADL_Overdrive5_FanSpeed_Set (ADL_PTR *adl, int iAdapterIndex, int iThermalControllerIndex, ADLFanSpeedValue *lpFanSpeedValue);
|
||||
int hc_ADL_Overdrive6_FanSpeed_Set (ADL_PTR *adl, int iAdapterIndex, ADLOD6FanSpeedValue *lpFanSpeedValue);
|
||||
int hc_ADL_Overdrive5_FanSpeedToDefault_Set (ADL_PTR *adl, int iAdapterIndex, int iThermalControllerIndex);
|
||||
int hc_ADL_Overdrive_ODParameters_Get (ADL_PTR *adl, int iAdapterIndex, ADLODParameters *lpOdParameters);
|
||||
int hc_ADL_Overdrive_ODPerformanceLevels_Get (ADL_PTR *adl, int iAdapterIndex, int iDefault, ADLODPerformanceLevels *lpOdPerformanceLevels);
|
||||
int hc_ADL_Overdrive_ODPerformanceLevels_Set (ADL_PTR *adl, int iAdapterIndex, ADLODPerformanceLevels *lpOdPerformanceLevels);
|
||||
int hc_ADL_Overdrive_PowerControlInfo_Get (ADL_PTR *adl, int iAdapterIndex, ADLOD6PowerControlInfo *);
|
||||
int hc_ADL_Overdrive_PowerControl_Get (ADL_PTR *adl, int iAdapterIndex, int *level);
|
||||
int hc_ADL_Overdrive_PowerControl_Set (ADL_PTR *adl, int iAdapterIndex, int level);
|
||||
int hc_ADL_Adapter_Active_Get (ADL_PTR *adl, int iAdapterIndex, int *lpStatus);
|
||||
int hc_ADL_DisplayEnable_Set (ADL_PTR *adl, int iAdapterIndex, int *lpDisplayIndexList, int iDisplayListSize, int bPersistOnly);
|
||||
int hc_ADL_Overdrive_Caps (ADL_PTR *adl, int iAdapterIndex, int *od_supported, int *od_enabled, int *od_version);
|
||||
int hc_ADL_Overdrive_CurrentStatus_Get (ADL_PTR *adl, int iAdapterIndex, ADLOD6CurrentStatus *status);
|
||||
int hc_ADL_Overdrive_StateInfo_Get (ADL_PTR *adl, int iAdapterIndex, int type, ADLOD6MemClockState *state);
|
||||
int hc_ADL_Overdrive_Capabilities_Get (ADL_PTR *adl, int iAdapterIndex, ADLOD6Capabilities *caps);
|
||||
int hc_ADL_Overdrive_State_Set (ADL_PTR *adl, int iAdapterIndex, int type, ADLOD6StateInfo *state);
|
||||
int hc_ADL_Overdrive6_PowerControl_Caps (ADL_PTR *adl, int iAdapterIndex, int *lpSupported);
|
||||
int hc_ADL_Overdrive6_TargetTemperatureData_Get (ADL_PTR *adl, int iAdapterIndex, int *cur_temp, int *default_temp);
|
||||
|
||||
#endif // HAVE_HWMON && HAVE_ADL
|
||||
|
||||
|
@ -99,7 +99,7 @@ typedef struct
|
||||
|
||||
#define OCL_PTR hc_opencl_lib_t
|
||||
|
||||
void ocl_init (OCL_PTR *ocl);
|
||||
int ocl_init (OCL_PTR *ocl);
|
||||
void ocl_close (OCL_PTR *ocl);
|
||||
|
||||
cl_mem hc_clCreateBuffer (OCL_PTR *ocl, cl_context context, cl_mem_flags flags, size_t size, void *host_ptr);
|
||||
|
@ -60,6 +60,18 @@
|
||||
#define hc_dlsym dlsym
|
||||
#endif
|
||||
|
||||
#define HC_LOAD_FUNC(ptr,name,type,libname,noerr) \
|
||||
ptr->name = (type) hc_dlsym (ptr->lib, #name); \
|
||||
if (!ptr->name) { \
|
||||
if (noerr == 1) { \
|
||||
log_error ("ERROR: #name is missing from #libname shared library."); \
|
||||
exit (-1); \
|
||||
} else { \
|
||||
log_info ("WARNING: #name is missing from #libname shared library."); \
|
||||
return (-1); \
|
||||
} \
|
||||
}
|
||||
|
||||
/**
|
||||
* system stuff
|
||||
*/
|
||||
@ -76,14 +88,14 @@
|
||||
* temperature management
|
||||
*/
|
||||
|
||||
#ifdef LINUX
|
||||
#include <ext_nvml.h>
|
||||
#ifdef _POSIX
|
||||
#include <ext_ADL.h>
|
||||
#endif
|
||||
|
||||
#ifdef WIN
|
||||
#ifdef LINUX
|
||||
#include <ext_nvml.h>
|
||||
#elif WIN
|
||||
#include <ext_nvapi.h>
|
||||
#include <ext_ADL.h>
|
||||
#endif
|
||||
|
||||
#ifdef OSX
|
||||
@ -1867,16 +1879,16 @@ int hm_get_adapter_index_nv (HM_ADAPTER_NV nvGPUHandle[DEVICES_MAX]);
|
||||
// void hm_get_opencl_busid_devid (hm_attrs_t *hm_device, uint opencl_num_devices, cl_device_id *devices);
|
||||
|
||||
#ifdef HAVE_ADL
|
||||
int get_adapters_num_amd (HM_LIB hm_dll_amd, int *iNumberAdapters);
|
||||
int get_adapters_num_amd (void *adl, int *iNumberAdapters);
|
||||
|
||||
int hm_get_adapter_index_amd (hm_attrs_t *hm_device, u32 *valid_adl_device_list, int num_adl_adapters, LPAdapterInfo lpAdapterInfo);
|
||||
|
||||
LPAdapterInfo hm_get_adapter_info_amd (HM_LIB hm_dll_amd, int iNumberAdapters);
|
||||
LPAdapterInfo hm_get_adapter_info_amd (void *adl, int iNumberAdapters);
|
||||
|
||||
u32 *hm_get_list_valid_adl_adapters (int iNumberAdapters, int *num_adl_adapters, LPAdapterInfo lpAdapterInfo);
|
||||
|
||||
int hm_get_overdrive_version (HM_LIB hm_dll_amd, hm_attrs_t *hm_device, u32 *valid_adl_device_list, int num_adl_adapters, LPAdapterInfo lpAdapterInfo);
|
||||
int hm_check_fanspeed_control (HM_LIB hm_dll_amd, hm_attrs_t *hm_device, u32 *valid_adl_device_list, int num_adl_adapters, LPAdapterInfo lpAdapterInfo);
|
||||
int hm_get_overdrive_version (void *adl, hm_attrs_t *hm_device, u32 *valid_adl_device_list, int num_adl_adapters, LPAdapterInfo lpAdapterInfo);
|
||||
int hm_check_fanspeed_control (void *adl, hm_attrs_t *hm_device, u32 *valid_adl_device_list, int num_adl_adapters, LPAdapterInfo lpAdapterInfo);
|
||||
#endif // HAVE_ADL
|
||||
|
||||
#if defined(HAVE_ADL) || defined(HAVE_NVML)
|
||||
|
@ -1058,10 +1058,10 @@ typedef struct
|
||||
int rule_len_r;
|
||||
|
||||
/**
|
||||
* opencl
|
||||
* opencl library stuff
|
||||
*/
|
||||
|
||||
void *ocl;
|
||||
void *ocl;
|
||||
|
||||
/**
|
||||
* hardware watchdog
|
||||
@ -1069,7 +1069,7 @@ typedef struct
|
||||
|
||||
#ifdef HAVE_HWMON
|
||||
HM_LIB hm_dll_nv;
|
||||
HM_LIB hm_dll_amd;
|
||||
void *adl;
|
||||
hm_attrs_t hm_device[DEVICES_MAX];
|
||||
#endif
|
||||
|
||||
|
@ -129,7 +129,13 @@ CFLAGS_NATIVE += $(CFLAGS)
|
||||
|
||||
LFLAGS_NATIVE := -lpthread
|
||||
|
||||
WITH_ADL := 0
|
||||
ifneq (,$(filter 1,$(WITH_ADL) $(WITH_NVML)))
|
||||
CFLAGS_NATIVE += -DHAVE_HWMON
|
||||
ifeq ($(WITH_ADL),1)
|
||||
CFLAGS_NATIVE += -DHAVE_ADL
|
||||
endif
|
||||
endif
|
||||
|
||||
WITH_NVML := 0
|
||||
endif
|
||||
|
||||
|
502
src/ext_ADL.c
502
src/ext_ADL.c
@ -5,25 +5,81 @@
|
||||
|
||||
#include <ext_ADL.h>
|
||||
|
||||
#ifdef _POSIX
|
||||
void *GetProcAddress (void *pLibrary, const char *name)
|
||||
int adl_init (ADL_PTR *adl)
|
||||
{
|
||||
return dlsym (pLibrary, name);
|
||||
}
|
||||
#endif
|
||||
if (!adl) return (-1);
|
||||
|
||||
int hc_ADL_Main_Control_Destroy (HM_LIB hDLL)
|
||||
{
|
||||
ADL_MAIN_CONTROL_DESTROY ADL_Main_Control_Destroy = (ADL_MAIN_CONTROL_DESTROY) GetProcAddress (hDLL, "ADL_Main_Control_Destroy");
|
||||
memset (adl, 0, sizeof (ADL_PTR));
|
||||
|
||||
if (ADL_Main_Control_Destroy == NULL)
|
||||
#ifdef _WIN
|
||||
if (!(adl->lib = hc_dlopen ("atiadlxx.dll")))
|
||||
{
|
||||
log_error ("ERROR: %s\n", "ADL_Main_Control_Destroy() is missing");
|
||||
adl->lib = hc_dlopen ("atiadlxy.dll");
|
||||
}
|
||||
#elif _POSIX
|
||||
adl->lib = hc_dlopen ("libatiadlxx.so", RTLD_NOW);
|
||||
#endif
|
||||
|
||||
exit (-1);
|
||||
if (!adl->lib)
|
||||
{
|
||||
if (data.quiet == 0)
|
||||
log_info ("WARNING: load ADL library failed, proceed without ADL HWMon enabled.");
|
||||
|
||||
return (-1);
|
||||
}
|
||||
|
||||
int ADL_rc = ADL_Main_Control_Destroy ();
|
||||
HC_LOAD_FUNC(adl, ADL_Main_Control_Destroy, ADL_MAIN_CONTROL_DESTROY, ADL, 0)
|
||||
HC_LOAD_FUNC(adl, ADL_Main_Control_Create, ADL_MAIN_CONTROL_CREATE, ADL, 0)
|
||||
HC_LOAD_FUNC(adl, ADL_Adapter_NumberOfAdapters_Get, ADL_ADAPTER_NUMBEROFADAPTERS_GET, ADL, 0)
|
||||
HC_LOAD_FUNC(adl, ADL_Adapter_AdapterInfo_Get, ADL_ADAPTER_ADAPTERINFO_GET, ADL, 0)
|
||||
HC_LOAD_FUNC(adl, ADL_Display_DisplayInfo_Get, ADL_DISPLAY_DISPLAYINFO_GET, ADL, 0)
|
||||
HC_LOAD_FUNC(adl, ADL_Adapter_ID_Get, ADL_ADAPTER_ID_GET, ADL, 0)
|
||||
HC_LOAD_FUNC(adl, ADL_Adapter_VideoBiosInfo_Get, ADL_ADAPTER_VIDEOBIOSINFO_GET, ADL, 0)
|
||||
HC_LOAD_FUNC(adl, ADL_Overdrive5_ThermalDevices_Enum, ADL_OVERDRIVE5_THERMALDEVICES_ENUM, ADL, 0)
|
||||
HC_LOAD_FUNC(adl, ADL_Overdrive5_Temperature_Get, ADL_OVERDRIVE5_TEMPERATURE_GET, ADL, 0)
|
||||
HC_LOAD_FUNC(adl, ADL_Overdrive6_Temperature_Get, ADL_OVERDRIVE6_TEMPERATURE_GET, ADL, 0)
|
||||
HC_LOAD_FUNC(adl, ADL_Overdrive5_CurrentActivity_Get, ADL_OVERDRIVE5_CURRENTACTIVITY_GET, ADL, 0)
|
||||
HC_LOAD_FUNC(adl, ADL_Overdrive5_FanSpeedInfo_Get, ADL_OVERDRIVE5_FANSPEEDINFO_GET, ADL, 0)
|
||||
HC_LOAD_FUNC(adl, ADL_Overdrive5_FanSpeed_Get, ADL_OVERDRIVE5_FANSPEED_GET, ADL, 0)
|
||||
HC_LOAD_FUNC(adl, ADL_Overdrive6_FanSpeed_Get, ADL_OVERDRIVE6_FANSPEED_GET, ADL, 0)
|
||||
HC_LOAD_FUNC(adl, ADL_Overdrive5_FanSpeed_Set, ADL_OVERDRIVE5_FANSPEED_SET, ADL, 0)
|
||||
HC_LOAD_FUNC(adl, ADL_Overdrive6_FanSpeed_Set, ADL_OVERDRIVE6_FANSPEED_SET, ADL, 0)
|
||||
HC_LOAD_FUNC(adl, ADL_Overdrive5_FanSpeedToDefault_Set, ADL_OVERDRIVE5_FANSPEEDTODEFAULT_SET, ADL, 0)
|
||||
HC_LOAD_FUNC(adl, ADL_Overdrive5_ODParameters_Get, ADL_OVERDRIVE5_ODPARAMETERS_GET, ADL, 0)
|
||||
HC_LOAD_FUNC(adl, ADL_Overdrive5_ODPerformanceLevels_Get, ADL_OVERDRIVE5_ODPERFORMANCELEVELS_GET, ADL, 0)
|
||||
HC_LOAD_FUNC(adl, ADL_Overdrive5_ODPerformanceLevels_Set, ADL_OVERDRIVE5_ODPERFORMANCELEVELS_SET, ADL, 0)
|
||||
HC_LOAD_FUNC(adl, ADL_Overdrive6_PowerControlInfo_Get, ADL_OVERDRIVE6_POWERCONTROLINFO_GET, ADL, 0)
|
||||
HC_LOAD_FUNC(adl, ADL_Overdrive6_PowerControl_Get, ADL_OVERDRIVE6_POWERCONTROL_GET, ADL, 0)
|
||||
HC_LOAD_FUNC(adl, ADL_Overdrive6_PowerControl_Set, ADL_OVERDRIVE6_POWERCONTROL_SET, ADL, 0)
|
||||
HC_LOAD_FUNC(adl, ADL_Adapter_Active_Get, ADL_ADAPTER_ACTIVE_GET, ADL, 0)
|
||||
HC_LOAD_FUNC(adl, ADL_DisplayEnable_Set, ADL_DISPLAYENABLE_SET, ADL, 0)
|
||||
HC_LOAD_FUNC(adl, ADL_Overdrive_Caps, ADL_OVERDRIVE_CAPS, ADL, 0)
|
||||
HC_LOAD_FUNC(adl, ADL_Overdrive6_PowerControl_Caps, ADL_OVERDRIVE6_POWERCONTROL_CAPS, ADL, 0)
|
||||
HC_LOAD_FUNC(adl, ADL_Overdrive6_Capabilities_Get, ADL_OVERDRIVE6_CAPABILITIES_GET, ADL, 0)
|
||||
HC_LOAD_FUNC(adl, ADL_Overdrive6_StateInfo_Get, ADL_OVERDRIVE6_STATEINFO_GET, ADL, 0)
|
||||
HC_LOAD_FUNC(adl, ADL_Overdrive6_CurrentStatus_Get, ADL_OVERDRIVE6_CURRENTSTATUS_GET, ADL, 0)
|
||||
HC_LOAD_FUNC(adl, ADL_Overdrive6_State_Set, ADL_OVERDRIVE6_STATE_SET, ADL, 0)
|
||||
HC_LOAD_FUNC(adl, ADL_Overdrive6_TargetTemperatureData_Get, ADL_OVERDRIVE6_TARGETTEMPERATUREDATA_GET, ADL, 0)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void adl_close (ADL_PTR *adl)
|
||||
{
|
||||
if (adl)
|
||||
{
|
||||
if (adl->lib)
|
||||
hc_dlclose (adl->lib);
|
||||
|
||||
myfree (adl);
|
||||
}
|
||||
}
|
||||
|
||||
int hc_ADL_Main_Control_Destroy (ADL_PTR *adl)
|
||||
{
|
||||
if (!adl) return (-1);
|
||||
|
||||
int ADL_rc = adl->ADL_Main_Control_Destroy ();
|
||||
|
||||
if (ADL_rc != ADL_OK)
|
||||
{
|
||||
@ -33,18 +89,11 @@ int hc_ADL_Main_Control_Destroy (HM_LIB hDLL)
|
||||
return (ADL_rc);
|
||||
}
|
||||
|
||||
int hc_ADL_Main_Control_Create (HM_LIB hDLL, ADL_MAIN_MALLOC_CALLBACK callback, int iEnumConnectedAdapters)
|
||||
int hc_ADL_Main_Control_Create (ADL_PTR *adl, ADL_MAIN_MALLOC_CALLBACK callback, int iEnumConnectedAdapters)
|
||||
{
|
||||
ADL_MAIN_CONTROL_CREATE ADL_Main_Control_Create = (ADL_MAIN_CONTROL_CREATE) GetProcAddress (hDLL, "ADL_Main_Control_Create");
|
||||
if (!adl) return (-1);
|
||||
|
||||
if (ADL_Main_Control_Create == NULL)
|
||||
{
|
||||
log_error ("ERROR: %s\n", "ADL_Main_Control_Create() is missing");
|
||||
|
||||
exit (-1);
|
||||
}
|
||||
|
||||
int ADL_rc = ADL_Main_Control_Create (callback, iEnumConnectedAdapters);
|
||||
int ADL_rc = adl->ADL_Main_Control_Create (callback, iEnumConnectedAdapters);
|
||||
|
||||
if (ADL_rc != ADL_OK)
|
||||
{
|
||||
@ -54,18 +103,11 @@ int hc_ADL_Main_Control_Create (HM_LIB hDLL, ADL_MAIN_MALLOC_CALLBACK callback,
|
||||
return (ADL_rc);
|
||||
}
|
||||
|
||||
int hc_ADL_Adapter_NumberOfAdapters_Get (HM_LIB hDLL, int *lpNumAdapters)
|
||||
int hc_ADL_Adapter_NumberOfAdapters_Get (ADL_PTR *adl, int *lpNumAdapters)
|
||||
{
|
||||
ADL_ADAPTER_NUMBEROFADAPTERS_GET ADL_Adapter_NumberOfAdapters_Get = (ADL_ADAPTER_NUMBEROFADAPTERS_GET) GetProcAddress (hDLL, "ADL_Adapter_NumberOfAdapters_Get");
|
||||
if (!adl) return (-1);
|
||||
|
||||
if (ADL_Adapter_NumberOfAdapters_Get == NULL)
|
||||
{
|
||||
log_error ("ERROR: %s\n", "ADL_Adapter_NumberOfAdapters_Get() is missing");
|
||||
|
||||
exit (-1);
|
||||
}
|
||||
|
||||
int ADL_rc = ADL_Adapter_NumberOfAdapters_Get (lpNumAdapters);
|
||||
int ADL_rc = adl->ADL_Adapter_NumberOfAdapters_Get (lpNumAdapters);
|
||||
|
||||
if (ADL_rc != ADL_OK)
|
||||
{
|
||||
@ -75,18 +117,11 @@ int hc_ADL_Adapter_NumberOfAdapters_Get (HM_LIB hDLL, int *lpNumAdapters)
|
||||
return (ADL_rc);
|
||||
}
|
||||
|
||||
int hc_ADL_Adapter_AdapterInfo_Get (HM_LIB hDLL, LPAdapterInfo lpInfo, int iInputSize)
|
||||
int hc_ADL_Adapter_AdapterInfo_Get (ADL_PTR *adl, LPAdapterInfo lpInfo, int iInputSize)
|
||||
{
|
||||
ADL_ADAPTER_ADAPTERINFO_GET ADL_Adapter_AdapterInfo_Get = (ADL_ADAPTER_ADAPTERINFO_GET) GetProcAddress (hDLL, "ADL_Adapter_AdapterInfo_Get");
|
||||
if (!adl) return (-1);
|
||||
|
||||
if (ADL_Adapter_AdapterInfo_Get == NULL)
|
||||
{
|
||||
log_error ("ERROR: %s\n", "ADL_Adapter_AdapterInfo_Get() is missing");
|
||||
|
||||
exit (-1);
|
||||
}
|
||||
|
||||
int ADL_rc = ADL_Adapter_AdapterInfo_Get (lpInfo, iInputSize);
|
||||
int ADL_rc = adl->ADL_Adapter_AdapterInfo_Get (lpInfo, iInputSize);
|
||||
|
||||
if (ADL_rc != ADL_OK)
|
||||
{
|
||||
@ -96,18 +131,11 @@ int hc_ADL_Adapter_AdapterInfo_Get (HM_LIB hDLL, LPAdapterInfo lpInfo, int iInpu
|
||||
return (ADL_rc);
|
||||
}
|
||||
|
||||
int hc_ADL_Display_DisplayInfo_Get (HM_LIB hDLL, int iAdapterIndex, int *iNumDisplays, ADLDisplayInfo **lppInfo, int iForceDetect)
|
||||
int hc_ADL_Display_DisplayInfo_Get (ADL_PTR *adl, int iAdapterIndex, int *iNumDisplays, ADLDisplayInfo **lppInfo, int iForceDetect)
|
||||
{
|
||||
ADL_DISPLAY_DISPLAYINFO_GET ADL_Display_DisplayInfo_Get = (ADL_DISPLAY_DISPLAYINFO_GET) GetProcAddress (hDLL, "ADL_Display_DisplayInfo_Get");
|
||||
if (!adl) return (-1);
|
||||
|
||||
if (ADL_Display_DisplayInfo_Get == NULL)
|
||||
{
|
||||
log_error ("ERROR: %s\n", "ADL_Display_DisplayInfo_Get() is missing");
|
||||
|
||||
exit (-1);
|
||||
}
|
||||
|
||||
int ADL_rc = ADL_Display_DisplayInfo_Get (iAdapterIndex, iNumDisplays, lppInfo, iForceDetect);
|
||||
int ADL_rc = adl->ADL_Display_DisplayInfo_Get (iAdapterIndex, iNumDisplays, lppInfo, iForceDetect);
|
||||
|
||||
if (ADL_rc != ADL_OK)
|
||||
{
|
||||
@ -117,18 +145,11 @@ int hc_ADL_Display_DisplayInfo_Get (HM_LIB hDLL, int iAdapterIndex, int *iNumDis
|
||||
return (ADL_rc);
|
||||
}
|
||||
|
||||
int hc_ADL_Adapter_ID_Get (HM_LIB hDLL, int iAdapterIndex, int *lpAdapterID)
|
||||
int hc_ADL_Adapter_ID_Get (ADL_PTR *adl, int iAdapterIndex, int *lpAdapterID)
|
||||
{
|
||||
HC_ADL_ADAPTER_ID_GET ADL_Adapter_ID_Get = (HC_ADL_ADAPTER_ID_GET) GetProcAddress (hDLL, "ADL_Adapter_ID_Get");
|
||||
if (!adl) return (-1);
|
||||
|
||||
if (ADL_Adapter_ID_Get == NULL)
|
||||
{
|
||||
log_error ("ERROR: %s\n", "ADL_Adapter_ID_Get() is missing");
|
||||
|
||||
exit (-1);
|
||||
}
|
||||
|
||||
int ADL_rc = ADL_Adapter_ID_Get (iAdapterIndex, lpAdapterID);
|
||||
int ADL_rc = adl->ADL_Adapter_ID_Get (iAdapterIndex, lpAdapterID);
|
||||
|
||||
if (ADL_rc != ADL_OK)
|
||||
{
|
||||
@ -138,18 +159,11 @@ int hc_ADL_Adapter_ID_Get (HM_LIB hDLL, int iAdapterIndex, int *lpAdapterID)
|
||||
return ADL_rc;
|
||||
}
|
||||
|
||||
int hc_ADL_Adapter_VideoBiosInfo_Get (HM_LIB hDLL, int iAdapterIndex, ADLBiosInfo *lpBiosInfo)
|
||||
int hc_ADL_Adapter_VideoBiosInfo_Get (ADL_PTR *adl, int iAdapterIndex, ADLBiosInfo *lpBiosInfo)
|
||||
{
|
||||
HC_ADL_ADAPTER_VIDEOBIOSINFO_GET ADL_Adapter_VideoBiosInfo_Get = (HC_ADL_ADAPTER_VIDEOBIOSINFO_GET) GetProcAddress (hDLL, "ADL_Adapter_VideoBiosInfo_Get");
|
||||
if (!adl) return (-1);
|
||||
|
||||
if (ADL_Adapter_VideoBiosInfo_Get == NULL)
|
||||
{
|
||||
log_error ("ERROR: %s\n", "ADL_Adapter_VideoBiosInfo_Get() is missing");
|
||||
|
||||
exit (-1);
|
||||
}
|
||||
|
||||
int ADL_rc = ADL_Adapter_VideoBiosInfo_Get (iAdapterIndex, lpBiosInfo);
|
||||
int ADL_rc = adl->ADL_Adapter_VideoBiosInfo_Get (iAdapterIndex, lpBiosInfo);
|
||||
|
||||
if (ADL_rc != ADL_OK)
|
||||
{
|
||||
@ -159,18 +173,11 @@ int hc_ADL_Adapter_VideoBiosInfo_Get (HM_LIB hDLL, int iAdapterIndex, ADLBiosInf
|
||||
return ADL_rc;
|
||||
}
|
||||
|
||||
int hc_ADL_Overdrive_ThermalDevices_Enum (HM_LIB hDLL, int iAdapterIndex, int iThermalControllerIndex, ADLThermalControllerInfo *lpThermalControllerInfo)
|
||||
int hc_ADL_Overdrive_ThermalDevices_Enum (ADL_PTR *adl, int iAdapterIndex, int iThermalControllerIndex, ADLThermalControllerInfo *lpThermalControllerInfo)
|
||||
{
|
||||
HC_ADL_OVERDRIVE5_THERMALDEVICES_ENUM ADL_Overdrive5_ThermalDevices_Enum = (HC_ADL_OVERDRIVE5_THERMALDEVICES_ENUM) GetProcAddress (hDLL, "ADL_Overdrive5_ThermalDevices_Enum");
|
||||
if (!adl) return (-1);
|
||||
|
||||
if (ADL_Overdrive5_ThermalDevices_Enum == NULL)
|
||||
{
|
||||
log_error ("ERROR: %s\n", "ADL_Overdrive5_ThermalDevices_Enum() is missing");
|
||||
|
||||
exit (-1);
|
||||
}
|
||||
|
||||
int ADL_rc = ADL_Overdrive5_ThermalDevices_Enum (iAdapterIndex, iThermalControllerIndex, lpThermalControllerInfo);
|
||||
int ADL_rc = adl->ADL_Overdrive5_ThermalDevices_Enum (iAdapterIndex, iThermalControllerIndex, lpThermalControllerInfo);
|
||||
|
||||
if (ADL_rc != ADL_OK)
|
||||
{
|
||||
@ -180,18 +187,11 @@ int hc_ADL_Overdrive_ThermalDevices_Enum (HM_LIB hDLL, int iAdapterIndex, int iT
|
||||
return (ADL_rc);
|
||||
}
|
||||
|
||||
int hc_ADL_Overdrive5_Temperature_Get (HM_LIB hDLL, int iAdapterIndex, int iThermalControllerIndex, ADLTemperature *lpTemperature)
|
||||
int hc_ADL_Overdrive5_Temperature_Get (ADL_PTR *adl, int iAdapterIndex, int iThermalControllerIndex, ADLTemperature *lpTemperature)
|
||||
{
|
||||
ADL_OVERDRIVE5_TEMPERATURE_GET ADL_Overdrive5_Temperature_Get = (ADL_OVERDRIVE5_TEMPERATURE_GET) GetProcAddress (hDLL, "ADL_Overdrive5_Temperature_Get");
|
||||
if (!adl) return (-1);
|
||||
|
||||
if (ADL_Overdrive5_Temperature_Get == NULL)
|
||||
{
|
||||
log_error ("ERROR: %s\n", "ADL_Overdrive5_Temperature_Get() is missing");
|
||||
|
||||
exit (-1);
|
||||
}
|
||||
|
||||
int ADL_rc = ADL_Overdrive5_Temperature_Get (iAdapterIndex, iThermalControllerIndex, lpTemperature);
|
||||
int ADL_rc = adl->ADL_Overdrive5_Temperature_Get (iAdapterIndex, iThermalControllerIndex, lpTemperature);
|
||||
|
||||
if (ADL_rc != ADL_OK)
|
||||
{
|
||||
@ -201,18 +201,11 @@ int hc_ADL_Overdrive5_Temperature_Get (HM_LIB hDLL, int iAdapterIndex, int iTher
|
||||
return (ADL_rc);
|
||||
}
|
||||
|
||||
int hc_ADL_Overdrive6_Temperature_Get (HM_LIB hDLL, int iAdapterIndex, int *iTemperature)
|
||||
int hc_ADL_Overdrive6_Temperature_Get (ADL_PTR *adl, int iAdapterIndex, int *iTemperature)
|
||||
{
|
||||
ADL_OVERDRIVE6_TEMPERATURE_GET ADL_Overdrive6_Temperature_Get = (ADL_OVERDRIVE6_TEMPERATURE_GET) GetProcAddress (hDLL, "ADL_Overdrive6_Temperature_Get");
|
||||
if (!adl) return (-1);
|
||||
|
||||
if (ADL_Overdrive6_Temperature_Get == NULL)
|
||||
{
|
||||
log_error ("ERROR: %s\n", "ADL_Overdrive6_Temperature_Get() is missing");
|
||||
|
||||
exit (-1);
|
||||
}
|
||||
|
||||
int ADL_rc = ADL_Overdrive6_Temperature_Get (iAdapterIndex, iTemperature);
|
||||
int ADL_rc = adl->ADL_Overdrive6_Temperature_Get (iAdapterIndex, iTemperature);
|
||||
|
||||
if (ADL_rc != ADL_OK)
|
||||
{
|
||||
@ -222,18 +215,11 @@ int hc_ADL_Overdrive6_Temperature_Get (HM_LIB hDLL, int iAdapterIndex, int *iTem
|
||||
return (ADL_rc);
|
||||
}
|
||||
|
||||
int hc_ADL_Overdrive_CurrentActivity_Get (HM_LIB hDLL, int iAdapterIndex, ADLPMActivity *lpActivity)
|
||||
int hc_ADL_Overdrive_CurrentActivity_Get (ADL_PTR *adl, int iAdapterIndex, ADLPMActivity *lpActivity)
|
||||
{
|
||||
HC_ADL_OVERDRIVE5_CURRENTACTIVITY_GET ADL_Overdrive5_CurrentActivity_Get = (HC_ADL_OVERDRIVE5_CURRENTACTIVITY_GET) GetProcAddress (hDLL, "ADL_Overdrive5_CurrentActivity_Get");
|
||||
if (!adl) return (-1);
|
||||
|
||||
if (ADL_Overdrive5_CurrentActivity_Get == NULL)
|
||||
{
|
||||
log_error ("ERROR: %s\n", "ADL_Overdrive5_CurrentActivity_Get() is missing");
|
||||
|
||||
exit (-1);
|
||||
}
|
||||
|
||||
int ADL_rc = ADL_Overdrive5_CurrentActivity_Get (iAdapterIndex, lpActivity);
|
||||
int ADL_rc = adl->ADL_Overdrive5_CurrentActivity_Get (iAdapterIndex, lpActivity);
|
||||
|
||||
if (ADL_rc != ADL_OK)
|
||||
{
|
||||
@ -243,18 +229,11 @@ int hc_ADL_Overdrive_CurrentActivity_Get (HM_LIB hDLL, int iAdapterIndex, ADLPMA
|
||||
return (ADL_rc);
|
||||
}
|
||||
|
||||
int hc_ADL_Overdrive5_FanSpeedInfo_Get (HM_LIB hDLL, int iAdapterIndex, int iThermalControllerIndex, ADLFanSpeedInfo *lpFanSpeedInfo)
|
||||
int hc_ADL_Overdrive5_FanSpeedInfo_Get (ADL_PTR *adl, int iAdapterIndex, int iThermalControllerIndex, ADLFanSpeedInfo *lpFanSpeedInfo)
|
||||
{
|
||||
HC_ADL_OVERDRIVE5_FANSPEEDINFO_GET ADL_Overdrive5_FanSpeedInfo_Get = (HC_ADL_OVERDRIVE5_FANSPEEDINFO_GET) GetProcAddress (hDLL, "ADL_Overdrive5_FanSpeedInfo_Get");
|
||||
if (!adl) return (-1);
|
||||
|
||||
if (ADL_Overdrive5_FanSpeedInfo_Get == NULL)
|
||||
{
|
||||
log_error ("ERROR: %s\n", "ADL_Overdrive5_FanSpeedInfo_Get() is missing");
|
||||
|
||||
exit (-1);
|
||||
}
|
||||
|
||||
int ADL_rc = ADL_Overdrive5_FanSpeedInfo_Get (iAdapterIndex, iThermalControllerIndex, lpFanSpeedInfo);
|
||||
int ADL_rc = adl->ADL_Overdrive5_FanSpeedInfo_Get (iAdapterIndex, iThermalControllerIndex, lpFanSpeedInfo);
|
||||
|
||||
if (ADL_rc != ADL_OK)
|
||||
{
|
||||
@ -264,18 +243,11 @@ int hc_ADL_Overdrive5_FanSpeedInfo_Get (HM_LIB hDLL, int iAdapterIndex, int iThe
|
||||
return ADL_rc;
|
||||
}
|
||||
|
||||
int hc_ADL_Overdrive5_FanSpeed_Get (HM_LIB hDLL, int iAdapterIndex, int iThermalControllerIndex, ADLFanSpeedValue *lpFanSpeedValue)
|
||||
int hc_ADL_Overdrive5_FanSpeed_Get (ADL_PTR *adl, int iAdapterIndex, int iThermalControllerIndex, ADLFanSpeedValue *lpFanSpeedValue)
|
||||
{
|
||||
ADL_OVERDRIVE5_FANSPEED_GET ADL_Overdrive5_FanSpeed_Get = (ADL_OVERDRIVE5_FANSPEED_GET) GetProcAddress (hDLL, "ADL_Overdrive5_FanSpeed_Get");
|
||||
if (!adl) return (-1);
|
||||
|
||||
if (ADL_Overdrive5_FanSpeed_Get == NULL)
|
||||
{
|
||||
log_error ("ERROR: %s\n", "ADL_Overdrive5_FanSpeed_Get() is missing");
|
||||
|
||||
exit (-1);
|
||||
}
|
||||
|
||||
int ADL_rc = ADL_Overdrive5_FanSpeed_Get (iAdapterIndex, iThermalControllerIndex, lpFanSpeedValue);
|
||||
int ADL_rc = adl->ADL_Overdrive5_FanSpeed_Get (iAdapterIndex, iThermalControllerIndex, lpFanSpeedValue);
|
||||
|
||||
if ((ADL_rc != ADL_OK) && (ADL_rc != ADL_ERR_NOT_SUPPORTED)) // exception allowed only here
|
||||
{
|
||||
@ -285,18 +257,11 @@ int hc_ADL_Overdrive5_FanSpeed_Get (HM_LIB hDLL, int iAdapterIndex, int iThermal
|
||||
return (ADL_rc);
|
||||
}
|
||||
|
||||
int hc_ADL_Overdrive6_FanSpeed_Get (HM_LIB hDLL, int iAdapterIndex, ADLOD6FanSpeedInfo *lpFanSpeedInfo)
|
||||
int hc_ADL_Overdrive6_FanSpeed_Get (ADL_PTR *adl, int iAdapterIndex, ADLOD6FanSpeedInfo *lpFanSpeedInfo)
|
||||
{
|
||||
ADL_OVERDRIVE6_FANSPEED_GET ADL_Overdrive6_FanSpeed_Get = (ADL_OVERDRIVE6_FANSPEED_GET) GetProcAddress (hDLL, "ADL_Overdrive6_FanSpeed_Get");
|
||||
if (!adl) return (-1);
|
||||
|
||||
if (ADL_Overdrive6_FanSpeed_Get == NULL)
|
||||
{
|
||||
log_error ("ERROR: %s\n", "ADL_Overdrive6_FanSpeed_Get() is missing");
|
||||
|
||||
exit (-1);
|
||||
}
|
||||
|
||||
int ADL_rc = ADL_Overdrive6_FanSpeed_Get (iAdapterIndex, lpFanSpeedInfo);
|
||||
int ADL_rc = adl->ADL_Overdrive6_FanSpeed_Get (iAdapterIndex, lpFanSpeedInfo);
|
||||
|
||||
if ((ADL_rc != ADL_OK) && (ADL_rc != ADL_ERR_NOT_SUPPORTED)) // exception allowed only here
|
||||
{
|
||||
@ -306,18 +271,11 @@ int hc_ADL_Overdrive6_FanSpeed_Get (HM_LIB hDLL, int iAdapterIndex, ADLOD6FanSpe
|
||||
return (ADL_rc);
|
||||
}
|
||||
|
||||
int hc_ADL_Overdrive5_FanSpeed_Set (HM_LIB hDLL, int iAdapterIndex, int iThermalControllerIndex, ADLFanSpeedValue *lpFanSpeedValue)
|
||||
int hc_ADL_Overdrive5_FanSpeed_Set (ADL_PTR *adl, int iAdapterIndex, int iThermalControllerIndex, ADLFanSpeedValue *lpFanSpeedValue)
|
||||
{
|
||||
ADL_OVERDRIVE5_FANSPEED_SET ADL_Overdrive5_FanSpeed_Set = (ADL_OVERDRIVE5_FANSPEED_SET) GetProcAddress (hDLL, "ADL_Overdrive5_FanSpeed_Set");
|
||||
if (!adl) return (-1);
|
||||
|
||||
if (ADL_Overdrive5_FanSpeed_Set == NULL)
|
||||
{
|
||||
log_error ("ERROR: %s\n", "ADL_Overdrive5_FanSpeed_Set() is missing");
|
||||
|
||||
exit (-1);
|
||||
}
|
||||
|
||||
int ADL_rc = ADL_Overdrive5_FanSpeed_Set (iAdapterIndex, iThermalControllerIndex, lpFanSpeedValue);
|
||||
int ADL_rc = adl->ADL_Overdrive5_FanSpeed_Set (iAdapterIndex, iThermalControllerIndex, lpFanSpeedValue);
|
||||
|
||||
if ((ADL_rc != ADL_OK) && (ADL_rc != ADL_ERR_NOT_SUPPORTED)) // exception allowed only here
|
||||
{
|
||||
@ -327,18 +285,11 @@ int hc_ADL_Overdrive5_FanSpeed_Set (HM_LIB hDLL, int iAdapterIndex, int iThermal
|
||||
return (ADL_rc);
|
||||
}
|
||||
|
||||
int hc_ADL_Overdrive6_FanSpeed_Set (HM_LIB hDLL, int iAdapterIndex, ADLOD6FanSpeedValue *lpFanSpeedValue)
|
||||
int hc_ADL_Overdrive6_FanSpeed_Set (ADL_PTR *adl, int iAdapterIndex, ADLOD6FanSpeedValue *lpFanSpeedValue)
|
||||
{
|
||||
ADL_OVERDRIVE6_FANSPEED_SET ADL_Overdrive6_FanSpeed_Set = (ADL_OVERDRIVE6_FANSPEED_SET) GetProcAddress (hDLL, "ADL_Overdrive6_FanSpeed_Set");
|
||||
if (!adl) return (-1);
|
||||
|
||||
if (ADL_Overdrive6_FanSpeed_Set == NULL)
|
||||
{
|
||||
log_error ("ERROR: %s\n", "ADL_Overdrive6_FanSpeed_Set() is missing");
|
||||
|
||||
exit (-1);
|
||||
}
|
||||
|
||||
int ADL_rc = ADL_Overdrive6_FanSpeed_Set (iAdapterIndex, lpFanSpeedValue);
|
||||
int ADL_rc = adl->ADL_Overdrive6_FanSpeed_Set (iAdapterIndex, lpFanSpeedValue);
|
||||
|
||||
if ((ADL_rc != ADL_OK) && (ADL_rc != ADL_ERR_NOT_SUPPORTED)) // exception allowed only here
|
||||
{
|
||||
@ -348,18 +299,11 @@ int hc_ADL_Overdrive6_FanSpeed_Set (HM_LIB hDLL, int iAdapterIndex, ADLOD6FanSpe
|
||||
return (ADL_rc);
|
||||
}
|
||||
|
||||
int hc_ADL_Overdrive5_FanSpeedToDefault_Set (HM_LIB hDLL, int iAdapterIndex, int iThermalControllerIndex)
|
||||
int hc_ADL_Overdrive5_FanSpeedToDefault_Set (ADL_PTR *adl, int iAdapterIndex, int iThermalControllerIndex)
|
||||
{
|
||||
ADL_OVERDRIVE5_FANSPEEDTODEFAULT_SET ADL_Overdrive5_FanSpeedToDefault_Set = (ADL_OVERDRIVE5_FANSPEEDTODEFAULT_SET) GetProcAddress (hDLL, "ADL_Overdrive5_FanSpeedToDefault_Set");
|
||||
if (!adl) return (-1);
|
||||
|
||||
if (ADL_Overdrive5_FanSpeedToDefault_Set == NULL)
|
||||
{
|
||||
log_error ("ERROR: %s\n", "ADL_Overdrive5_FanSpeedToDefault_Set() is missing");
|
||||
|
||||
exit (-1);
|
||||
}
|
||||
|
||||
int ADL_rc = ADL_Overdrive5_FanSpeedToDefault_Set (iAdapterIndex, iThermalControllerIndex);
|
||||
int ADL_rc = adl->ADL_Overdrive5_FanSpeedToDefault_Set (iAdapterIndex, iThermalControllerIndex);
|
||||
|
||||
if ((ADL_rc != ADL_OK) && (ADL_rc != ADL_ERR_NOT_SUPPORTED)) // exception allowed only here
|
||||
{
|
||||
@ -369,18 +313,11 @@ int hc_ADL_Overdrive5_FanSpeedToDefault_Set (HM_LIB hDLL, int iAdapterIndex, int
|
||||
return (ADL_rc);
|
||||
}
|
||||
|
||||
int hc_ADL_Overdrive_ODParameters_Get (HM_LIB hDLL, int iAdapterIndex, ADLODParameters *lpOdParameters)
|
||||
int hc_ADL_Overdrive_ODParameters_Get (ADL_PTR *adl, int iAdapterIndex, ADLODParameters *lpOdParameters)
|
||||
{
|
||||
HC_ADL_OVERDRIVE5_ODPARAMETERS_GET ADL_Overdrive5_ODParameters_Get = (HC_ADL_OVERDRIVE5_ODPARAMETERS_GET) GetProcAddress (hDLL, "ADL_Overdrive5_ODParameters_Get");
|
||||
if (!adl) return (-1);
|
||||
|
||||
if (ADL_Overdrive5_ODParameters_Get == NULL)
|
||||
{
|
||||
log_error ("ERROR: %s\n", "ADL_Overdrive5_ODParameters_Get() is missing");
|
||||
|
||||
exit (-1);
|
||||
}
|
||||
|
||||
int ADL_rc = ADL_Overdrive5_ODParameters_Get (iAdapterIndex, lpOdParameters);
|
||||
int ADL_rc = adl->ADL_Overdrive5_ODParameters_Get (iAdapterIndex, lpOdParameters);
|
||||
|
||||
if (ADL_rc != ADL_OK)
|
||||
{
|
||||
@ -390,18 +327,11 @@ int hc_ADL_Overdrive_ODParameters_Get (HM_LIB hDLL, int iAdapterIndex, ADLODPara
|
||||
return (ADL_rc);
|
||||
}
|
||||
|
||||
int hc_ADL_Overdrive_ODPerformanceLevels_Get (HM_LIB hDLL, int iAdapterIndex, int iDefault, ADLODPerformanceLevels *lpOdPerformanceLevels)
|
||||
int hc_ADL_Overdrive_ODPerformanceLevels_Get (ADL_PTR *adl, int iAdapterIndex, int iDefault, ADLODPerformanceLevels *lpOdPerformanceLevels)
|
||||
{
|
||||
HC_ADL_OVERDRIVE5_ODPERFORMANCELEVELS_GET ADL_Overdrive5_ODPerformanceLevels_Get = (HC_ADL_OVERDRIVE5_ODPERFORMANCELEVELS_GET) GetProcAddress (hDLL, "ADL_Overdrive5_ODPerformanceLevels_Get");
|
||||
if (!adl) return (-1);
|
||||
|
||||
if (ADL_Overdrive5_ODPerformanceLevels_Get == NULL)
|
||||
{
|
||||
log_error ("ERROR: %s\n", "ADL_Overdrive5_ODPerformanceLevels_Get() is missing");
|
||||
|
||||
exit (-1);
|
||||
}
|
||||
|
||||
int ADL_rc = ADL_Overdrive5_ODPerformanceLevels_Get (iAdapterIndex, iDefault, lpOdPerformanceLevels);
|
||||
int ADL_rc = adl->ADL_Overdrive5_ODPerformanceLevels_Get (iAdapterIndex, iDefault, lpOdPerformanceLevels);
|
||||
|
||||
if (ADL_rc != ADL_OK)
|
||||
{
|
||||
@ -411,18 +341,11 @@ int hc_ADL_Overdrive_ODPerformanceLevels_Get (HM_LIB hDLL, int iAdapterIndex, in
|
||||
return (ADL_rc);
|
||||
}
|
||||
|
||||
int hc_ADL_Overdrive_ODPerformanceLevels_Set (HM_LIB hDLL, int iAdapterIndex, ADLODPerformanceLevels *lpOdPerformanceLevels)
|
||||
int hc_ADL_Overdrive_ODPerformanceLevels_Set (ADL_PTR *adl, int iAdapterIndex, ADLODPerformanceLevels *lpOdPerformanceLevels)
|
||||
{
|
||||
HC_ADL_OVERDRIVE5_ODPERFORMANCELEVELS_SET ADL_Overdrive5_ODPerformanceLevels_Set = (HC_ADL_OVERDRIVE5_ODPERFORMANCELEVELS_SET) GetProcAddress (hDLL, "ADL_Overdrive5_ODPerformanceLevels_Set");
|
||||
if (!adl) return (-1);
|
||||
|
||||
if (ADL_Overdrive5_ODPerformanceLevels_Set == NULL)
|
||||
{
|
||||
log_error ("ERROR: %s\n", "ADL_Overdrive5_ODPerformanceLevels_Set() is missing");
|
||||
|
||||
exit (-1);
|
||||
}
|
||||
|
||||
int ADL_rc = ADL_Overdrive5_ODPerformanceLevels_Set (iAdapterIndex, lpOdPerformanceLevels);
|
||||
int ADL_rc = adl->ADL_Overdrive5_ODPerformanceLevels_Set (iAdapterIndex, lpOdPerformanceLevels);
|
||||
|
||||
if (ADL_rc != ADL_OK)
|
||||
{
|
||||
@ -432,49 +355,35 @@ int hc_ADL_Overdrive_ODPerformanceLevels_Set (HM_LIB hDLL, int iAdapterIndex, AD
|
||||
return (ADL_rc);
|
||||
}
|
||||
|
||||
int hc_ADL_Overdrive_PowerControlInfo_Get (HM_LIB hDLL, int iAdapterIndex, ADLOD6PowerControlInfo *powertune)
|
||||
int hc_ADL_Overdrive_PowerControlInfo_Get (ADL_PTR *adl, int iAdapterIndex, ADLOD6PowerControlInfo *powertune)
|
||||
{
|
||||
HC_ADL_OVERDRIVE6_POWERCONTROLINFO_GET ADL_Overdrive6_PowerControlInfo_Get = (HC_ADL_OVERDRIVE6_POWERCONTROLINFO_GET) GetProcAddress (hDLL, "ADL_Overdrive6_PowerControlInfo_Get");
|
||||
if (!adl) return (-1);
|
||||
|
||||
if (ADL_Overdrive6_PowerControlInfo_Get == NULL)
|
||||
{
|
||||
log_error ("ERROR: %s\n", "ADL_Overdrive6_PowerControlInfo_Get is missing");
|
||||
|
||||
exit (-1);
|
||||
}
|
||||
|
||||
int ADL_rc = ADL_Overdrive6_PowerControlInfo_Get (iAdapterIndex, powertune);
|
||||
int ADL_rc = adl->ADL_Overdrive6_PowerControlInfo_Get (iAdapterIndex, powertune);
|
||||
|
||||
return (ADL_rc);
|
||||
}
|
||||
|
||||
int hc_ADL_Overdrive_PowerControl_Get (HM_LIB hDLL, int iAdapterIndex, int *iCurrentValue)
|
||||
int hc_ADL_Overdrive_PowerControl_Get (ADL_PTR *adl, int iAdapterIndex, int *iCurrentValue)
|
||||
{
|
||||
HC_ADL_OVERDRIVE6_POWERCONTROL_GET ADL_Overdrive6_PowerControl_Get = (HC_ADL_OVERDRIVE6_POWERCONTROL_GET) GetProcAddress (hDLL, "ADL_Overdrive6_PowerControl_Get");
|
||||
|
||||
if (ADL_Overdrive6_PowerControl_Get == NULL)
|
||||
{
|
||||
log_error ("ERROR: %s\n", "ADL_Overdrive6_PowerControl_Get is missing");
|
||||
|
||||
exit (-1);
|
||||
}
|
||||
if (!adl) return (-1);
|
||||
|
||||
int default_value = 0;
|
||||
|
||||
int ADL_rc = ADL_Overdrive6_PowerControl_Get (iAdapterIndex, iCurrentValue, &default_value);
|
||||
int ADL_rc = adl->ADL_Overdrive6_PowerControl_Get (iAdapterIndex, iCurrentValue, &default_value);
|
||||
|
||||
return (ADL_rc);
|
||||
}
|
||||
|
||||
int hc_ADL_Overdrive_PowerControl_Set (HM_LIB hDLL, int iAdapterIndex, int level)
|
||||
int hc_ADL_Overdrive_PowerControl_Set (ADL_PTR *adl, int iAdapterIndex, int level)
|
||||
{
|
||||
HC_ADL_OVERDRIVE6_POWERCONTROL_SET ADL_Overdrive6_PowerControl_Set = (HC_ADL_OVERDRIVE6_POWERCONTROL_SET) GetProcAddress (hDLL, "ADL_Overdrive6_PowerControl_Set");
|
||||
if (!adl) return (-1);
|
||||
|
||||
int ADL_rc = ADL_ERR;
|
||||
|
||||
ADLOD6PowerControlInfo powertune = {0, 0, 0, 0, 0};
|
||||
|
||||
if ((ADL_rc = hc_ADL_Overdrive_PowerControlInfo_Get (hDLL, iAdapterIndex, &powertune)) != ADL_OK)
|
||||
if ((ADL_rc = hc_ADL_Overdrive_PowerControlInfo_Get (adl, iAdapterIndex, &powertune)) != ADL_OK)
|
||||
{
|
||||
log_info ("WARN: %s\n", "ADL_Overdrive6_PowerControl_Get", ADL_rc);
|
||||
}
|
||||
@ -497,24 +406,17 @@ int hc_ADL_Overdrive_PowerControl_Set (HM_LIB hDLL, int iAdapterIndex, int level
|
||||
return ADL_ERR;
|
||||
}
|
||||
|
||||
ADL_rc = ADL_Overdrive6_PowerControl_Set (iAdapterIndex, level);
|
||||
ADL_rc = adl->ADL_Overdrive6_PowerControl_Set (iAdapterIndex, level);
|
||||
}
|
||||
|
||||
return (ADL_rc);
|
||||
}
|
||||
|
||||
int hc_ADL_Adapter_Active_Get (HM_LIB hDLL, int iAdapterIndex, int *lpStatus)
|
||||
int hc_ADL_Adapter_Active_Get (ADL_PTR *adl, int iAdapterIndex, int *lpStatus)
|
||||
{
|
||||
ADL_ADAPTER_ACTIVE_GET ADL_Adapter_Active_Get = (ADL_ADAPTER_ACTIVE_GET) GetProcAddress (hDLL, "ADL_Adapter_Active_Get");
|
||||
if (!adl) return (-1);
|
||||
|
||||
if (ADL_Adapter_Active_Get == NULL)
|
||||
{
|
||||
log_error ("ERROR: %s\n", "ADL_Adapter_Active_Get() is missing");
|
||||
|
||||
exit (-1);
|
||||
}
|
||||
|
||||
int ADL_rc = ADL_Adapter_Active_Get (iAdapterIndex, lpStatus);
|
||||
int ADL_rc = adl->ADL_Adapter_Active_Get (iAdapterIndex, lpStatus);
|
||||
|
||||
if (ADL_rc != ADL_OK)
|
||||
{
|
||||
@ -524,18 +426,11 @@ int hc_ADL_Adapter_Active_Get (HM_LIB hDLL, int iAdapterIndex, int *lpStatus)
|
||||
return (ADL_rc);
|
||||
}
|
||||
|
||||
int hc_ADL_DisplayEnable_Set (HM_LIB hDLL, int iAdapterIndex, int *lpDisplayIndexList, int iDisplayListSize, int bPersistOnly)
|
||||
int hc_ADL_DisplayEnable_Set (ADL_PTR *adl, int iAdapterIndex, int *lpDisplayIndexList, int iDisplayListSize, int bPersistOnly)
|
||||
{
|
||||
ADL_DISPLAYENABLE_SET ADL_DisplayEnable_Set = (ADL_DISPLAYENABLE_SET) GetProcAddress (hDLL, "ADL_DisplayEnable_Set");
|
||||
if (!adl) return (-1);
|
||||
|
||||
if (ADL_DisplayEnable_Set == NULL)
|
||||
{
|
||||
log_error ("ERROR: %s\n", "ADL_DisplayEnable_Set() is missing");
|
||||
|
||||
exit (-1);
|
||||
}
|
||||
|
||||
int ADL_rc = ADL_DisplayEnable_Set (iAdapterIndex, lpDisplayIndexList, iDisplayListSize, bPersistOnly);
|
||||
int ADL_rc = adl->ADL_DisplayEnable_Set (iAdapterIndex, lpDisplayIndexList, iDisplayListSize, bPersistOnly);
|
||||
|
||||
if (ADL_rc != ADL_OK)
|
||||
{
|
||||
@ -545,66 +440,38 @@ int hc_ADL_DisplayEnable_Set (HM_LIB hDLL, int iAdapterIndex, int *lpDisplayInde
|
||||
return (ADL_rc);
|
||||
}
|
||||
|
||||
int hc_ADL_Overdrive_Caps (HM_LIB hDLL, int iAdapterIndex, int *od_supported, int *od_enabled, int *od_version)
|
||||
int hc_ADL_Overdrive_Caps (ADL_PTR *adl, int iAdapterIndex, int *od_supported, int *od_enabled, int *od_version)
|
||||
{
|
||||
ADL_OVERDRIVE_CAPS ADL_Overdrive_Caps = (ADL_OVERDRIVE_CAPS) GetProcAddress (hDLL, "ADL_Overdrive_Caps");
|
||||
if (!adl) return (-1);
|
||||
|
||||
if (ADL_Overdrive_Caps == NULL)
|
||||
{
|
||||
log_error ("ERROR: %s\n", "ADL_Overdrive_Caps() is missing");
|
||||
|
||||
exit (-1);
|
||||
}
|
||||
|
||||
int ADL_rc = ADL_Overdrive_Caps (iAdapterIndex, od_supported, od_enabled, od_version);
|
||||
|
||||
return (ADL_rc) ;
|
||||
}
|
||||
|
||||
int hc_ADL_Overdrive6_PowerControl_Caps (HM_LIB hDLL, int iAdapterIndex, int *lpSupported)
|
||||
{
|
||||
ADL_OVERDRIVE6_POWERCONTROL_CAPS ADL_Overdrive6_PowerControl_Caps = (ADL_OVERDRIVE6_POWERCONTROL_CAPS) GetProcAddress (hDLL, "ADL_Overdrive6_PowerControl_Caps");
|
||||
|
||||
if (ADL_Overdrive6_PowerControl_Caps == NULL)
|
||||
{
|
||||
log_error ("ERROR: %s\n", "ADL_Overdrive6_PowerControl_Caps() is missing");
|
||||
|
||||
exit (-1);
|
||||
}
|
||||
|
||||
int ADL_rc = ADL_Overdrive6_PowerControl_Caps (iAdapterIndex, lpSupported);
|
||||
|
||||
return (ADL_rc) ;
|
||||
}
|
||||
|
||||
int hc_ADL_Overdrive_Capabilities_Get (HM_LIB hDLL, int iAdapterIndex, ADLOD6Capabilities *caps)
|
||||
{
|
||||
ADL_OVERDRIVE6_CAPABILITIES_GET ADL_Overdrive6_Capabilities_Get = (ADL_OVERDRIVE6_CAPABILITIES_GET) GetProcAddress (hDLL, "ADL_Overdrive6_Capabilities_Get");
|
||||
|
||||
if (ADL_Overdrive6_Capabilities_Get == NULL)
|
||||
{
|
||||
log_error ("ERROR: %s\n", "ADL_Overdrive6_Capabilities_Get() is missing");
|
||||
|
||||
exit (-1);
|
||||
}
|
||||
|
||||
int ADL_rc = ADL_Overdrive6_Capabilities_Get (iAdapterIndex, caps);
|
||||
int ADL_rc = adl->ADL_Overdrive_Caps (iAdapterIndex, od_supported, od_enabled, od_version);
|
||||
|
||||
return (ADL_rc);
|
||||
}
|
||||
|
||||
int hc_ADL_Overdrive_StateInfo_Get (HM_LIB hDLL, int iAdapterIndex, int type, ADLOD6MemClockState *state)
|
||||
int hc_ADL_Overdrive6_PowerControl_Caps (ADL_PTR *adl, int iAdapterIndex, int *lpSupported)
|
||||
{
|
||||
ADL_OVERDRIVE6_STATEINFO_GET ADL_Overdrive6_StateInfo_Get = (ADL_OVERDRIVE6_STATEINFO_GET) GetProcAddress (hDLL, "ADL_Overdrive6_StateInfo_Get");
|
||||
if (!adl) return (-1);
|
||||
|
||||
if (ADL_Overdrive6_StateInfo_Get == NULL)
|
||||
{
|
||||
log_error ("ERROR: %s\n", "ADL_Overdrive6_StateInfo_Get() is missing");
|
||||
int ADL_rc = adl->ADL_Overdrive6_PowerControl_Caps (iAdapterIndex, lpSupported);
|
||||
|
||||
exit (-1);
|
||||
}
|
||||
return (ADL_rc);
|
||||
}
|
||||
|
||||
int ADL_rc = ADL_Overdrive6_StateInfo_Get (iAdapterIndex, type, state);
|
||||
int hc_ADL_Overdrive_Capabilities_Get (ADL_PTR *adl, int iAdapterIndex, ADLOD6Capabilities *caps)
|
||||
{
|
||||
if (!adl) return (-1);
|
||||
|
||||
int ADL_rc = adl->ADL_Overdrive6_Capabilities_Get (iAdapterIndex, caps);
|
||||
|
||||
return (ADL_rc);
|
||||
}
|
||||
|
||||
int hc_ADL_Overdrive_StateInfo_Get (ADL_PTR *adl, int iAdapterIndex, int type, ADLOD6MemClockState *state)
|
||||
{
|
||||
if (!adl) return (-1);
|
||||
|
||||
int ADL_rc = adl->ADL_Overdrive6_StateInfo_Get (iAdapterIndex, type, state);
|
||||
|
||||
if (ADL_rc == ADL_OK)
|
||||
{
|
||||
@ -613,7 +480,7 @@ int hc_ADL_Overdrive_StateInfo_Get (HM_LIB hDLL, int iAdapterIndex, int type, AD
|
||||
|
||||
ADLOD6Capabilities caps;
|
||||
|
||||
if ((hc_ADL_Overdrive_Capabilities_Get (hDLL, iAdapterIndex, &caps)) != ADL_OK)
|
||||
if ((hc_ADL_Overdrive_Capabilities_Get (adl, iAdapterIndex, &caps)) != ADL_OK)
|
||||
{
|
||||
log_info ("ERROR: failed to get ADL device capabilities");
|
||||
|
||||
@ -648,38 +515,24 @@ int hc_ADL_Overdrive_StateInfo_Get (HM_LIB hDLL, int iAdapterIndex, int type, AD
|
||||
return (ADL_rc);
|
||||
}
|
||||
|
||||
int hc_ADL_Overdrive_CurrentStatus_Get (HM_LIB hDLL, int iAdapterIndex, ADLOD6CurrentStatus *status)
|
||||
int hc_ADL_Overdrive_CurrentStatus_Get (ADL_PTR *adl, int iAdapterIndex, ADLOD6CurrentStatus *status)
|
||||
{
|
||||
ADL_OVERDRIVE6_CURRENTSTATUS_GET ADL_Overdrive6_CurrentStatus_Get = (ADL_OVERDRIVE6_CURRENTSTATUS_GET) GetProcAddress (hDLL, "ADL_Overdrive6_CurrentStatus_Get");
|
||||
if (!adl) return (-1);
|
||||
|
||||
if (ADL_Overdrive6_CurrentStatus_Get == NULL)
|
||||
{
|
||||
log_error ("ERROR: %s\n", "ADL_Overdrive6_CurrentStatus_Get() is missing");
|
||||
|
||||
exit (-1);
|
||||
}
|
||||
|
||||
int ADL_rc = ADL_Overdrive6_CurrentStatus_Get (iAdapterIndex, status);
|
||||
int ADL_rc = adl->ADL_Overdrive6_CurrentStatus_Get (iAdapterIndex, status);
|
||||
|
||||
return (ADL_rc);
|
||||
}
|
||||
|
||||
int hc_ADL_Overdrive_State_Set (HM_LIB hDLL, int iAdapterIndex, int type, ADLOD6StateInfo *state)
|
||||
int hc_ADL_Overdrive_State_Set (ADL_PTR *adl, int iAdapterIndex, int type, ADLOD6StateInfo *state)
|
||||
{
|
||||
ADL_OVERDRIVE6_STATE_SET ADL_Overdrive6_State_Set = (ADL_OVERDRIVE6_STATE_SET) GetProcAddress (hDLL, "ADL_Overdrive6_State_Set");
|
||||
|
||||
if (ADL_Overdrive6_State_Set == NULL)
|
||||
{
|
||||
log_error ("ERROR: %s\n", "ADL_Overdrive6_State_Set() is missing");
|
||||
|
||||
exit (- 1);
|
||||
}
|
||||
if (!adl) return (-1);
|
||||
|
||||
// sanity checks
|
||||
|
||||
ADLOD6Capabilities caps;
|
||||
|
||||
if ((hc_ADL_Overdrive_Capabilities_Get (hDLL, iAdapterIndex, &caps)) != ADL_OK)
|
||||
if ((hc_ADL_Overdrive_Capabilities_Get (adl, iAdapterIndex, &caps)) != ADL_OK)
|
||||
{
|
||||
log_info ("ERROR: failed to get ADL device capabilities");
|
||||
|
||||
@ -714,23 +567,16 @@ int hc_ADL_Overdrive_State_Set (HM_LIB hDLL, int iAdapterIndex, int type, ADLOD6
|
||||
return ADL_ERR;
|
||||
}
|
||||
|
||||
int ADL_rc = ADL_Overdrive6_State_Set (iAdapterIndex, type, state);
|
||||
int ADL_rc = adl->ADL_Overdrive6_State_Set (iAdapterIndex, type, state);
|
||||
|
||||
return (ADL_rc);
|
||||
}
|
||||
|
||||
int hc_ADL_Overdrive6_TargetTemperatureData_Get (HM_LIB hDLL, int iAdapterIndex, int *cur_temp, int *default_temp)
|
||||
int hc_ADL_Overdrive6_TargetTemperatureData_Get (ADL_PTR *adl, int iAdapterIndex, int *cur_temp, int *default_temp)
|
||||
{
|
||||
ADL_OVERDRIVE6_TARGETTEMPERATUREDATA_GET ADL_Overdrive6_TargetTemperatureData_Get = (ADL_OVERDRIVE6_TARGETTEMPERATUREDATA_GET) GetProcAddress (hDLL, "ADL_Overdrive6_TargetTemperatureData_Get");
|
||||
if (!adl) return (-1);
|
||||
|
||||
if (ADL_Overdrive6_TargetTemperatureData_Get == NULL)
|
||||
{
|
||||
log_error ("ERROR: %s\n", "ADL_Overdrive6_TargetTemperatureData_Get() is missing");
|
||||
|
||||
exit (-1);
|
||||
}
|
||||
|
||||
int ADL_rc = ADL_Overdrive6_TargetTemperatureData_Get (iAdapterIndex, cur_temp, default_temp);
|
||||
int ADL_rc = adl->ADL_Overdrive6_TargetTemperatureData_Get (iAdapterIndex, cur_temp, default_temp);
|
||||
|
||||
return (ADL_rc);
|
||||
}
|
||||
|
@ -56,15 +56,15 @@ const char *val2cstr_cl (cl_int CL_err)
|
||||
return "CL_UNKNOWN_ERROR";
|
||||
}
|
||||
|
||||
#define LOAD_FUNC(ptr,name,type) \
|
||||
ptr->name = (type) hc_dlsym (ptr->lib, #name); \
|
||||
if (!ptr->name) { \
|
||||
log_error ("ERROR: #name is missing from opencl shared library"); \
|
||||
exit (-1); \
|
||||
}
|
||||
|
||||
void ocl_init (OCL_PTR *ocl)
|
||||
int ocl_init (OCL_PTR *ocl)
|
||||
{
|
||||
if (!ocl)
|
||||
{
|
||||
log_error ("ERROR: opencl library ptr is null");
|
||||
|
||||
exit (-1);
|
||||
}
|
||||
|
||||
memset (ocl, 0, sizeof (hc_opencl_lib_t));
|
||||
|
||||
#ifdef _WIN
|
||||
@ -82,36 +82,38 @@ void ocl_init (OCL_PTR *ocl)
|
||||
exit (-1);
|
||||
}
|
||||
|
||||
LOAD_FUNC(ocl, clBuildProgram, OCL_CLBUILDPROGRAM)
|
||||
LOAD_FUNC(ocl, clCreateBuffer, OCL_CLCREATEBUFFER)
|
||||
LOAD_FUNC(ocl, clCreateCommandQueue, OCL_CLCREATECOMMANDQUEUE)
|
||||
LOAD_FUNC(ocl, clCreateContext, OCL_CLCREATECONTEXT)
|
||||
LOAD_FUNC(ocl, clCreateKernel, OCL_CLCREATEKERNEL)
|
||||
LOAD_FUNC(ocl, clCreateProgramWithBinary, OCL_CLCREATEPROGRAMWITHBINARY)
|
||||
LOAD_FUNC(ocl, clCreateProgramWithSource, OCL_CLCREATEPROGRAMWITHSOURCE)
|
||||
LOAD_FUNC(ocl, clEnqueueCopyBuffer, OCL_CLENQUEUECOPYBUFFER)
|
||||
LOAD_FUNC(ocl, clEnqueueFillBuffer, OCL_CLENQUEUEFILLBUFFER)
|
||||
LOAD_FUNC(ocl, clEnqueueMapBuffer, OCL_CLENQUEUEMAPBUFFER)
|
||||
LOAD_FUNC(ocl, clEnqueueNDRangeKernel, OCL_CLENQUEUENDRANGEKERNEL)
|
||||
LOAD_FUNC(ocl, clEnqueueReadBuffer, OCL_CLENQUEUEREADBUFFER)
|
||||
LOAD_FUNC(ocl, clEnqueueUnmapMemObject, OCL_CLENQUEUEUNMAPMEMOBJECT)
|
||||
LOAD_FUNC(ocl, clEnqueueWriteBuffer, OCL_CLENQUEUEWRITEBUFFER)
|
||||
LOAD_FUNC(ocl, clFinish, OCL_CLFINISH)
|
||||
LOAD_FUNC(ocl, clFlush, OCL_CLFLUSH)
|
||||
LOAD_FUNC(ocl, clGetDeviceIDs, OCL_CLGETDEVICEIDS)
|
||||
LOAD_FUNC(ocl, clGetDeviceInfo, OCL_CLGETDEVICEINFO)
|
||||
LOAD_FUNC(ocl, clGetEventInfo, OCL_CLGETEVENTINFO)
|
||||
LOAD_FUNC(ocl, clGetKernelWorkGroupInfo, OCL_CLGETKERNELWORKGROUPINFO)
|
||||
LOAD_FUNC(ocl, clGetPlatformIDs, OCL_CLGETPLATFORMIDS)
|
||||
LOAD_FUNC(ocl, clGetPlatformInfo, OCL_CLGETPLATFORMINFO)
|
||||
LOAD_FUNC(ocl, clGetProgramBuildInfo, OCL_CLGETPROGRAMBUILDINFO)
|
||||
LOAD_FUNC(ocl, clGetProgramInfo, OCL_CLGETPROGRAMINFO)
|
||||
LOAD_FUNC(ocl, clReleaseCommandQueue, OCL_CLRELEASECOMMANDQUEUE)
|
||||
LOAD_FUNC(ocl, clReleaseContext, OCL_CLRELEASECONTEXT)
|
||||
LOAD_FUNC(ocl, clReleaseKernel, OCL_CLRELEASEKERNEL)
|
||||
LOAD_FUNC(ocl, clReleaseMemObject, OCL_CLRELEASEMEMOBJECT)
|
||||
LOAD_FUNC(ocl, clReleaseProgram, OCL_CLRELEASEPROGRAM)
|
||||
LOAD_FUNC(ocl, clSetKernelArg, OCL_CLSETKERNELARG)
|
||||
HC_LOAD_FUNC(ocl, clBuildProgram, OCL_CLBUILDPROGRAM, OpenCL, 1)
|
||||
HC_LOAD_FUNC(ocl, clCreateBuffer, OCL_CLCREATEBUFFER, OpenCL, 1)
|
||||
HC_LOAD_FUNC(ocl, clCreateCommandQueue, OCL_CLCREATECOMMANDQUEUE, OpenCL, 1)
|
||||
HC_LOAD_FUNC(ocl, clCreateContext, OCL_CLCREATECONTEXT, OpenCL, 1)
|
||||
HC_LOAD_FUNC(ocl, clCreateKernel, OCL_CLCREATEKERNEL, OpenCL, 1)
|
||||
HC_LOAD_FUNC(ocl, clCreateProgramWithBinary, OCL_CLCREATEPROGRAMWITHBINARY, OpenCL, 1)
|
||||
HC_LOAD_FUNC(ocl, clCreateProgramWithSource, OCL_CLCREATEPROGRAMWITHSOURCE, OpenCL, 1)
|
||||
HC_LOAD_FUNC(ocl, clEnqueueCopyBuffer, OCL_CLENQUEUECOPYBUFFER, OpenCL, 1)
|
||||
HC_LOAD_FUNC(ocl, clEnqueueFillBuffer, OCL_CLENQUEUEFILLBUFFER, OpenCL, 1)
|
||||
HC_LOAD_FUNC(ocl, clEnqueueMapBuffer, OCL_CLENQUEUEMAPBUFFER, OpenCL, 1)
|
||||
HC_LOAD_FUNC(ocl, clEnqueueNDRangeKernel, OCL_CLENQUEUENDRANGEKERNEL, OpenCL, 1)
|
||||
HC_LOAD_FUNC(ocl, clEnqueueReadBuffer, OCL_CLENQUEUEREADBUFFER, OpenCL, 1)
|
||||
HC_LOAD_FUNC(ocl, clEnqueueUnmapMemObject, OCL_CLENQUEUEUNMAPMEMOBJECT, OpenCL, 1)
|
||||
HC_LOAD_FUNC(ocl, clEnqueueWriteBuffer, OCL_CLENQUEUEWRITEBUFFER, OpenCL, 1)
|
||||
HC_LOAD_FUNC(ocl, clFinish, OCL_CLFINISH, OpenCL, 1)
|
||||
HC_LOAD_FUNC(ocl, clFlush, OCL_CLFLUSH, OpenCL, 1)
|
||||
HC_LOAD_FUNC(ocl, clGetDeviceIDs, OCL_CLGETDEVICEIDS, OpenCL, 1)
|
||||
HC_LOAD_FUNC(ocl, clGetDeviceInfo, OCL_CLGETDEVICEINFO, OpenCL, 1)
|
||||
HC_LOAD_FUNC(ocl, clGetEventInfo, OCL_CLGETEVENTINFO, OpenCL, 1)
|
||||
HC_LOAD_FUNC(ocl, clGetKernelWorkGroupInfo, OCL_CLGETKERNELWORKGROUPINFO, OpenCL, 1)
|
||||
HC_LOAD_FUNC(ocl, clGetPlatformIDs, OCL_CLGETPLATFORMIDS, OpenCL, 1)
|
||||
HC_LOAD_FUNC(ocl, clGetPlatformInfo, OCL_CLGETPLATFORMINFO, OpenCL, 1)
|
||||
HC_LOAD_FUNC(ocl, clGetProgramBuildInfo, OCL_CLGETPROGRAMBUILDINFO, OpenCL, 1)
|
||||
HC_LOAD_FUNC(ocl, clGetProgramInfo, OCL_CLGETPROGRAMINFO, OpenCL, 1)
|
||||
HC_LOAD_FUNC(ocl, clReleaseCommandQueue, OCL_CLRELEASECOMMANDQUEUE, OpenCL, 1)
|
||||
HC_LOAD_FUNC(ocl, clReleaseContext, OCL_CLRELEASECONTEXT, OpenCL, 1)
|
||||
HC_LOAD_FUNC(ocl, clReleaseKernel, OCL_CLRELEASEKERNEL, OpenCL, 1)
|
||||
HC_LOAD_FUNC(ocl, clReleaseMemObject, OCL_CLRELEASEMEMOBJECT, OpenCL, 1)
|
||||
HC_LOAD_FUNC(ocl, clReleaseProgram, OCL_CLRELEASEPROGRAM, OpenCL, 1)
|
||||
HC_LOAD_FUNC(ocl, clSetKernelArg, OCL_CLSETKERNELARG, OpenCL, 1)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ocl_close (OCL_PTR *ocl)
|
||||
|
@ -6541,7 +6541,7 @@ int main (int argc, char **argv)
|
||||
{
|
||||
ocl = (OCL_PTR *) mymalloc (sizeof (OCL_PTR));
|
||||
|
||||
ocl_init(ocl);
|
||||
ocl_init (ocl);
|
||||
|
||||
data.ocl = ocl;
|
||||
}
|
||||
@ -13168,24 +13168,27 @@ int main (int argc, char **argv)
|
||||
}
|
||||
#endif // LINUX && HAVE_NVML
|
||||
|
||||
data.adl = NULL;
|
||||
|
||||
#ifdef HAVE_ADL
|
||||
HM_LIB hm_dll_amd = hm_init (VENDOR_ID_AMD);
|
||||
ADL_PTR *adl = (ADL_PTR *) mymalloc (sizeof (ADL_PTR));
|
||||
|
||||
data.hm_dll_amd = hm_dll_amd;
|
||||
if (adl_init (adl) == 0)
|
||||
data.adl = adl;
|
||||
|
||||
if (hm_dll_amd)
|
||||
if (data.adl)
|
||||
{
|
||||
if (hc_ADL_Main_Control_Create (hm_dll_amd, ADL_Main_Memory_Alloc, 0) == ADL_OK)
|
||||
if (hc_ADL_Main_Control_Create (data.adl, ADL_Main_Memory_Alloc, 0) == ADL_OK)
|
||||
{
|
||||
// total number of adapters
|
||||
|
||||
int hm_adapters_num;
|
||||
|
||||
if (get_adapters_num_amd (hm_dll_amd, &hm_adapters_num) != 0) return (-1);
|
||||
if (get_adapters_num_amd (data.adl, &hm_adapters_num) != 0) return (-1);
|
||||
|
||||
// adapter info
|
||||
|
||||
LPAdapterInfo lpAdapterInfo = hm_get_adapter_info_amd (hm_dll_amd, hm_adapters_num);
|
||||
LPAdapterInfo lpAdapterInfo = hm_get_adapter_info_amd (data.adl, hm_adapters_num);
|
||||
|
||||
if (lpAdapterInfo == NULL) return (-1);
|
||||
|
||||
@ -13203,8 +13206,8 @@ int main (int argc, char **argv)
|
||||
|
||||
hm_get_adapter_index_amd (hm_adapters_amd, valid_adl_device_list, num_adl_adapters, lpAdapterInfo);
|
||||
|
||||
hm_get_overdrive_version (hm_dll_amd, hm_adapters_amd, valid_adl_device_list, num_adl_adapters, lpAdapterInfo);
|
||||
hm_check_fanspeed_control (hm_dll_amd, hm_adapters_amd, valid_adl_device_list, num_adl_adapters, lpAdapterInfo);
|
||||
hm_get_overdrive_version (data.adl, hm_adapters_amd, valid_adl_device_list, num_adl_adapters, lpAdapterInfo);
|
||||
hm_check_fanspeed_control (data.adl, hm_adapters_amd, valid_adl_device_list, num_adl_adapters, lpAdapterInfo);
|
||||
|
||||
hc_thread_mutex_unlock (mux_adl);
|
||||
}
|
||||
@ -13275,7 +13278,7 @@ int main (int argc, char **argv)
|
||||
|
||||
int ADL_rc = 0;
|
||||
|
||||
if ((ADL_rc = hc_ADL_Overdrive6_PowerControl_Caps (data.hm_dll_amd, data.hm_device[device_id].adapter_index.amd, &powertune_supported)) != ADL_OK)
|
||||
if ((ADL_rc = hc_ADL_Overdrive6_PowerControl_Caps (data.adl, data.hm_device[device_id].adapter_index.amd, &powertune_supported)) != ADL_OK)
|
||||
{
|
||||
log_error ("ERROR: Failed to get ADL PowerControl Capabilities");
|
||||
|
||||
@ -13287,14 +13290,14 @@ int main (int argc, char **argv)
|
||||
// powertune set
|
||||
ADLOD6PowerControlInfo powertune = {0, 0, 0, 0, 0};
|
||||
|
||||
if ((ADL_rc = hc_ADL_Overdrive_PowerControlInfo_Get (data.hm_dll_amd, data.hm_device[device_id].adapter_index.amd, &powertune)) != ADL_OK)
|
||||
if ((ADL_rc = hc_ADL_Overdrive_PowerControlInfo_Get (data.adl, data.hm_device[device_id].adapter_index.amd, &powertune)) != ADL_OK)
|
||||
{
|
||||
log_error ("ERROR: Failed to get current ADL PowerControl settings");
|
||||
|
||||
return (-1);
|
||||
}
|
||||
|
||||
if ((ADL_rc = hc_ADL_Overdrive_PowerControl_Set (data.hm_dll_amd, data.hm_device[device_id].adapter_index.amd, powertune.iMaxValue)) != ADL_OK)
|
||||
if ((ADL_rc = hc_ADL_Overdrive_PowerControl_Set (data.adl, data.hm_device[device_id].adapter_index.amd, powertune.iMaxValue)) != ADL_OK)
|
||||
{
|
||||
log_error ("ERROR: Failed to set new ADL PowerControl values");
|
||||
|
||||
@ -14309,7 +14312,7 @@ int main (int argc, char **argv)
|
||||
uint cur_temp = 0;
|
||||
uint default_temp = 0;
|
||||
|
||||
int ADL_rc = hc_ADL_Overdrive6_TargetTemperatureData_Get (data.hm_dll_amd, data.hm_device[device_id].adapter_index.amd, (int *) &cur_temp, (int *) &default_temp);
|
||||
int ADL_rc = hc_ADL_Overdrive6_TargetTemperatureData_Get (data.adl, data.hm_device[device_id].adapter_index.amd, (int *) &cur_temp, (int *) &default_temp);
|
||||
|
||||
if (ADL_rc == ADL_OK)
|
||||
{
|
||||
@ -14365,7 +14368,7 @@ int main (int argc, char **argv)
|
||||
|
||||
int powertune_supported = 0;
|
||||
|
||||
if ((ADL_rc = hc_ADL_Overdrive6_PowerControl_Caps (data.hm_dll_amd, data.hm_device[device_id].adapter_index.amd, &powertune_supported)) != ADL_OK)
|
||||
if ((ADL_rc = hc_ADL_Overdrive6_PowerControl_Caps (data.adl, data.hm_device[device_id].adapter_index.amd, &powertune_supported)) != ADL_OK)
|
||||
{
|
||||
log_error ("ERROR: Failed to get ADL PowerControl Capabilities");
|
||||
|
||||
@ -14378,9 +14381,9 @@ int main (int argc, char **argv)
|
||||
|
||||
ADLOD6PowerControlInfo powertune = {0, 0, 0, 0, 0};
|
||||
|
||||
if ((ADL_rc = hc_ADL_Overdrive_PowerControlInfo_Get (data.hm_dll_amd, data.hm_device[device_id].adapter_index.amd, &powertune)) == ADL_OK)
|
||||
if ((ADL_rc = hc_ADL_Overdrive_PowerControlInfo_Get (data.adl, data.hm_device[device_id].adapter_index.amd, &powertune)) == ADL_OK)
|
||||
{
|
||||
ADL_rc = hc_ADL_Overdrive_PowerControl_Get (data.hm_dll_amd, data.hm_device[device_id].adapter_index.amd, &od_power_control_status[device_id]);
|
||||
ADL_rc = hc_ADL_Overdrive_PowerControl_Get (data.adl, data.hm_device[device_id].adapter_index.amd, &od_power_control_status[device_id]);
|
||||
}
|
||||
|
||||
if (ADL_rc != ADL_OK)
|
||||
@ -14390,7 +14393,7 @@ int main (int argc, char **argv)
|
||||
return (-1);
|
||||
}
|
||||
|
||||
if ((ADL_rc = hc_ADL_Overdrive_PowerControl_Set (data.hm_dll_amd, data.hm_device[device_id].adapter_index.amd, powertune.iMaxValue)) != ADL_OK)
|
||||
if ((ADL_rc = hc_ADL_Overdrive_PowerControl_Set (data.adl, data.hm_device[device_id].adapter_index.amd, powertune.iMaxValue)) != ADL_OK)
|
||||
{
|
||||
log_error ("ERROR: Failed to set new ADL PowerControl values");
|
||||
|
||||
@ -14403,7 +14406,7 @@ int main (int argc, char **argv)
|
||||
|
||||
od_clock_mem_status[device_id].state.iNumberOfPerformanceLevels = 2;
|
||||
|
||||
if ((ADL_rc = hc_ADL_Overdrive_StateInfo_Get (data.hm_dll_amd, data.hm_device[device_id].adapter_index.amd, ADL_OD6_GETSTATEINFO_CUSTOM_PERFORMANCE, &od_clock_mem_status[device_id])) != ADL_OK)
|
||||
if ((ADL_rc = hc_ADL_Overdrive_StateInfo_Get (data.adl, data.hm_device[device_id].adapter_index.amd, ADL_OD6_GETSTATEINFO_CUSTOM_PERFORMANCE, &od_clock_mem_status[device_id])) != ADL_OK)
|
||||
{
|
||||
log_error ("ERROR: Failed to get ADL memory and engine clock frequency");
|
||||
|
||||
@ -14414,7 +14417,7 @@ int main (int argc, char **argv)
|
||||
|
||||
ADLOD6Capabilities caps = {0, 0, 0, {0, 0, 0}, {0, 0, 0}, 0, 0};
|
||||
|
||||
if ((ADL_rc = hc_ADL_Overdrive_Capabilities_Get (data.hm_dll_amd, data.hm_device[device_id].adapter_index.amd, &caps)) != ADL_OK)
|
||||
if ((ADL_rc = hc_ADL_Overdrive_Capabilities_Get (data.adl, data.hm_device[device_id].adapter_index.amd, &caps)) != ADL_OK)
|
||||
{
|
||||
log_error ("ERROR: Failed to get ADL device capabilities");
|
||||
|
||||
@ -14451,7 +14454,7 @@ int main (int argc, char **argv)
|
||||
performance_state->aLevels[0].iMemoryClock = memory_clock_profile_max;
|
||||
performance_state->aLevels[1].iMemoryClock = memory_clock_profile_max;
|
||||
|
||||
if ((ADL_rc = hc_ADL_Overdrive_State_Set (data.hm_dll_amd, data.hm_device[device_id].adapter_index.amd, ADL_OD6_SETSTATE_PERFORMANCE, performance_state)) != ADL_OK)
|
||||
if ((ADL_rc = hc_ADL_Overdrive_State_Set (data.adl, data.hm_device[device_id].adapter_index.amd, ADL_OD6_SETSTATE_PERFORMANCE, performance_state)) != ADL_OK)
|
||||
{
|
||||
log_info ("ERROR: Failed to set ADL performance state");
|
||||
|
||||
@ -16620,7 +16623,7 @@ int main (int argc, char **argv)
|
||||
|
||||
int powertune_supported = 0;
|
||||
|
||||
if ((hc_ADL_Overdrive6_PowerControl_Caps (data.hm_dll_amd, data.hm_device[device_id].adapter_index.amd, &powertune_supported)) != ADL_OK)
|
||||
if ((hc_ADL_Overdrive6_PowerControl_Caps (data.adl, data.hm_device[device_id].adapter_index.amd, &powertune_supported)) != ADL_OK)
|
||||
{
|
||||
log_error ("ERROR: Failed to get ADL PowerControl Capabilities");
|
||||
|
||||
@ -16631,7 +16634,7 @@ int main (int argc, char **argv)
|
||||
{
|
||||
// powercontrol settings
|
||||
|
||||
if ((hc_ADL_Overdrive_PowerControl_Set (data.hm_dll_amd, data.hm_device[device_id].adapter_index.amd, od_power_control_status[device_id])) != ADL_OK)
|
||||
if ((hc_ADL_Overdrive_PowerControl_Set (data.adl, data.hm_device[device_id].adapter_index.amd, od_power_control_status[device_id])) != ADL_OK)
|
||||
{
|
||||
log_info ("ERROR: Failed to restore the ADL PowerControl values");
|
||||
|
||||
@ -16649,7 +16652,7 @@ int main (int argc, char **argv)
|
||||
performance_state->aLevels[0].iMemoryClock = od_clock_mem_status[device_id].state.aLevels[0].iMemoryClock;
|
||||
performance_state->aLevels[1].iMemoryClock = od_clock_mem_status[device_id].state.aLevels[1].iMemoryClock;
|
||||
|
||||
if ((hc_ADL_Overdrive_State_Set (data.hm_dll_amd, data.hm_device[device_id].adapter_index.amd, ADL_OD6_SETSTATE_PERFORMANCE, performance_state)) != ADL_OK)
|
||||
if ((hc_ADL_Overdrive_State_Set (data.adl, data.hm_device[device_id].adapter_index.amd, ADL_OD6_SETSTATE_PERFORMANCE, performance_state)) != ADL_OK)
|
||||
{
|
||||
log_info ("ERROR: Failed to restore ADL performance state");
|
||||
|
||||
@ -16681,11 +16684,12 @@ int main (int argc, char **argv)
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ADL
|
||||
if (data.hm_dll_amd)
|
||||
if (data.adl)
|
||||
{
|
||||
hc_ADL_Main_Control_Destroy (data.hm_dll_amd);
|
||||
hc_ADL_Main_Control_Destroy (data.adl);
|
||||
|
||||
hm_close (data.hm_dll_amd);
|
||||
adl_close (data.adl);
|
||||
data.adl = NULL;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
42
src/shared.c
42
src/shared.c
@ -2762,9 +2762,9 @@ HM_LIB hm_init (const cl_uint vendor_id)
|
||||
#endif // HAVE_ADL || HAVE_NVML
|
||||
|
||||
#ifdef HAVE_ADL
|
||||
int get_adapters_num_amd (HM_LIB hm_dll_amd, int *iNumberAdapters)
|
||||
int get_adapters_num_amd (void *adl, int *iNumberAdapters)
|
||||
{
|
||||
if (hc_ADL_Adapter_NumberOfAdapters_Get (hm_dll_amd, iNumberAdapters) != ADL_OK) return -1;
|
||||
if (hc_ADL_Adapter_NumberOfAdapters_Get ((ADL_PTR *) adl, iNumberAdapters) != ADL_OK) return -1;
|
||||
|
||||
if (iNumberAdapters == 0)
|
||||
{
|
||||
@ -2812,13 +2812,13 @@ int hm_show_performance_level (HM_LIB hm_dll, int iAdapterIndex)
|
||||
}
|
||||
*/
|
||||
|
||||
LPAdapterInfo hm_get_adapter_info_amd (HM_LIB hm_dll_amd, int iNumberAdapters)
|
||||
LPAdapterInfo hm_get_adapter_info_amd (void *adl, int iNumberAdapters)
|
||||
{
|
||||
size_t AdapterInfoSize = iNumberAdapters * sizeof (AdapterInfo);
|
||||
|
||||
LPAdapterInfo lpAdapterInfo = (LPAdapterInfo) mymalloc (AdapterInfoSize);
|
||||
|
||||
if (hc_ADL_Adapter_AdapterInfo_Get (hm_dll_amd, lpAdapterInfo, AdapterInfoSize) != ADL_OK) return NULL;
|
||||
if (hc_ADL_Adapter_AdapterInfo_Get ((ADL_PTR *) adl, lpAdapterInfo, AdapterInfoSize) != ADL_OK) return NULL;
|
||||
|
||||
return lpAdapterInfo;
|
||||
}
|
||||
@ -2977,7 +2977,7 @@ u32 *hm_get_list_valid_adl_adapters (int iNumberAdapters, int *num_adl_adapters,
|
||||
return adl_adapters;
|
||||
}
|
||||
|
||||
int hm_check_fanspeed_control (HM_LIB hm_dll_amd, hm_attrs_t *hm_device, u32 *valid_adl_device_list, int num_adl_adapters, LPAdapterInfo lpAdapterInfo)
|
||||
int hm_check_fanspeed_control (void *adl, hm_attrs_t *hm_device, u32 *valid_adl_device_list, int num_adl_adapters, LPAdapterInfo lpAdapterInfo)
|
||||
{
|
||||
// loop through all valid devices
|
||||
|
||||
@ -2995,7 +2995,7 @@ int hm_check_fanspeed_control (HM_LIB hm_dll_amd, hm_attrs_t *hm_device, u32 *va
|
||||
|
||||
int opencl_device_index = i;
|
||||
|
||||
// if (hm_show_performance_level (hm_dll_amd, info.iAdapterIndex) != 0) return -1;
|
||||
// if (hm_show_performance_level (adl, info.iAdapterIndex) != 0) return -1;
|
||||
|
||||
// get fanspeed info
|
||||
|
||||
@ -3007,7 +3007,7 @@ int hm_check_fanspeed_control (HM_LIB hm_dll_amd, hm_attrs_t *hm_device, u32 *va
|
||||
|
||||
FanSpeedInfo.iSize = sizeof (ADLFanSpeedInfo);
|
||||
|
||||
if (hc_ADL_Overdrive5_FanSpeedInfo_Get (hm_dll_amd, info.iAdapterIndex, 0, &FanSpeedInfo) != ADL_OK) return -1;
|
||||
if (hc_ADL_Overdrive5_FanSpeedInfo_Get (adl, info.iAdapterIndex, 0, &FanSpeedInfo) != ADL_OK) return -1;
|
||||
|
||||
// check read and write capability in fanspeedinfo
|
||||
|
||||
@ -3027,7 +3027,7 @@ int hm_check_fanspeed_control (HM_LIB hm_dll_amd, hm_attrs_t *hm_device, u32 *va
|
||||
|
||||
memset (&faninfo, 0, sizeof (faninfo));
|
||||
|
||||
if (hc_ADL_Overdrive6_FanSpeed_Get (hm_dll_amd, info.iAdapterIndex, &faninfo) != ADL_OK) return -1;
|
||||
if (hc_ADL_Overdrive6_FanSpeed_Get (adl, info.iAdapterIndex, &faninfo) != ADL_OK) return -1;
|
||||
|
||||
// check read capability in fanspeedinfo
|
||||
|
||||
@ -3045,7 +3045,7 @@ int hm_check_fanspeed_control (HM_LIB hm_dll_amd, hm_attrs_t *hm_device, u32 *va
|
||||
return 0;
|
||||
}
|
||||
|
||||
int hm_get_overdrive_version (HM_LIB hm_dll_amd, hm_attrs_t *hm_device, u32 *valid_adl_device_list, int num_adl_adapters, LPAdapterInfo lpAdapterInfo)
|
||||
int hm_get_overdrive_version (void *adl, hm_attrs_t *hm_device, u32 *valid_adl_device_list, int num_adl_adapters, LPAdapterInfo lpAdapterInfo)
|
||||
{
|
||||
for (int i = 0; i < num_adl_adapters; i++)
|
||||
{
|
||||
@ -3061,7 +3061,7 @@ int hm_get_overdrive_version (HM_LIB hm_dll_amd, hm_attrs_t *hm_device, u32 *val
|
||||
int od_enabled = 0;
|
||||
int od_version = 0;
|
||||
|
||||
if (hc_ADL_Overdrive_Caps (hm_dll_amd, info.iAdapterIndex, &od_supported, &od_enabled, &od_version) != ADL_OK) return -1;
|
||||
if (hc_ADL_Overdrive_Caps (adl, info.iAdapterIndex, &od_supported, &od_enabled, &od_version) != ADL_OK) return -1;
|
||||
|
||||
// store the overdrive version in hm_device
|
||||
|
||||
@ -3109,7 +3109,7 @@ int hm_get_temperature_with_device_id (const uint device_id)
|
||||
#ifdef HAVE_ADL
|
||||
if (data.devices_param[device_id].vendor_id == VENDOR_ID_AMD)
|
||||
{
|
||||
if (data.hm_dll_amd)
|
||||
if (data.adl)
|
||||
{
|
||||
if (data.hm_device[device_id].od_version == 5)
|
||||
{
|
||||
@ -3117,7 +3117,7 @@ int hm_get_temperature_with_device_id (const uint device_id)
|
||||
|
||||
Temperature.iSize = sizeof (ADLTemperature);
|
||||
|
||||
if (hc_ADL_Overdrive5_Temperature_Get (data.hm_dll_amd, data.hm_device[device_id].adapter_index.amd, 0, &Temperature) != ADL_OK) return -1;
|
||||
if (hc_ADL_Overdrive5_Temperature_Get (data.adl, data.hm_device[device_id].adapter_index.amd, 0, &Temperature) != ADL_OK) return -1;
|
||||
|
||||
return Temperature.iTemperature / 1000;
|
||||
}
|
||||
@ -3125,7 +3125,7 @@ int hm_get_temperature_with_device_id (const uint device_id)
|
||||
{
|
||||
int Temperature = 0;
|
||||
|
||||
if (hc_ADL_Overdrive6_Temperature_Get (data.hm_dll_amd, data.hm_device[device_id].adapter_index.amd, &Temperature) != ADL_OK) return -1;
|
||||
if (hc_ADL_Overdrive6_Temperature_Get (data.adl, data.hm_device[device_id].adapter_index.amd, &Temperature) != ADL_OK) return -1;
|
||||
|
||||
return Temperature / 1000;
|
||||
}
|
||||
@ -3172,7 +3172,7 @@ int hm_get_fanspeed_with_device_id (const uint device_id)
|
||||
#ifdef HAVE_ADL
|
||||
if (data.devices_param[device_id].vendor_id == VENDOR_ID_AMD)
|
||||
{
|
||||
if (data.hm_dll_amd)
|
||||
if (data.adl)
|
||||
{
|
||||
if (data.hm_device[device_id].od_version == 5)
|
||||
{
|
||||
@ -3184,7 +3184,7 @@ int hm_get_fanspeed_with_device_id (const uint device_id)
|
||||
lpFanSpeedValue.iSpeedType = ADL_DL_FANCTRL_SPEED_TYPE_PERCENT;
|
||||
lpFanSpeedValue.iFlags = ADL_DL_FANCTRL_FLAG_USER_DEFINED_SPEED;
|
||||
|
||||
if (hc_ADL_Overdrive5_FanSpeed_Get (data.hm_dll_amd, data.hm_device[device_id].adapter_index.amd, 0, &lpFanSpeedValue) != ADL_OK) return -1;
|
||||
if (hc_ADL_Overdrive5_FanSpeed_Get (data.adl, data.hm_device[device_id].adapter_index.amd, 0, &lpFanSpeedValue) != ADL_OK) return -1;
|
||||
|
||||
return lpFanSpeedValue.iFanSpeed;
|
||||
}
|
||||
@ -3194,7 +3194,7 @@ int hm_get_fanspeed_with_device_id (const uint device_id)
|
||||
|
||||
memset (&faninfo, 0, sizeof (faninfo));
|
||||
|
||||
if (hc_ADL_Overdrive6_FanSpeed_Get (data.hm_dll_amd, data.hm_device[device_id].adapter_index.amd, &faninfo) != ADL_OK) return -1;
|
||||
if (hc_ADL_Overdrive6_FanSpeed_Get (data.adl, data.hm_device[device_id].adapter_index.amd, &faninfo) != ADL_OK) return -1;
|
||||
|
||||
return faninfo.iFanSpeedPercent;
|
||||
}
|
||||
@ -3234,13 +3234,13 @@ int hm_get_utilization_with_device_id (const uint device_id)
|
||||
#ifdef HAVE_ADL
|
||||
if (data.devices_param[device_id].vendor_id == VENDOR_ID_AMD)
|
||||
{
|
||||
if (data.hm_dll_amd)
|
||||
if (data.adl)
|
||||
{
|
||||
ADLPMActivity PMActivity;
|
||||
|
||||
PMActivity.iSize = sizeof (ADLPMActivity);
|
||||
|
||||
if (hc_ADL_Overdrive_CurrentActivity_Get (data.hm_dll_amd, data.hm_device[device_id].adapter_index.amd, &PMActivity) != ADL_OK) return -1;
|
||||
if (hc_ADL_Overdrive_CurrentActivity_Get (data.adl, data.hm_device[device_id].adapter_index.amd, &PMActivity) != ADL_OK) return -1;
|
||||
|
||||
return PMActivity.iActivityPercent;
|
||||
}
|
||||
@ -3278,7 +3278,7 @@ int hm_set_fanspeed_with_device_id_amd (const uint device_id, const int fanspeed
|
||||
{
|
||||
if (data.hm_device[device_id].fan_supported == 1)
|
||||
{
|
||||
if (data.hm_dll_amd)
|
||||
if (data.adl)
|
||||
{
|
||||
if (data.hm_device[device_id].od_version == 5)
|
||||
{
|
||||
@ -3291,7 +3291,7 @@ int hm_set_fanspeed_with_device_id_amd (const uint device_id, const int fanspeed
|
||||
lpFanSpeedValue.iFlags = ADL_DL_FANCTRL_FLAG_USER_DEFINED_SPEED;
|
||||
lpFanSpeedValue.iFanSpeed = fanspeed;
|
||||
|
||||
if (hc_ADL_Overdrive5_FanSpeed_Set (data.hm_dll_amd, data.hm_device[device_id].adapter_index.amd, 0, &lpFanSpeedValue) != ADL_OK) return -1;
|
||||
if (hc_ADL_Overdrive5_FanSpeed_Set (data.adl, data.hm_device[device_id].adapter_index.amd, 0, &lpFanSpeedValue) != ADL_OK) return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -3304,7 +3304,7 @@ int hm_set_fanspeed_with_device_id_amd (const uint device_id, const int fanspeed
|
||||
fan_speed_value.iSpeedType = ADL_OD6_FANSPEED_TYPE_PERCENT;
|
||||
fan_speed_value.iFanSpeed = fanspeed;
|
||||
|
||||
if (hc_ADL_Overdrive6_FanSpeed_Set (data.hm_dll_amd, data.hm_device[device_id].adapter_index.amd, &fan_speed_value) != ADL_OK) return -1;
|
||||
if (hc_ADL_Overdrive6_FanSpeed_Set (data.adl, data.hm_device[device_id].adapter_index.amd, &fan_speed_value) != ADL_OK) return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user