mirror of
https://github.com/terrymacdonald/DisplayMagician.git
synced 2024-08-30 18:32:20 +00:00
[WIP] Added initial ADL2_Display_SLSMapConfig_Get()
Tried to add the first SLS map config get function into the ADL.cs file, as well as all the supporting data structures. Time will tell whether this will work or not!
This commit is contained in:
parent
4849c3ffaf
commit
09e2b19bc3
@ -40,35 +40,35 @@ namespace ATI.ADL
|
||||
/// <summary> ADL Memory allocation function allows ADL to callback for memory allocation</summary>
|
||||
/// <param name="size">input size</param>
|
||||
/// <returns> retrun ADL Error Code</returns>
|
||||
internal delegate IntPtr ADL_Main_Memory_Alloc (int size);
|
||||
internal delegate IntPtr ADL2_Main_Memory_Alloc (int size);
|
||||
|
||||
// ///// <summary> ADL Create Function to create ADL Data</summary>
|
||||
/// <param name="callback">Call back functin pointer which is ised to allocate memeory </param>
|
||||
/// <param name="enumConnectedAdapters">If it is 1, then ADL will only retuen the physical exist adapters </param>
|
||||
///// <returns> retrun ADL Error Code</returns>
|
||||
internal delegate int ADL_Main_Control_Create(ADL_Main_Memory_Alloc callback, int enumConnectedAdapters);
|
||||
internal delegate int ADL2_Main_Control_Create(ADL2_Main_Memory_Alloc callback, int enumConnectedAdapters);
|
||||
|
||||
/// <summary> ADL Destroy Function to free up ADL Data</summary>
|
||||
/// <returns> retrun ADL Error Code</returns>
|
||||
internal delegate int ADL_Main_Control_Destroy ();
|
||||
internal delegate int ADL2_Main_Control_Destroy ();
|
||||
|
||||
/// <summary> ADL Function to get the number of adapters</summary>
|
||||
/// <param name="numAdapters">return number of adapters</param>
|
||||
/// <returns> retrun ADL Error Code</returns>
|
||||
internal delegate int ADL_Adapter_NumberOfAdapters_Get (ref int numAdapters);
|
||||
internal delegate int ADL2_Adapter_NumberOfAdapters_Get (ref int numAdapters);
|
||||
|
||||
/// <summary> ADL Function to get the GPU adapter information</summary>
|
||||
/// <param name="info">return GPU adapter information</param>
|
||||
/// <param name="inputSize">the size of the GPU adapter struct</param>
|
||||
/// <returns> retrun ADL Error Code</returns>
|
||||
internal delegate int ADL_Adapter_AdapterInfo_Get (IntPtr info, int inputSize);
|
||||
internal delegate int ADL2_Adapter_AdapterInfo_Get (IntPtr info, int inputSize);
|
||||
|
||||
/// <summary> Function to determine if the adapter is active or not.</summary>
|
||||
/// <remarks>The function is used to check if the adapter associated with iAdapterIndex is active</remarks>
|
||||
/// <param name="adapterIndex"> Adapter Index.</param>
|
||||
/// <param name="status"> Status of the adapter. True: Active; False: Dsiabled</param>
|
||||
/// <returns>Non zero is successfull</returns>
|
||||
internal delegate int ADL_Adapter_Active_Get(int adapterIndex, ref int status);
|
||||
internal delegate int ADL2_Adapter_Active_Get(int adapterIndex, ref int status);
|
||||
|
||||
/// <summary>Get display information based on adapter index</summary>
|
||||
/// <param name="adapterIndex">Adapter Index</param>
|
||||
@ -76,12 +76,79 @@ namespace ATI.ADL
|
||||
/// <param name="displayInfoArray">return ADLDisplayInfo Array for supported displays' information</param>
|
||||
/// <param name="forceDetect">force detect or not</param>
|
||||
/// <returns>return ADL Error Code</returns>
|
||||
internal delegate int ADL_Display_DisplayInfo_Get(int adapterIndex, ref int numDisplays, out IntPtr displayInfoArray, int forceDetect);
|
||||
internal delegate int ADL2_Display_DisplayInfo_Get(int adapterIndex, ref int numDisplays, out IntPtr displayInfoArray, int forceDetect);
|
||||
|
||||
/// <summary>Function to retrieve an SLS configuration.</summary>
|
||||
/// <param name="adapterIndex">Adapter Index</param>
|
||||
/// <param name="SLSMapIndex">Specifies the SLS map index to be queried.</param>
|
||||
/// <param name="SLSMap">return ADLSLSMap Array for supported displays' information</param>
|
||||
/// <param name="numSLSTarget">return number of targets in the SLS mapo</param>
|
||||
/// <param name="SLSTargetArray">return ADLSLSTarget Array </param>
|
||||
/// <param name="numNativeMode">return the number of native modes</param>
|
||||
/// <param name="SLSNativeMode">return ADLSLSMode Array that contains the native modes</param>
|
||||
/// <param name="numBezelMode">return the number of bezel modes</param>
|
||||
/// <param name="SLSBezelMode">return ADLSLSMode Array that contains the bezel modes</param>
|
||||
/// <param name="numTransientMode">return the number of transient modes</param>
|
||||
/// <param name="SLSTransientMode">return ADLSLSMode Array that contains the transient modes</param>
|
||||
/// <param name="numSLSOffset">return the number of SLS offsets</param>
|
||||
/// <param name="SLSOffset">return ADLSLSOffset Array that contains the SLS offsets</param>
|
||||
/// <param name="option">Specifies the layout type of SLS grid data. It is bit vector. There are two types of SLS layout:s, relative to landscape (ref \ADL_DISPLAY_SLSGRID_CAP_OPTION_RELATIVETO_LANDSCAPE) and relative to current angle (ref \ADL_DISPLAY_SLSGRID_CAP_OPTION_RELATIVETO_CURRENTANGLE).</param>
|
||||
/// <returns>return ADL Error Code</returns>
|
||||
internal delegate int ADL2_Display_SLSMapConfig_Get(int adapterIndex, int SLSMapIndex, ref ADLSLSMap SLSMap, ref int numSLSTarget, out IntPtr SLSTargetArray, ref int numNativeMode,
|
||||
out IntPtr SLSNativeMode, ref int numBezelMode, out IntPtr SLSBezelMode, ref int numTransientMode, out IntPtr SLSTransientMode, ref int numSLSOffset, out IntPtr SLSOffset, int option);
|
||||
|
||||
#endregion Export Delegates
|
||||
|
||||
#region Export Struct
|
||||
|
||||
#region ADLMode
|
||||
/// <summary> ADLAdapterInfo Array</summary>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct ADLMode
|
||||
{
|
||||
/// <summary> Display IDs. </summary>
|
||||
internal ADLDisplayID DisplayID;
|
||||
/// <summary> Screen refresh rate. </summary>
|
||||
internal float RefreshRate;
|
||||
/// <summary> Adapter index. </summary>
|
||||
internal int AdapterIndex;
|
||||
/// <summary> Screen Color Depth. E.g., 16, 32. </summary>
|
||||
internal int ColourDepth;
|
||||
/// <summary> Vista mode flag indicating Progressive or Interlaced mode. </summary>
|
||||
internal int ModeFlag;
|
||||
/// <summary> The bit mask identifying the number of bits this Mode is currently using. </summary>
|
||||
internal int ModeMask;
|
||||
/// <summary> The bit mask identifying the display status. </summary>
|
||||
internal int ModeValue;
|
||||
/// <summary> Screen orientation. E.g., 0, 90, 180, 270. </summary>
|
||||
internal int Orientation;
|
||||
/// <summary> Screen position X coordinate. </summary>
|
||||
internal int XPos;
|
||||
/// <summary> Screen resolution Width. </summary>
|
||||
internal int XRes;
|
||||
/// <summary> Screen position Y coordinate. </summary>
|
||||
internal int YPos;
|
||||
/// <summary> Screen resolution Height. </summary>
|
||||
internal int YRes;
|
||||
}
|
||||
#endregion ADLMode
|
||||
|
||||
#region ADLDisplayTarget
|
||||
/// <summary> ADLDisplayTarget Array</summary>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct ADLDisplayTarget
|
||||
{
|
||||
/// <summary> Display IDs. </summary>
|
||||
internal ADLDisplayID DisplayID;
|
||||
/// <summary> The display map index identify this manner and the desktop surface. </summary>
|
||||
internal int DisplayMapIndex;
|
||||
/// <summary> The bit mask identifies the number of bits DisplayTarget is currently using. </summary>
|
||||
internal int DisplayTargetMask;
|
||||
/// <summary> The bit mask identifies the display status. </summary>
|
||||
internal int DisplayTargetValue;
|
||||
}
|
||||
#endregion ADLDisplayTarget
|
||||
|
||||
#region ADLAdapterInfo
|
||||
/// <summary> ADLAdapterInfo Structure</summary>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
@ -179,6 +246,162 @@ namespace ATI.ADL
|
||||
}
|
||||
#endregion ADLDisplayInfo
|
||||
|
||||
#region ADLSLS
|
||||
|
||||
/// <summary> ADLSLSGrid Structure</summary>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct ADLSLSGrid
|
||||
{
|
||||
/// <summary> The Adapter index </summary>
|
||||
internal int AdapterIndex;
|
||||
/// <summary> The grid column </summary>
|
||||
internal int SLSGridColumn;
|
||||
/// <summary> The grid index </summary>
|
||||
internal int SLSGridIndex;
|
||||
/// <summary> The grid bit mask identifies the number of bits DisplayMap is currently using. </summary>
|
||||
internal int SLSGridMask;
|
||||
/// <summary>The grid row. </summary>
|
||||
internal int SLSGridRow;
|
||||
/// <summary> The grid bit value identifies the display status. </summary>
|
||||
internal int SLSGridValue;
|
||||
}
|
||||
|
||||
/// <summary> ADLSLSMap Structure</summary>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct ADLSLSMap
|
||||
{
|
||||
/// <summary> The current grid </summary>
|
||||
internal ADLSLSGrid Grid;
|
||||
/// <summary> The Adapter Index </summary>
|
||||
internal int AdapterIndex;
|
||||
/// <summary> The first bezel mode array index in the native mode array </summary>
|
||||
internal int FirstBezelModeArrayIndex;
|
||||
/// <summary> The first bezel offset array index in the native mode array </summary>
|
||||
internal int FirstBezelOffsetArrayIndex;
|
||||
/// <summary>The first native mode array index in the native mode array. </summary>
|
||||
internal int FirstNativeModeArrayIndex;
|
||||
/// <summary> The first target array index in the Target array. </summary>
|
||||
internal int FirstSLSTargetArrayIndex;
|
||||
/// <summary> The number of bezel modes belongs to this map. </summary>
|
||||
internal int NumBezelMode;
|
||||
/// <summary> The number of bezel offsets belongs to this map. </summary>
|
||||
internal int NumBezelOffset;
|
||||
/// <summary> The number of native modes belongs to this map. </summary>
|
||||
internal int NumNativeMode;
|
||||
/// <summary> The number of display targets belongs to this map. </summary>
|
||||
internal int NumSLSTarget;
|
||||
/// <summary> Screen orientation. E.g., 0, 90, 180, 270. </summary>
|
||||
internal int Orientation;
|
||||
/// <summary> The current display map index. It is the OS Desktop index. </summary>
|
||||
internal int SLSMapIndex;
|
||||
/// <summary> Bitmask identifies display map status </summary>
|
||||
internal int SLSMapMask;
|
||||
/// <summary> Bitmask identifies display map status </summary>
|
||||
internal int SLSMapValue;
|
||||
/// <summary> OS Surface Index </summary>
|
||||
internal int SurfaceMapIndex;
|
||||
}
|
||||
|
||||
/// <summary> ADLSLSTarget Structure</summary>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct ADLSLSTarget
|
||||
{
|
||||
/// <summary> The target ID. </summary>
|
||||
internal ADLDisplayTarget DisplayTarget;
|
||||
/// <summary> The Adapter Index </summary>
|
||||
internal int AdapterIndex;
|
||||
/// <summary> Target postion X in SLS grid </summary>
|
||||
internal int SLSGridPositionX;
|
||||
/// <summary> Target postion Y in SLS grid </summary>
|
||||
internal int SLSGridPositionY;
|
||||
/// <summary> The SLS map index. </summary>
|
||||
internal int SLSMapIndex;
|
||||
/// <summary> The bit mask identifies the bits in iSLSTargetValue are currently used. </summary>
|
||||
internal int SLSTargetMask;
|
||||
/// <summary> The bit mask identifies status info. </summary>
|
||||
internal int SLSTargetValue;
|
||||
/// <summary> The view size width, height and rotation angle per SLS Target. </summary>
|
||||
internal ADLMode ViewSize;
|
||||
}
|
||||
|
||||
/// <summary> ADLSLSTarget Array</summary>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct ADLSLSTargetArray
|
||||
{
|
||||
/// <summary> ADLAdapterInfo Array </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = (int)ADL.ADL_MAX_ADAPTERS)]
|
||||
internal ADLSLSTarget[] ADLSLSTarget;
|
||||
}
|
||||
|
||||
/// <summary> ADLSLSMode Structure</summary>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct ADLSLSMode
|
||||
{
|
||||
/// <summary> The target ID. </summary>
|
||||
internal ADLMode DisplayMode;
|
||||
/// <summary> The Adapter Index </summary>
|
||||
internal int AdapterIndex;
|
||||
/// <summary> The current display map index. It is the OS Desktop index. </summary>
|
||||
internal int SLSMapIndex;
|
||||
/// <summary> The mode index. </summary>
|
||||
internal int SLSModeIndex;
|
||||
/// <summary> The bit mask identifies the number of bits Mode is currently using. </summary>
|
||||
internal int SLSNativeModeMask;
|
||||
/// <summary> The bit mask identifies the display status. </summary>
|
||||
internal int SLSNativeModeValue;
|
||||
|
||||
}
|
||||
|
||||
/// <summary> ADLBezelTransientMode Structure</summary>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct ADLBezelTransientMode
|
||||
{
|
||||
/// <summary> The target ID. </summary>
|
||||
internal ADLMode DisplayMode;
|
||||
/// <summary> The Adapter Index </summary>
|
||||
internal int AdapterIndex;
|
||||
/// <summary> The first bezel offset array index in the native mode array. </summary>
|
||||
internal int FirstBezelOffsetArrayIndex;
|
||||
/// <summary> The number of bezel offsets belongs to this map. </summary>
|
||||
internal int NumBezelOffset;
|
||||
/// <summary> The bit mask identifies the bits this structure is currently using. </summary>
|
||||
internal int SLSBezelTransientModeMask;
|
||||
/// <summary> The bit mask identifies the display status. </summary>
|
||||
internal int SLSBezelTransientModeValue;
|
||||
/// <summary> SLS Map Index. </summary>
|
||||
internal int SLSMapIndex;
|
||||
/// <summary> SLS Mode Index. </summary>
|
||||
internal int SLSModeIndex;
|
||||
}
|
||||
|
||||
/// <summary> ADLSLSOffset Structure</summary>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct ADLSLSOffset
|
||||
{
|
||||
/// <summary> The target ID. </summary>
|
||||
internal ADLMode DisplayMode;
|
||||
/// <summary> The Adapter Index </summary>
|
||||
internal int AdapterIndex;
|
||||
/// <summary> The bit mask identifies the display status. </summary>
|
||||
internal int BezelOffsetValue;
|
||||
/// <summary> SLS Bezel Mode Index. </summary>
|
||||
internal int BezelModeIndex;
|
||||
/// <summary> The bit mask identifies the number of bits Offset is currently using. </summary>
|
||||
internal int BezelOffsetMask;
|
||||
/// <summary>SLS Bezel Offset X. </summary>
|
||||
internal int BezelOffsetX;
|
||||
/// <summary>SLS Bezel Offset Y. </summary>
|
||||
internal int BezelOffsetY;
|
||||
/// <summary> SLS Display Height. </summary>
|
||||
internal int DisplayHeight;
|
||||
/// <summary> SLS Display Width. </summary>
|
||||
internal int DisplayWidth;
|
||||
/// <summary> The current display map index. It is the OS Desktop index. </summary>
|
||||
internal int SLSMapIndex;
|
||||
}
|
||||
|
||||
#endregion ADLSLS
|
||||
|
||||
#endregion Export Struct
|
||||
|
||||
#region ADL Class
|
||||
@ -225,28 +448,31 @@ namespace ATI.ADL
|
||||
internal static extern HMODULE GetModuleHandle (string moduleName);
|
||||
|
||||
[DllImport(Atiadlxx_FileName)]
|
||||
internal static extern int ADL_Main_Control_Create (ADL_Main_Memory_Alloc callback, int enumConnectedAdapters);
|
||||
internal static extern int ADL2_Main_Control_Create (ADL2_Main_Memory_Alloc callback, int enumConnectedAdapters);
|
||||
|
||||
[DllImport(Atiadlxx_FileName)]
|
||||
internal static extern int ADL_Main_Control_Destroy ();
|
||||
internal static extern int ADL2_Main_Control_Destroy ();
|
||||
|
||||
[DllImport(Atiadlxx_FileName)]
|
||||
internal static extern int ADL_Main_Control_IsFunctionValid (HMODULE module, string procName);
|
||||
internal static extern int ADL2_Main_Control_IsFunctionValid (HMODULE module, string procName);
|
||||
|
||||
[DllImport(Atiadlxx_FileName)]
|
||||
internal static extern FARPROC ADL_Main_Control_GetProcAddress (HMODULE module, string procName);
|
||||
internal static extern FARPROC ADL2_Main_Control_GetProcAddress (HMODULE module, string procName);
|
||||
|
||||
[DllImport(Atiadlxx_FileName)]
|
||||
internal static extern int ADL_Adapter_NumberOfAdapters_Get (ref int numAdapters);
|
||||
internal static extern int ADL2_Adapter_NumberOfAdapters_Get (ref int numAdapters);
|
||||
|
||||
[DllImport(Atiadlxx_FileName)]
|
||||
internal static extern int ADL_Adapter_AdapterInfo_Get (IntPtr info, int inputSize);
|
||||
internal static extern int ADL2_Adapter_AdapterInfo_Get (IntPtr info, int inputSize);
|
||||
|
||||
[DllImport(Atiadlxx_FileName)]
|
||||
internal static extern int ADL_Adapter_Active_Get(int adapterIndex, ref int status);
|
||||
internal static extern int ADL2_Adapter_Active_Get(int adapterIndex, ref int status);
|
||||
|
||||
[DllImport(Atiadlxx_FileName)]
|
||||
internal static extern int ADL_Display_DisplayInfo_Get(int adapterIndex, ref int numDisplays, out IntPtr displayInfoArray, int forceDetect);
|
||||
internal static extern int ADL2_Display_DisplayInfo_Get(int adapterIndex, ref int numDisplays, out IntPtr displayInfoArray, int forceDetect);
|
||||
|
||||
[DllImport(Atiadlxx_FileName)]
|
||||
internal static extern int ADL2_Display_SLSMapConfig_Get(int iAdapterIndex, int iSLSMapIndex, ref ADLSLSMap SLSMap, ref int NumSLSTarget, out IntPtr SLSTargetArray, ref int lpNumNativeMode, out IntPtr NativeMode, ref int NumBezelMode, out IntPtr BezelMode, ref int NumTransientMode, out IntPtr TransientMode, ref int NumSLSOffset, out IntPtr SLSOffset, int iOption);
|
||||
|
||||
#endregion DLLImport
|
||||
}
|
||||
@ -271,7 +497,7 @@ namespace ATI.ADL
|
||||
{
|
||||
try
|
||||
{
|
||||
if (1 == ADLImport.ADL_Main_Control_IsFunctionValid(IntPtr.Zero, "ADL_Main_Control_Create"))
|
||||
if (1 == ADLImport.ADL2_Main_Control_IsFunctionValid(IntPtr.Zero, "ADL2_Main_Control_Create"))
|
||||
{
|
||||
ADLLibrary = ADLImport.GetModuleHandle(ADLImport.Atiadlxx_FileName);
|
||||
}
|
||||
@ -288,7 +514,7 @@ namespace ATI.ADL
|
||||
{
|
||||
if (System.IntPtr.Zero != ADLCheckLibrary_.ADLLibrary)
|
||||
{
|
||||
ADLImport.ADL_Main_Control_Destroy();
|
||||
ADLImport.ADL2_Main_Control_Destroy();
|
||||
}
|
||||
}
|
||||
#endregion Destructor
|
||||
@ -302,7 +528,7 @@ namespace ATI.ADL
|
||||
bool result = false;
|
||||
if (System.IntPtr.Zero != ADLCheckLibrary_.ADLLibrary)
|
||||
{
|
||||
if (1 == ADLImport.ADL_Main_Control_IsFunctionValid(ADLCheckLibrary_.ADLLibrary, functionName))
|
||||
if (1 == ADLImport.ADL2_Main_Control_IsFunctionValid(ADLCheckLibrary_.ADLLibrary, functionName))
|
||||
{
|
||||
result = true;
|
||||
}
|
||||
@ -320,7 +546,7 @@ namespace ATI.ADL
|
||||
FARPROC result = System.IntPtr.Zero;
|
||||
if (System.IntPtr.Zero != ADLCheckLibrary_.ADLLibrary)
|
||||
{
|
||||
result = ADLImport.ADL_Main_Control_GetProcAddress(ADLCheckLibrary_.ADLLibrary, functionName);
|
||||
result = ADLImport.ADL2_Main_Control_GetProcAddress(ADLCheckLibrary_.ADLLibrary, functionName);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -330,168 +556,192 @@ namespace ATI.ADL
|
||||
|
||||
#region Export Functions
|
||||
|
||||
#region ADL_Main_Memory_Alloc
|
||||
#region ADL2_Main_Memory_Alloc
|
||||
/// <summary> Build in memory allocation function</summary>
|
||||
internal static ADL_Main_Memory_Alloc ADL_Main_Memory_Alloc = ADL_Main_Memory_Alloc_;
|
||||
internal static ADL2_Main_Memory_Alloc ADL2_Main_Memory_Alloc = ADL2_Main_Memory_Alloc_;
|
||||
/// <summary> Build in memory allocation function</summary>
|
||||
/// <param name="size">input size</param>
|
||||
/// <returns>return the memory buffer</returns>
|
||||
private static IntPtr ADL_Main_Memory_Alloc_ (int size)
|
||||
private static IntPtr ADL2_Main_Memory_Alloc_ (int size)
|
||||
{
|
||||
IntPtr result = Marshal.AllocCoTaskMem(size);
|
||||
return result;
|
||||
}
|
||||
#endregion ADL_Main_Memory_Alloc
|
||||
#endregion ADL2_Main_Memory_Alloc
|
||||
|
||||
#region ADL_Main_Memory_Free
|
||||
#region ADL2_Main_Memory_Free
|
||||
/// <summary> Build in memory free function</summary>
|
||||
/// <param name="buffer">input buffer</param>
|
||||
internal static void ADL_Main_Memory_Free (IntPtr buffer)
|
||||
internal static void ADL2_Main_Memory_Free (IntPtr buffer)
|
||||
{
|
||||
if (IntPtr.Zero != buffer)
|
||||
{
|
||||
Marshal.FreeCoTaskMem(buffer);
|
||||
}
|
||||
}
|
||||
#endregion ADL_Main_Memory_Free
|
||||
#endregion ADL2_Main_Memory_Free
|
||||
|
||||
#region ADL_Main_Control_Create
|
||||
/// <summary> ADL_Main_Control_Create Delegates</summary>
|
||||
internal static ADL_Main_Control_Create ADL_Main_Control_Create
|
||||
#region ADL2_Main_Control_Create
|
||||
/// <summary> ADL2_Main_Control_Create Delegates</summary>
|
||||
internal static ADL2_Main_Control_Create ADL2_Main_Control_Create
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!ADL_Main_Control_Create_Check && null == ADL_Main_Control_Create_)
|
||||
if (!ADL2_Main_Control_Create_Check && null == ADL2_Main_Control_Create_)
|
||||
{
|
||||
ADL_Main_Control_Create_Check = true;
|
||||
if (ADLCheckLibrary.IsFunctionValid("ADL_Main_Control_Create"))
|
||||
ADL2_Main_Control_Create_Check = true;
|
||||
if (ADLCheckLibrary.IsFunctionValid("ADL2_Main_Control_Create"))
|
||||
{
|
||||
ADL_Main_Control_Create_ = ADLImport.ADL_Main_Control_Create;
|
||||
ADL2_Main_Control_Create_ = ADLImport.ADL2_Main_Control_Create;
|
||||
}
|
||||
}
|
||||
return ADL_Main_Control_Create_;
|
||||
return ADL2_Main_Control_Create_;
|
||||
}
|
||||
}
|
||||
/// <summary> Private Delegate</summary>
|
||||
private static ADL_Main_Control_Create ADL_Main_Control_Create_ = null;
|
||||
private static ADL2_Main_Control_Create ADL2_Main_Control_Create_ = null;
|
||||
/// <summary> check flag to indicate the delegate has been checked</summary>
|
||||
private static bool ADL_Main_Control_Create_Check = false;
|
||||
#endregion ADL_Main_Control_Create
|
||||
private static bool ADL2_Main_Control_Create_Check = false;
|
||||
#endregion ADL2_Main_Control_Create
|
||||
|
||||
#region ADL_Main_Control_Destroy
|
||||
/// <summary> ADL_Main_Control_Destroy Delegates</summary>
|
||||
internal static ADL_Main_Control_Destroy ADL_Main_Control_Destroy
|
||||
#region ADL2_Main_Control_Destroy
|
||||
/// <summary> ADL2_Main_Control_Destroy Delegates</summary>
|
||||
internal static ADL2_Main_Control_Destroy ADL2_Main_Control_Destroy
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!ADL_Main_Control_Destroy_Check && null == ADL_Main_Control_Destroy_)
|
||||
if (!ADL2_Main_Control_Destroy_Check && null == ADL2_Main_Control_Destroy_)
|
||||
{
|
||||
ADL_Main_Control_Destroy_Check = true;
|
||||
if (ADLCheckLibrary.IsFunctionValid("ADL_Main_Control_Destroy"))
|
||||
ADL2_Main_Control_Destroy_Check = true;
|
||||
if (ADLCheckLibrary.IsFunctionValid("ADL2_Main_Control_Destroy"))
|
||||
{
|
||||
ADL_Main_Control_Destroy_ = ADLImport.ADL_Main_Control_Destroy;
|
||||
ADL2_Main_Control_Destroy_ = ADLImport.ADL2_Main_Control_Destroy;
|
||||
}
|
||||
}
|
||||
return ADL_Main_Control_Destroy_;
|
||||
return ADL2_Main_Control_Destroy_;
|
||||
}
|
||||
}
|
||||
/// <summary> Private Delegate</summary>
|
||||
private static ADL_Main_Control_Destroy ADL_Main_Control_Destroy_ = null;
|
||||
private static ADL2_Main_Control_Destroy ADL2_Main_Control_Destroy_ = null;
|
||||
/// <summary> check flag to indicate the delegate has been checked</summary>
|
||||
private static bool ADL_Main_Control_Destroy_Check = false;
|
||||
#endregion ADL_Main_Control_Destroy
|
||||
private static bool ADL2_Main_Control_Destroy_Check = false;
|
||||
#endregion ADL2_Main_Control_Destroy
|
||||
|
||||
#region ADL_Adapter_NumberOfAdapters_Get
|
||||
/// <summary> ADL_Adapter_NumberOfAdapters_Get Delegates</summary>
|
||||
internal static ADL_Adapter_NumberOfAdapters_Get ADL_Adapter_NumberOfAdapters_Get
|
||||
#region ADL2_Adapter_NumberOfAdapters_Get
|
||||
/// <summary> ADL2_Adapter_NumberOfAdapters_Get Delegates</summary>
|
||||
internal static ADL2_Adapter_NumberOfAdapters_Get ADL2_Adapter_NumberOfAdapters_Get
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!ADL_Adapter_NumberOfAdapters_Get_Check && null == ADL_Adapter_NumberOfAdapters_Get_)
|
||||
if (!ADL2_Adapter_NumberOfAdapters_Get_Check && null == ADL2_Adapter_NumberOfAdapters_Get_)
|
||||
{
|
||||
ADL_Adapter_NumberOfAdapters_Get_Check = true;
|
||||
if (ADLCheckLibrary.IsFunctionValid("ADL_Adapter_NumberOfAdapters_Get"))
|
||||
ADL2_Adapter_NumberOfAdapters_Get_Check = true;
|
||||
if (ADLCheckLibrary.IsFunctionValid("ADL2_Adapter_NumberOfAdapters_Get"))
|
||||
{
|
||||
ADL_Adapter_NumberOfAdapters_Get_ = ADLImport.ADL_Adapter_NumberOfAdapters_Get;
|
||||
ADL2_Adapter_NumberOfAdapters_Get_ = ADLImport.ADL2_Adapter_NumberOfAdapters_Get;
|
||||
}
|
||||
}
|
||||
return ADL_Adapter_NumberOfAdapters_Get_;
|
||||
return ADL2_Adapter_NumberOfAdapters_Get_;
|
||||
}
|
||||
}
|
||||
/// <summary> Private Delegate</summary>
|
||||
private static ADL_Adapter_NumberOfAdapters_Get ADL_Adapter_NumberOfAdapters_Get_ = null;
|
||||
private static ADL2_Adapter_NumberOfAdapters_Get ADL2_Adapter_NumberOfAdapters_Get_ = null;
|
||||
/// <summary> check flag to indicate the delegate has been checked</summary>
|
||||
private static bool ADL_Adapter_NumberOfAdapters_Get_Check = false;
|
||||
#endregion ADL_Adapter_NumberOfAdapters_Get
|
||||
private static bool ADL2_Adapter_NumberOfAdapters_Get_Check = false;
|
||||
#endregion ADL2_Adapter_NumberOfAdapters_Get
|
||||
|
||||
#region ADL_Adapter_AdapterInfo_Get
|
||||
/// <summary> ADL_Adapter_AdapterInfo_Get Delegates</summary>
|
||||
internal static ADL_Adapter_AdapterInfo_Get ADL_Adapter_AdapterInfo_Get
|
||||
#region ADL2_Adapter_AdapterInfo_Get
|
||||
/// <summary> ADL2_Adapter_AdapterInfo_Get Delegates</summary>
|
||||
internal static ADL2_Adapter_AdapterInfo_Get ADL2_Adapter_AdapterInfo_Get
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!ADL_Adapter_AdapterInfo_Get_Check && null == ADL_Adapter_AdapterInfo_Get_)
|
||||
if (!ADL2_Adapter_AdapterInfo_Get_Check && null == ADL2_Adapter_AdapterInfo_Get_)
|
||||
{
|
||||
ADL_Adapter_AdapterInfo_Get_Check = true;
|
||||
if (ADLCheckLibrary.IsFunctionValid("ADL_Adapter_AdapterInfo_Get"))
|
||||
ADL2_Adapter_AdapterInfo_Get_Check = true;
|
||||
if (ADLCheckLibrary.IsFunctionValid("ADL2_Adapter_AdapterInfo_Get"))
|
||||
{
|
||||
ADL_Adapter_AdapterInfo_Get_ = ADLImport.ADL_Adapter_AdapterInfo_Get;
|
||||
ADL2_Adapter_AdapterInfo_Get_ = ADLImport.ADL2_Adapter_AdapterInfo_Get;
|
||||
}
|
||||
}
|
||||
return ADL_Adapter_AdapterInfo_Get_;
|
||||
return ADL2_Adapter_AdapterInfo_Get_;
|
||||
}
|
||||
}
|
||||
/// <summary> Private Delegate</summary>
|
||||
private static ADL_Adapter_AdapterInfo_Get ADL_Adapter_AdapterInfo_Get_ = null;
|
||||
private static ADL2_Adapter_AdapterInfo_Get ADL2_Adapter_AdapterInfo_Get_ = null;
|
||||
/// <summary> check flag to indicate the delegate has been checked</summary>
|
||||
private static bool ADL_Adapter_AdapterInfo_Get_Check = false;
|
||||
#endregion ADL_Adapter_AdapterInfo_Get
|
||||
private static bool ADL2_Adapter_AdapterInfo_Get_Check = false;
|
||||
#endregion ADL2_Adapter_AdapterInfo_Get
|
||||
|
||||
#region ADL_Adapter_Active_Get
|
||||
/// <summary> ADL_Adapter_Active_Get Delegates</summary>
|
||||
internal static ADL_Adapter_Active_Get ADL_Adapter_Active_Get
|
||||
#region ADL2_Adapter_Active_Get
|
||||
/// <summary> ADL2_Adapter_Active_Get Delegates</summary>
|
||||
internal static ADL2_Adapter_Active_Get ADL2_Adapter_Active_Get
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!ADL_Adapter_Active_Get_Check && null == ADL_Adapter_Active_Get_)
|
||||
if (!ADL2_Adapter_Active_Get_Check && null == ADL2_Adapter_Active_Get_)
|
||||
{
|
||||
ADL_Adapter_Active_Get_Check = true;
|
||||
if (ADLCheckLibrary.IsFunctionValid("ADL_Adapter_Active_Get"))
|
||||
ADL2_Adapter_Active_Get_Check = true;
|
||||
if (ADLCheckLibrary.IsFunctionValid("ADL2_Adapter_Active_Get"))
|
||||
{
|
||||
ADL_Adapter_Active_Get_ = ADLImport.ADL_Adapter_Active_Get;
|
||||
ADL2_Adapter_Active_Get_ = ADLImport.ADL2_Adapter_Active_Get;
|
||||
}
|
||||
}
|
||||
return ADL_Adapter_Active_Get_;
|
||||
return ADL2_Adapter_Active_Get_;
|
||||
}
|
||||
}
|
||||
/// <summary> Private Delegate</summary>
|
||||
private static ADL_Adapter_Active_Get ADL_Adapter_Active_Get_ = null;
|
||||
private static ADL2_Adapter_Active_Get ADL2_Adapter_Active_Get_ = null;
|
||||
/// <summary> check flag to indicate the delegate has been checked</summary>
|
||||
private static bool ADL_Adapter_Active_Get_Check = false;
|
||||
#endregion ADL_Adapter_Active_Get
|
||||
private static bool ADL2_Adapter_Active_Get_Check = false;
|
||||
#endregion ADL2_Adapter_Active_Get
|
||||
|
||||
#region ADL_Display_DisplayInfo_Get
|
||||
/// <summary> ADL_Display_DisplayInfo_Get Delegates</summary>
|
||||
internal static ADL_Display_DisplayInfo_Get ADL_Display_DisplayInfo_Get
|
||||
#region ADL2_Display_DisplayInfo_Get
|
||||
/// <summary> ADL2_Display_DisplayInfo_Get Delegates</summary>
|
||||
internal static ADL2_Display_DisplayInfo_Get ADL2_Display_DisplayInfo_Get
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!ADL_Display_DisplayInfo_Get_Check && null == ADL_Display_DisplayInfo_Get_)
|
||||
if (!ADL2_Display_DisplayInfo_Get_Check && null == ADL2_Display_DisplayInfo_Get_)
|
||||
{
|
||||
ADL_Display_DisplayInfo_Get_Check = true;
|
||||
if (ADLCheckLibrary.IsFunctionValid("ADL_Display_DisplayInfo_Get"))
|
||||
ADL2_Display_DisplayInfo_Get_Check = true;
|
||||
if (ADLCheckLibrary.IsFunctionValid("ADL2_Display_DisplayInfo_Get"))
|
||||
{
|
||||
ADL_Display_DisplayInfo_Get_ = ADLImport.ADL_Display_DisplayInfo_Get;
|
||||
ADL2_Display_DisplayInfo_Get_ = ADLImport.ADL2_Display_DisplayInfo_Get;
|
||||
}
|
||||
}
|
||||
return ADL_Display_DisplayInfo_Get_;
|
||||
return ADL2_Display_DisplayInfo_Get_;
|
||||
}
|
||||
}
|
||||
/// <summary> Private Delegate</summary>
|
||||
private static ADL_Display_DisplayInfo_Get ADL_Display_DisplayInfo_Get_ = null;
|
||||
private static ADL2_Display_DisplayInfo_Get ADL2_Display_DisplayInfo_Get_ = null;
|
||||
/// <summary> check flag to indicate the delegate has been checked</summary>
|
||||
private static bool ADL_Display_DisplayInfo_Get_Check = false;
|
||||
#endregion ADL_Display_DisplayInfo_Get
|
||||
private static bool ADL2_Display_DisplayInfo_Get_Check = false;
|
||||
#endregion ADL2_Display_DisplayInfo_Get
|
||||
|
||||
#region ADL2_Display_SLSMapConfig_Get
|
||||
/// <summary> ADL2_Display_SLSMapConfig_Get Delegates</summary>
|
||||
internal static ADL2_Display_SLSMapConfig_Get ADL2_Display_SLSMapConfig_Get
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!ADL2_Display_SLSMapConfig_Get_Check && null == ADL2_Display_SLSMapConfig_Get_)
|
||||
{
|
||||
ADL2_Display_SLSMapConfig_Get_Check = true;
|
||||
if (ADLCheckLibrary.IsFunctionValid("ADL2_Display_SLSMapConfig_Get"))
|
||||
{
|
||||
ADL2_Display_SLSMapConfig_Get_ = ADLImport.ADL2_Display_SLSMapConfig_Get;
|
||||
}
|
||||
}
|
||||
return ADL2_Display_SLSMapConfig_Get_;
|
||||
}
|
||||
}
|
||||
/// <summary> Private Delegate</summary>
|
||||
private static ADL2_Display_SLSMapConfig_Get ADL2_Display_SLSMapConfig_Get_ = null;
|
||||
/// <summary> check flag to indicate the delegate has been checked</summary>
|
||||
private static bool ADL2_Display_SLSMapConfig_Get_Check = false;
|
||||
#endregion ADL2_Display_SLSMapConfig_Get
|
||||
|
||||
|
||||
#endregion Export Functions
|
||||
}
|
||||
|
@ -51,6 +51,7 @@
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="AMD\ADL.cs" />
|
||||
<Compile Include="SharedLogger.cs" />
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
@ -151,9 +152,7 @@
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
</COMReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="AMD\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
|
@ -12,6 +12,7 @@ using WindowsDisplayAPI;
|
||||
using System.Diagnostics;
|
||||
using System.Text.RegularExpressions;
|
||||
using NvAPIWrapper.Native.GPU;
|
||||
using ATI.ADL;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace DisplayMagicianShared
|
||||
@ -793,6 +794,30 @@ namespace DisplayMagicianShared
|
||||
SharedLogger.logger.Debug(ex, "ProfileRepository/GenerateProfileDisplayIdentifiers: Attemped to get GetPhysicalCPUs through NvAPIWrapper library but got exception. This means the video card isn't compatible with the NvAPIWrapper library we use. It is unlikely to be an NVIDIA video card.");
|
||||
}
|
||||
|
||||
// If the Video Card is an AMD, then we should generate specific AMD displayIdentifiers
|
||||
bool isAmd = false;
|
||||
int ADLRet = -1;
|
||||
int NumberOfAdapters = 0;
|
||||
int NumberOfDisplays = 0;
|
||||
if (ADL.ADL2_Main_Control_Create != null)
|
||||
// Second parameter is 1: So we only get the adapters present in the system
|
||||
ADLRet = ADL.ADL2_Main_Control_Create(ADL.ADL2_Main_Memory_Alloc, 1);
|
||||
if (ADL.ADL_SUCCESS == ADLRet)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
myPhysicalGPUs = NvAPIWrapper.GPU.PhysicalGPU.GetPhysicalGPUs();
|
||||
isNvidia = true;
|
||||
SharedLogger.logger.Debug($"ProfileRepository/GenerateProfileDisplayIdentifiers: The video card is a NVIDIA video card.");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
SharedLogger.logger.Debug(ex, "ProfileRepository/GenerateProfileDisplayIdentifiers: Attemped to get GetPhysicalCPUs through NvAPIWrapper library but got exception. This means the video card isn't compatible with the NvAPIWrapper library we use. It is unlikely to be an NVIDIA video card.");
|
||||
}
|
||||
|
||||
if (isNvidia && myPhysicalGPUs != null && myPhysicalGPUs.Length > 0)
|
||||
//if (false)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user