public void SetSystemClockByIndex(int gpuIndex, int value) { try { int adapterIndex = GpuIndexToAdapterIndex(gpuIndex); ADLODNCapabilitiesX2 lpODCapabilities = new ADLODNCapabilitiesX2(); var result = ADL.ADL2_OverdriveN_CapabilitiesX2_Get(context, adapterIndex, ref lpODCapabilities); if (result != 0) { return; } ADLODNPerformanceLevelsX2 lpODPerformanceLevels = ADLODNPerformanceLevelsX2.Create(); result = ADL.ADL2_OverdriveN_SystemClocksX2_Get(context, adapterIndex, ref lpODPerformanceLevels); lpODPerformanceLevels.iMode = ADL.ODNControlType_Default; result = ADL.ADL2_OverdriveN_SystemClocksX2_Set(context, adapterIndex, ref lpODPerformanceLevels); result = ADL.ADL2_OverdriveN_SystemClocksX2_Get(context, adapterIndex, ref lpODPerformanceLevels); #if DEBUG Write.DevWarn("ADL2_OverdriveN_SystemClocksX2_Get result=" + result); foreach (var item in lpODPerformanceLevels.aLevels) { Write.DevWarn($"iClock={item.iClock},iControl={item.iControl},iEnabled={item.iEnabled},iVddc={item.iVddc}"); } #endif if (result == ADL.ADL_OK) { if (value <= 0) { return; } else { lpODPerformanceLevels.iMode = ADL.ODNControlType_Manual; int index = 0; for (int i = 0; i < lpODPerformanceLevels.aLevels.Length; i++) { if (lpODPerformanceLevels.aLevels[i].iEnabled == 1) { index = i; } } lpODPerformanceLevels.aLevels[index].iClock = value * 100; } result = ADL.ADL2_OverdriveN_SystemClocksX2_Set(context, adapterIndex, ref lpODPerformanceLevels); #if DEBUG if (result != ADL.ADL_OK) { Write.DevWarn($"ADL2_OverdriveN_SystemClocksX2_Set({value * 100}) result " + result); } #endif } } catch { } }
public int GetSystemClockByIndex(int gpuIndex) { try { int adapterIndex = GpuIndexToAdapterIndex(gpuIndex); ADLODNPerformanceLevelsX2 lpODPerformanceLevels = ADLODNPerformanceLevelsX2.Create(); var result = ADL.ADL2_OverdriveN_SystemClocksX2_Get(context, adapterIndex, ref lpODPerformanceLevels); return(lpODPerformanceLevels.aLevels[lpODPerformanceLevels.aLevels.Length - 1].iClock * 10); } catch { return(0); } }
public int GetSystemClockByIndex(int gpuIndex) { try { int adapterIndex = GpuIndexToAdapterIndex(gpuIndex); ADLODNPerformanceLevelsX2 lpODPerformanceLevels = ADLODNPerformanceLevelsX2.Create(); var result = ADL.ADL2_OverdriveN_SystemClocksX2_Get(context, adapterIndex, ref lpODPerformanceLevels); int index = 0; for (int i = 0; i < lpODPerformanceLevels.aLevels.Length; i++) { if (lpODPerformanceLevels.aLevels[i].iEnabled != 0) { index = i; } } return(lpODPerformanceLevels.aLevels[index].iClock * 10); } catch { return(0); } }