Dears,
I want to use ADL.ADL_Overdrive5_ODPerformanceLevels_Get to get some level informations, but I try a lot of times , still fail.
I don't know how to declare the structure and pass to ADL.ADL_Overdrive5_ODPerformanceLevels_Get
Here is my code.
I still don't what is the meaning of
" Array of performance state descriptors. Must have ADLODParameters.iNumberOfPerformanceLevels elements."
about the ADLODPerformanceLevels.aLevels
Whould please any professions give me some advise...
Thanks a lot
[StructLayout(LayoutKind.Sequential)] internal struct ADLODPerformanceLevel { internal int iEngineClock; //Engine clock. internal int iMemoryClock; //Memory clock. internal int iVddc; //Core voltage. } [StructLayout(LayoutKind.Sequential)] internal struct ADLODPerformanceLevels { internal int iSize; //Must be set to sizeof( ADLODPerformanceLevels ) + sizeof( ADLODPerformanceLevel ) * (ADLODParameters.iNumberOfPerformanceLevels - 1). internal int iReserved; internal ADLODPerformanceLevel[] aLevels; //Array of performance state descriptors. Must have ADLODParameters.iNumberOfPerformanceLevels elements. } ADLRet = -1; ADLODPerformanceLevels OverDrive_PerformanceLevels = new ADLODPerformanceLevels(); ADLODPerformanceLevel pp = new ADLODPerformanceLevel(); OverDrive_PerformanceLevels.aLevels = new ADLODPerformanceLevel[1]; OverDrive_PerformanceLevels.iSize = System.Runtime.InteropServices.Marshal.SizeOf(OverDrive_PerformanceLevels) + System.Runtime.InteropServices.Marshal.SizeOf(pp) * (OverDrive5ParameterRange.iNumberOfPerformanceLevels - 1); if (null != ADL.ADL_Overdrive5_ODPerformanceLevels_Get) { ADLRet = ADL.ADL_Overdrive5_ODPerformanceLevels_Get(0, 1,ref OverDrive_PerformanceLevels); } else { textBox3.Text = "Function Not Found!!" + "\r\n"; } if (ADL.ADL_SUCCESS == ADLRet) { } else { textBox3.Text = "Function Error!! " + ADLRet.ToString () + "\r\n"; }
#region ADLODPerformanceLevels
[StructLayout(LayoutKind.Sequential)]
internal struct ADLODPerformanceLevel
{
internal int iEngineClock;
internal int iMemoryClock;
internal int iVddc;
}
[StructLayout(LayoutKind.Sequential)]
internal struct ADLODPerformanceLevels
{
internal ADLDisplayID DisplayID;
internal int iSize;
internal int iReserved;
internal ADLODPerformanceLevel aLevels;
}
#endregion ADLODPerformanceLevels
The CODE looks to be correct approach...
Which ASIC is this invoked on?
Not all ASICs support OD5. Does it appear in the CCC UI?
Same here, but in C++.
how do i initialize the ADLODPerformanceLevels struct?
ADLODPerformanceLevels * ODPLs = new ADLODPerformanceLevels();
This doesn´t work: ODPLs->aLevels = new ADLODPerformanceLevel[1];
ODPLs->iSize = sizeof(ADLODPerformanceLevels)+sizeof(ADLODPerformanceLevel)*(FoundPerformanceLevels-1);
thx a lot
Neubsi
Originally posted by: nbsi Same here, but in C++.
how do i initialize the ADLODPerformanceLevels struct?
ADLODPerformanceLevels * ODPLs = new ADLODPerformanceLevels(); This doesn´t work: ODPLs->aLevels = new ADLODPerformanceLevel[1]; ODPLs->iSize = sizeof(ADLODPerformanceLevels)+sizeof(ADLODPerformanceLevel)*(FoundPerformanceLevels-1);
thx a lot
Neubsi
I would need more details/information.
The code section below is not enough to tell.
We need to allocation spaces based on the returned performance level.
It looks like you hardcoded to 1 level only, which may cause problem
ADLODPerformanceLevel xcsDisplayAti::GetOverdrivePLInfo(int AdapterIndex, int iPL) { Log->Save(L"DisplayAti\tGetOverdrivePLInfo",_xcsDebug); ADLODPerformanceLevel PL={0}; if(!mInit) { Log->Save(L"DisplayAti\tGetOverdrivePLInfo, Error: Not Initialized!",_xcsError); return PL; } Log->Save(L"DisplayAti\tGetOverdrivePLInfo, AdapterIndex: "+xcswString(AdapterIndex),_xcsDebug); ADL_OVERDRIVE5_ODPERFORMANCELEVELS_GET ADL_Overdrive5_ODPerformanceLevels_Get=(ADL_OVERDRIVE5_ODPERFORMANCELEVELS_GET) GetProcAddress(mDLL,"ADL_Overdrive5_ODPerformanceLevels_Get"); if(ADL_Overdrive5_ODPerformanceLevels_Get==NULL) { Log->Save(L"DisplayAti\tGetOverdrivePLInfo, Error: ADL_Overdrive5_ODPerformanceLevels_Get API not found!",_xcsError); return PL; } //TODO ADLODPerformanceLevels * PLs=new ADLODPerformanceLevels(); //PLs->aLevels=need to initialize the ADLODPerformanceLevel Array; PLs->iSize=sizeof(ADLODPerformanceLevels)+sizeof(ADLODPerformanceLevel)*(iPL-1); int Result=ADL_Overdrive5_ODPerformanceLevels_Get(AdapterIndex,0,PLs); if(Result!=0) { Log->Save(L"DisplayAti\tGetOverdrivePLInfo, Error: "+pGetErrorString(Result),_xcsError); } //TODO return PL; }
Which ASIC is this invoked on?
Not all ASICs support OD5. Does it appear in the CCC UI?