mirror of
https://github.com/terrymacdonald/DisplayMagician.git
synced 2024-08-30 18:32:20 +00:00
[WIP] Working adapter and display grabbing
Need to add Display Device info extraction. Have created consts for the connector types in c#, but now need to add the logic to decode the ADLDeviceConfig returned value!
This commit is contained in:
parent
583fffb612
commit
a39d9cbe01
@ -82,7 +82,7 @@ namespace ATI.ADL
|
|||||||
/// <param name="adapterIndex"> Adapter Index.</param>
|
/// <param name="adapterIndex"> Adapter Index.</param>
|
||||||
/// <param name="adapterCapabilities"> The pointer to the ADLAdapterCaps structure storing the retrieved adapter capability information.</param>
|
/// <param name="adapterCapabilities"> The pointer to the ADLAdapterCaps structure storing the retrieved adapter capability information.</param>
|
||||||
/// <returns>return ADL Error Code</returns>
|
/// <returns>return ADL Error Code</returns>
|
||||||
internal delegate int ADL_Adapter_Caps(int adapterIndex, out IntPtr adapterCapabilities);
|
internal delegate int ADL_AdapterX2_Caps(int adapterIndex, out ADLAdapterCapsX2 adapterCapabilities);
|
||||||
|
|
||||||
/// <summary>Get display information based on adapter index</summary>
|
/// <summary>Get display information based on adapter index</summary>
|
||||||
/// <param name="adapterIndex">Adapter Index</param>
|
/// <param name="adapterIndex">Adapter Index</param>
|
||||||
@ -92,6 +92,13 @@ namespace ATI.ADL
|
|||||||
/// <returns>return ADL Error Code</returns>
|
/// <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 ADL_Display_DisplayInfo_Get(int adapterIndex, ref int numDisplays, out IntPtr displayInfoArray, int forceDetect);
|
||||||
|
|
||||||
|
/// <summary>This function retrieves HDTV capability settings for a specified display.</summary>
|
||||||
|
/// <param name="adapterIndex">Adapter Index</param>
|
||||||
|
/// <param name="displayIndex">Display Index</param>
|
||||||
|
/// <param name="displayConfig">return ADLDisplayConfig with HDTV capability settings in it</param>
|
||||||
|
/// <returns>return ADL Error Code</returns>
|
||||||
|
internal delegate int ADL_Display_DeviceConfig_Get(int adapterIndex, int displayIndex, out ADLDisplayConfig displayConfig);
|
||||||
|
|
||||||
/// <summary>Function to retrieve an SLS configuration.</summary>
|
/// <summary>Function to retrieve an SLS configuration.</summary>
|
||||||
/// <param name="adapterIndex">Adapter Index</param>
|
/// <param name="adapterIndex">Adapter Index</param>
|
||||||
/// <param name="SLSMapIndex">Specifies the SLS map index to be queried.</param>
|
/// <param name="SLSMapIndex">Specifies the SLS map index to be queried.</param>
|
||||||
@ -268,24 +275,42 @@ namespace ATI.ADL
|
|||||||
internal ADLDisplayInfo[] ADLDisplayInfo;
|
internal ADLDisplayInfo[] ADLDisplayInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary> ADLDisplayConfig Structure</summary>
|
||||||
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
|
internal struct ADLDisplayConfig
|
||||||
|
{
|
||||||
|
/// <summary> HDTV Connector Type </summary>
|
||||||
|
internal long ConnectorType;
|
||||||
|
/// <summary> HDTV Capabilities themselves </summary>
|
||||||
|
internal long DeviceData;
|
||||||
|
/// <summary> Overridden HDTV capabilities</summary>
|
||||||
|
internal long OverriddedDeviceData;
|
||||||
|
/// <summary> Reserved for future use</summary>
|
||||||
|
internal long Reserved;
|
||||||
|
/// <summary> Size of this data structure </summary>
|
||||||
|
internal long Size;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary> ADLAdapterCaps Structure</summary>
|
/// <summary> ADLAdapterCaps Structure</summary>
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
internal struct ADLAdapterCaps
|
internal struct ADLAdapterCapsX2
|
||||||
{
|
{
|
||||||
/// <summary> AdapterID for this adapter </summary>
|
/// <summary> AdapterID for this adapter </summary>
|
||||||
internal int AdapterID;
|
internal int AdapterID;
|
||||||
/// <summary> The bit mask identifies the adapter caps. </summary>
|
|
||||||
internal int CapsMask;
|
|
||||||
/// <summary> The bit identifies the adapter caps define_adapter_caps. </summary>
|
|
||||||
internal int CapsValue;
|
|
||||||
/// <summary> Number of controllers for this adapter. </summary>
|
/// <summary> Number of controllers for this adapter. </summary>
|
||||||
internal int NumControllers;
|
internal int NumControllers;
|
||||||
/// <summary> Number of displays for this adapter.</summary>
|
/// <summary> Number of displays for this adapter.</summary>
|
||||||
internal int NumDisplays;
|
internal int NumDisplays;
|
||||||
/// <summary> Number of GLSyncConnectors. </summary>
|
|
||||||
internal int NumOfGLSyncConnectors;
|
|
||||||
/// <summary> Number of overlays for this adapter.</summary>
|
/// <summary> Number of overlays for this adapter.</summary>
|
||||||
internal int NumOverlays;
|
internal int NumOverlays;
|
||||||
|
/// <summary> Number of GLSyncConnectors. </summary>
|
||||||
|
internal int NumOfGLSyncConnectors;
|
||||||
|
/// <summary> The bit mask identifies the adapter caps. </summary>
|
||||||
|
internal int CapsMask;
|
||||||
|
/// <summary> The bit identifies the adapter caps define_adapter_caps. </summary>
|
||||||
|
internal int CapsValue;
|
||||||
|
/// <summary> Number of Connectors for this adapter. </summary>
|
||||||
|
internal int NumConnectors;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion ADLDisplayInfo
|
#endregion ADLDisplayInfo
|
||||||
@ -477,6 +502,64 @@ namespace ATI.ADL
|
|||||||
internal const int ADL_TRUE = 1;
|
internal const int ADL_TRUE = 1;
|
||||||
/// <summary> Maximum number of ADLModes for the adapter </summary>
|
/// <summary> Maximum number of ADLModes for the adapter </summary>
|
||||||
internal const int ADL_FALSE = 0;
|
internal const int ADL_FALSE = 0;
|
||||||
|
/// <summary> Indicates the active dongle, all types </summary>
|
||||||
|
internal const int ADL_CONNECTION_TYPE_ACTIVE_DONGLE = 12;
|
||||||
|
/// <summary> Indicates the Active dongle DP->DVI(double link) connection type is valid. </summary>
|
||||||
|
internal const int ADL_CONNECTION_TYPE_ACTIVE_DONGLE_DP_DVI_DL = 6;
|
||||||
|
/// <summary> Indicates the Active dongle DP->DVI(single link) connection type is valid. </summary>
|
||||||
|
internal const int ADL_CONNECTION_TYPE_ACTIVE_DONGLE_DP_DVI_SL = 5;
|
||||||
|
/// <summary> Indicates the Active dongle DP->HDMI connection type is valid. </summary>
|
||||||
|
internal const int ADL_CONNECTION_TYPE_ACTIVE_DONGLE_DP_HDMI = 7;
|
||||||
|
/// <summary> Indicates the Active dongle DP->VGA connection type is valid. </summary>
|
||||||
|
internal const int ADL_CONNECTION_TYPE_ACTIVE_DONGLE_DP_VGA = 8;
|
||||||
|
/// <summary> Indicates the DISPLAY PORT connection type is valid. </summary>
|
||||||
|
internal const int ADL_CONNECTION_TYPE_DISPLAY_PORT = 4;
|
||||||
|
/// <summary> Indicates the DVI_I connection type is valid. </summary>
|
||||||
|
internal const int ADL_CONNECTION_TYPE_DVI = 1;
|
||||||
|
/// <summary> Indicates the DVI_SL connection type is valid. </summary>
|
||||||
|
internal const int ADL_CONNECTION_TYPE_DVI_SL = 2;
|
||||||
|
/// <summary> Indicates the HDMI connection type is valid. </summary>
|
||||||
|
internal const int ADL_CONNECTION_TYPE_HDMI = 3;
|
||||||
|
/// <summary> Indicates the MST type is valid. </summary>
|
||||||
|
internal const int ADL_CONNECTION_TYPE_MST = 11;
|
||||||
|
/// <summary> Indicates the Active dongle DP->VGA connection type is valid. </summary>
|
||||||
|
internal const int ADL_CONNECTION_TYPE_PASSIVE_DONGLE_DP_DVI = 10;
|
||||||
|
/// <summary> Indicates the Passive dongle DP->HDMI connection type is valid. </summary>
|
||||||
|
internal const int ADL_CONNECTION_TYPE_PASSIVE_DONGLE_DP_HDMI = 9;
|
||||||
|
/// <summary> Indicates the VGA connection type is valid. </summary>
|
||||||
|
internal const int ADL_CONNECTION_TYPE_VGA = 0;
|
||||||
|
/// <summary> Indicates the Virtual Connection Type.</summary>
|
||||||
|
internal const int ADL_CONNECTION_TYPE_VIRTUAL = 13;
|
||||||
|
/// <summary> Indicates Active Dongle-JP Connector type.</summary>
|
||||||
|
internal const int ADL_CONNECTOR_TYPE_ATICVDONGLE_JP = 5;
|
||||||
|
/// <summary> Indicates Active Dongle-NA Connector type.</summary>
|
||||||
|
internal const int ADL_CONNECTOR_TYPE_ATICVDONGLE_NA = 4;
|
||||||
|
/// <summary> Indicates Active Dongle-NONI2C Connector type.</summary>
|
||||||
|
internal const int ADL_CONNECTOR_TYPE_ATICVDONGLE_NONI2C = 6;
|
||||||
|
/// <summary> Indicates Active Dongle-NONI2C-D Connector type.</summary>
|
||||||
|
internal const int ADL_CONNECTOR_TYPE_ATICVDONGLE_NONI2C_D = 7;
|
||||||
|
/// <summary> Indicates Display port Connector type.</summary>
|
||||||
|
internal const int ADL_CONNECTOR_TYPE_DISPLAYPORT = 10;
|
||||||
|
/// <summary> Indicates DVI-D Connector type.</summary>
|
||||||
|
internal const int ADL_CONNECTOR_TYPE_DVI_D = 2;
|
||||||
|
/// <summary> Indicates DVI-I Connector type.</summary>
|
||||||
|
internal const int ADL_CONNECTOR_TYPE_DVI_I = 3;
|
||||||
|
/// <summary> Indicates EDP Connector type.</summary>
|
||||||
|
internal const int ADL_CONNECTOR_TYPE_EDP = 11;
|
||||||
|
/// <summary> Indicates HDMI-Type A Connector type.</summary>
|
||||||
|
internal const int ADL_CONNECTOR_TYPE_HDMI_TYPE_A = 8;
|
||||||
|
/// <summary> Indicates HDMI-Type B Connector type.</summary>
|
||||||
|
internal const int ADL_CONNECTOR_TYPE_HDMI_TYPE_B = 9;
|
||||||
|
/// <summary> Indicates MiniDP Connector type. </summary>
|
||||||
|
internal const int ADL_CONNECTOR_TYPE_MINI_DISPLAYPORT = 12;
|
||||||
|
/// <summary> Indicates Unknown Connector type. </summary>
|
||||||
|
internal const int ADL_CONNECTOR_TYPE_UNKNOWN = 0;
|
||||||
|
/// <summary> Indicates USB type C Connector type. </summary>
|
||||||
|
internal const int ADL_CONNECTOR_TYPE_USB_TYPE_C = 14;
|
||||||
|
/// <summary> Indicates VGA Connector type. </summary>
|
||||||
|
internal const int ADL_CONNECTOR_TYPE_VGA = 1;
|
||||||
|
/// <summary> Indicates Virtual Connector type.</summary>
|
||||||
|
internal const int ADL_CONNECTOR_TYPE_VIRTUAL = 13;
|
||||||
|
|
||||||
#endregion Internal Constant
|
#endregion Internal Constant
|
||||||
|
|
||||||
@ -520,12 +603,15 @@ namespace ATI.ADL
|
|||||||
internal static extern int ADL_Adapter_ID_Get(int adapterIndex, ref int adapterId);
|
internal static extern int ADL_Adapter_ID_Get(int adapterIndex, ref int adapterId);
|
||||||
|
|
||||||
[DllImport(Atiadlxx_FileName)]
|
[DllImport(Atiadlxx_FileName)]
|
||||||
internal static extern int ADL_Adapter_Caps(int adapterIndex, out IntPtr adapterCapabilities);
|
internal static extern int ADL_AdapterX2_Caps(int adapterIndex, out ADLAdapterCapsX2 adapterCapabilities);
|
||||||
|
|
||||||
|
|
||||||
[DllImport(Atiadlxx_FileName)]
|
[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 ADL_Display_DisplayInfo_Get(int adapterIndex, ref int numDisplays, out IntPtr displayInfoArray, int forceDetect);
|
||||||
|
|
||||||
|
[DllImport(Atiadlxx_FileName)]
|
||||||
|
internal static extern int ADL_Display_DeviceConfig_Get(int adapterIndex, int displayIndex, out ADLDisplayConfig displayConfig);
|
||||||
|
|
||||||
[DllImport(Atiadlxx_FileName)]
|
[DllImport(Atiadlxx_FileName)]
|
||||||
internal static extern int ADL_Display_SLSMapConfig_Get(int adapterIndex, int SLSMapIndex, 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);
|
internal static extern int ADL_Display_SLSMapConfig_Get(int adapterIndex, int SLSMapIndex, 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);
|
||||||
|
|
||||||
@ -771,28 +857,28 @@ namespace ATI.ADL
|
|||||||
/// <summary> check flag to indicate the delegate has been checked</summary>
|
/// <summary> check flag to indicate the delegate has been checked</summary>
|
||||||
private static bool ADL_Adapter_ID_Get_Check = false;
|
private static bool ADL_Adapter_ID_Get_Check = false;
|
||||||
|
|
||||||
#region ADL_Adapter_Caps
|
#region ADL_AdapterX2_Caps
|
||||||
/// <summary> ADL_Adapter_Active_Get Delegates</summary>
|
/// <summary> ADL_AdapterX2_Caps Delegates</summary>
|
||||||
internal static ADL_Adapter_Caps ADL_Adapter_Caps
|
internal static ADL_AdapterX2_Caps ADL_AdapterX2_Caps
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (!ADL_Adapter_Caps_Check && null == ADL_Adapter_Caps_)
|
if (!ADL_AdapterX2_Caps_Check && null == ADL_AdapterX2_Caps_)
|
||||||
{
|
{
|
||||||
ADL_Adapter_Caps_Check = true;
|
ADL_AdapterX2_Caps_Check = true;
|
||||||
if (ADLCheckLibrary.IsFunctionValid("ADL_Adapter_Caps"))
|
if (ADLCheckLibrary.IsFunctionValid("ADL_AdapterX2_Caps"))
|
||||||
{
|
{
|
||||||
ADL_Adapter_Caps_ = ADLImport.ADL_Adapter_Caps;
|
ADL_AdapterX2_Caps_ = ADLImport.ADL_AdapterX2_Caps;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ADL_Adapter_Caps_;
|
return ADL_AdapterX2_Caps_;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// <summary> Private Delegate</summary>
|
/// <summary> Private Delegate</summary>
|
||||||
private static ADL_Adapter_Caps ADL_Adapter_Caps_ = null;
|
private static ADL_AdapterX2_Caps ADL_AdapterX2_Caps_ = null;
|
||||||
/// <summary> check flag to indicate the delegate has been checked</summary>
|
/// <summary> check flag to indicate the delegate has been checked</summary>
|
||||||
private static bool ADL_Adapter_Caps_Check = false;
|
private static bool ADL_AdapterX2_Caps_Check = false;
|
||||||
#endregion ADL_Adapter_Caps
|
#endregion ADL_AdapterX2_Caps
|
||||||
|
|
||||||
#region ADL_Adapter_Active_Get
|
#region ADL_Adapter_Active_Get
|
||||||
/// <summary> ADL_Adapter_Active_Get Delegates</summary>
|
/// <summary> ADL_Adapter_Active_Get Delegates</summary>
|
||||||
@ -817,6 +903,29 @@ namespace ATI.ADL
|
|||||||
private static bool ADL_Adapter_Active_Get_Check = false;
|
private static bool ADL_Adapter_Active_Get_Check = false;
|
||||||
#endregion ADL_Adapter_Active_Get
|
#endregion ADL_Adapter_Active_Get
|
||||||
|
|
||||||
|
#region ADL_Display_DeviceConfig_Get
|
||||||
|
/// <summary> ADL_Display_DeviceConfig_Get Delegates</summary>
|
||||||
|
internal static ADL_Display_DeviceConfig_Get ADL_Display_DeviceConfig_Get
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (!ADL_Display_DeviceConfig_Get_Check && null == ADL_Display_DeviceConfig_Get_)
|
||||||
|
{
|
||||||
|
ADL_Display_DeviceConfig_Get_Check = true;
|
||||||
|
if (ADLCheckLibrary.IsFunctionValid("ADL_Display_DeviceConfig_Get"))
|
||||||
|
{
|
||||||
|
ADL_Display_DeviceConfig_Get_ = ADLImport.ADL_Display_DeviceConfig_Get;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ADL_Display_DeviceConfig_Get_;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary> Private Delegate</summary>
|
||||||
|
private static ADL_Display_DeviceConfig_Get ADL_Display_DeviceConfig_Get_ = null;
|
||||||
|
/// <summary> check flag to indicate the delegate has been checked</summary>
|
||||||
|
private static bool ADL_Display_DeviceConfig_Get_Check = false;
|
||||||
|
#endregion ADL_Display_DeviceConfig_Get
|
||||||
|
|
||||||
#region ADL_Display_DisplayInfo_Get
|
#region ADL_Display_DisplayInfo_Get
|
||||||
/// <summary> ADL_Display_DisplayInfo_Get Delegates</summary>
|
/// <summary> ADL_Display_DisplayInfo_Get Delegates</summary>
|
||||||
internal static ADL_Display_DisplayInfo_Get ADL_Display_DisplayInfo_Get
|
internal static ADL_Display_DisplayInfo_Get ADL_Display_DisplayInfo_Get
|
||||||
|
@ -183,44 +183,16 @@ namespace DisplayMagicianShared.AMD
|
|||||||
SharedLogger.logger.Trace($"ADLWrapper/GenerateProfileDisplayIdentifiers: AMD Adapter #{i} ({OSAdapterInfoData.ADLAdapterInfo[i].AdapterName}) AdapterID is {AdapterID.ToString()}");
|
SharedLogger.logger.Trace($"ADLWrapper/GenerateProfileDisplayIdentifiers: AMD Adapter #{i} ({OSAdapterInfoData.ADLAdapterInfo[i].AdapterName}) AdapterID is {AdapterID.ToString()}");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the ADapter Capabilities
|
// Get the Adapter Capabilities
|
||||||
//
|
ADLAdapterCapsX2 AdapterCapabilities = new ADLAdapterCapsX2();
|
||||||
IntPtr AdapterCapabilitiesBuffer = IntPtr.Zero;
|
if (ADL.ADL_AdapterX2_Caps != null)
|
||||||
//ADLAdapterCaps AdapterCapabilities;
|
|
||||||
//ADLAdapterCaps AdapterCapabilities = new ADLAdapterCaps();
|
|
||||||
//AdapterCapabilitiesBuffer = Marshal.AllocCoTaskMem(Marshal.SizeOf(AdapterCapabilities));
|
|
||||||
|
|
||||||
//Marshal.StructureToPtr(OSAdapterInfoData, AdapterBuffer, false);
|
|
||||||
//IntPtr vtablePtr = Marshal.ReadIntPtr(instancePtr, 0);
|
|
||||||
//IntPtr AdapterCapabilitiesBuffer = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(ADLAdapterCaps)));
|
|
||||||
if (ADL.ADL_Adapter_Caps != null)
|
|
||||||
{
|
{
|
||||||
ADLRet = ADL.ADL_Adapter_Caps(OSAdapterInfoData.ADLAdapterInfo[i].AdapterIndex, out AdapterCapabilitiesBuffer);
|
ADLRet = ADL.ADL_AdapterX2_Caps(OSAdapterInfoData.ADLAdapterInfo[i].AdapterIndex, out AdapterCapabilities);
|
||||||
}
|
}
|
||||||
//Marshal.PtrToStructure(AdapterCapabilitiesBuffer, AdapterCapabilities);
|
|
||||||
//ADLAdapterCaps AdapterCapabilities = (ADLAdapterCaps)Marshal.PtrToStructure(AdapterCapabilitiesBuffer, typeof(ADLAdapterCaps));
|
|
||||||
IntPtr AdapterCapabilitiesPtr = Marshal.ReadIntPtr(AdapterCapabilitiesBuffer, 0);
|
|
||||||
ADLAdapterCaps AdapterCapabilities = Marshal.PtrToStructure<ADLAdapterCaps>(AdapterCapabilitiesPtr);
|
|
||||||
|
|
||||||
|
//ADLAdapterCapsX2 AdapterCapabilities = (ADLAdapterCapsX2)Marshal.PtrToStructure(AdapterCapabilitiesBuffer, typeof(ADLAdapterCapsX2));
|
||||||
//AdapterCapabilities = (ADLAdapterCaps)Marshal.PtrToStructure(AdapterCapabilitiesBuffer, AdapterCapabilities.GetType());
|
|
||||||
//AdapterCapabilities = (ADLAdapterCaps)Marshal.PtrToStructure(new IntPtr(AdapterCapabilitiesBuffer.ToInt64() + Marshal.SizeOf(AdapterCapabilities)), AdapterCapabilities.GetType());
|
|
||||||
//AdapterCapabilities = (ADLAdapterCaps)Marshal.PtrToStructure(AdapterCapabilitiesBuffer, AdapterCapabilities.GetType());
|
|
||||||
//Marshal.PtrToStructure<ADLAdapterCaps>(AdapterCapabilitiesBuffer, AdapterCapabilities);
|
|
||||||
//Marshal.PtrToStructure(AdapterCapabilitiesBuffer, AdapterCapabilities.GetType());
|
|
||||||
//Marshal.FreeCoTaskMem(AdapterCapabilitiesBuffer);
|
|
||||||
Console.Write(AdapterCapabilities.AdapterID);
|
Console.Write(AdapterCapabilities.AdapterID);
|
||||||
|
|
||||||
//AdapterCapabilitiesBuffer = Marshal.AllocCoTaskMem(Marshal.SizeOf(AdapterCapabilities)) ;
|
|
||||||
//AdapterCapabilities = (ADLAdapterCaps)Marshal.PtrToStructure(Marshal.SizeOf(AdapterCapabilities), AdapterCapabilities.GetType());
|
|
||||||
|
|
||||||
// Get OS adpater info from ADL
|
|
||||||
//AdapterCapabilitiesData.dw size = Marshal.SizeOf(AdapterCapabilitiesData);
|
|
||||||
//AdapterCapabilities = Marshal.AllocCoTaskMem((int)size);
|
|
||||||
//Marshal.StructureToPtr(AdapterCapabilitiesData, AdapterCapabilities, false);
|
|
||||||
|
|
||||||
//AdapterCapabilitiesData = (ADLAdapterCaps)Marshal.PtrToStructure(AdapterCapabilities, AdapterCapabilitiesData.GetType());
|
|
||||||
|
|
||||||
// Obtain information about displays
|
// Obtain information about displays
|
||||||
ADLDisplayInfo oneDisplayInfo = new ADLDisplayInfo();
|
ADLDisplayInfo oneDisplayInfo = new ADLDisplayInfo();
|
||||||
|
|
||||||
@ -257,15 +229,26 @@ namespace DisplayMagicianShared.AMD
|
|||||||
for (j = 0; j < NumberOfDisplays; j++)
|
for (j = 0; j < NumberOfDisplays; j++)
|
||||||
{
|
{
|
||||||
// Skip non connected displays
|
// Skip non connected displays
|
||||||
//if ()
|
if ((DisplayInfoData[j].DisplayInfoValue & 1) != 1)
|
||||||
|
{
|
||||||
|
SharedLogger.logger.Trace($"ADLWrapper/GenerateProfileDisplayIdentifiers: AMD Adapter #{i} ({OSAdapterInfoData.ADLAdapterInfo[i].AdapterName}) AdapterID display ID#{j} is not connected");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
int InfoValue = DisplayInfoData[j].DisplayInfoValue;
|
// Skip connected but non-mapped displays (not mapped in windows)
|
||||||
string StrConnected = (1 == (InfoValue & 1)) ? "Yes" : "No ";
|
if ((DisplayInfoData[j].DisplayInfoValue & 2) != 2)
|
||||||
string StrMapped = (2 == (InfoValue & 2)) ? "Yes" : "No ";
|
{
|
||||||
int AdpID = DisplayInfoData[j].DisplayID.DisplayLogicalAdapterIndex;
|
SharedLogger.logger.Trace($"ADLWrapper/GenerateProfileDisplayIdentifiers: AMD Adapter #{i} ({OSAdapterInfoData.ADLAdapterInfo[i].AdapterName}) AdapterID display ID#{j} is not connected");
|
||||||
string StrAdpID = (AdpID < 0) ? "--" : AdpID.ToString("d2");
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
Console.WriteLine(DisplayInfoData[j].DisplayID.DisplayLogicalIndex.ToString() + " " +
|
//int InfoValue = DisplayInfoData[j].DisplayInfoValue;
|
||||||
|
//string StrConnected = (1 == (InfoValue & 1)) ? "Yes" : "No ";
|
||||||
|
//string StrMapped = (2 == (InfoValue & 2)) ? "Yes" : "No ";
|
||||||
|
//int AdpID = DisplayInfoData[j].DisplayID.DisplayLogicalAdapterIndex;
|
||||||
|
//string StrAdpID = (AdpID < 0) ? "--" : AdpID.ToString("d2");
|
||||||
|
|
||||||
|
/*Console.WriteLine(DisplayInfoData[j].DisplayID.DisplayLogicalIndex.ToString() + " " +
|
||||||
StrAdpID + " " +
|
StrAdpID + " " +
|
||||||
DisplayInfoData[j].DisplayType.ToString() + " " +
|
DisplayInfoData[j].DisplayType.ToString() + " " +
|
||||||
DisplayInfoData[j].DisplayOutputType.ToString() + " " +
|
DisplayInfoData[j].DisplayOutputType.ToString() + " " +
|
||||||
@ -273,7 +256,20 @@ namespace DisplayMagicianShared.AMD
|
|||||||
StrConnected + " " +
|
StrConnected + " " +
|
||||||
StrMapped + " " +
|
StrMapped + " " +
|
||||||
InfoValue.ToString("x4") + " " +
|
InfoValue.ToString("x4") + " " +
|
||||||
DisplayInfoData[j].DisplayName.ToString());
|
DisplayInfoData[j].DisplayName.ToString());*/
|
||||||
|
|
||||||
|
ADLDisplayConfig DisplayConfig = new ADLDisplayConfig();
|
||||||
|
if (ADL.ADL_Display_DeviceConfig_Get != null)
|
||||||
|
{
|
||||||
|
// Force the display detection and get the Display Info. Use 0 as last parameter to NOT force detection
|
||||||
|
ADLRet = ADL.ADL_Display_DeviceConfig_Get(OSAdapterInfoData.ADLAdapterInfo[i].AdapterIndex, DisplayInfoData[j].DisplayID.DisplayLogicalIndex, out DisplayConfig);
|
||||||
|
if (ADLRet == ADL.ADL_SUCCESS)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Create an array of all the important display info we need to record
|
// Create an array of all the important display info we need to record
|
||||||
List<string> displayInfoIdentifier = new List<string>();
|
List<string> displayInfoIdentifier = new List<string>();
|
||||||
@ -310,11 +306,21 @@ namespace DisplayMagicianShared.AMD
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
displayInfoIdentifier.Add(OSAdapterInfoData.ADLAdapterInfo[i].AdapterIndex.ToString());
|
displayInfoIdentifier.Add(AdapterID.ToString());
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
SharedLogger.logger.Warn(ex, $"ADLWrapper/GenerateProfileDisplayIdentifiers: Exception getting AMD Adapter Index from video card. Substituting with a # instead");
|
SharedLogger.logger.Warn(ex, $"ADLWrapper/GenerateProfileDisplayIdentifiers: Exception getting AMD AdapterID from video card. Substituting with a # instead");
|
||||||
|
displayInfoIdentifier.Add("#");
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
displayInfoIdentifier.Add(AdapterID.ToString());
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
SharedLogger.logger.Warn(ex, $"ADLWrapper/GenerateProfileDisplayIdentifiers: Exception getting AMD AdapterID from video card. Substituting with a # instead");
|
||||||
displayInfoIdentifier.Add("#");
|
displayInfoIdentifier.Add("#");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user