Changed ATI GPU enumeration.
authormoel.mich
Wed, 27 Jan 2010 19:30:10 +0000
changeset 31a0928afac6b
parent 2 105939e4eb7e
child 4 5d81d4a63965
Changed ATI GPU enumeration.
GUI/AboutBox.resources
GUI/LicenseBox.resources
GUI/MainForm.resources
GUI/PlotPanel.resources
Hardware/ATI/ADL.cs
Hardware/ATI/ATIGPU.cs
Hardware/ATI/ATIGroup.cs
     1.1 Binary file GUI/AboutBox.resources has changed
     2.1 Binary file GUI/LicenseBox.resources has changed
     3.1 Binary file GUI/MainForm.resources has changed
     4.1 Binary file GUI/PlotPanel.resources has changed
     5.1 --- a/Hardware/ATI/ADL.cs	Wed Jan 27 18:12:51 2010 +0000
     5.2 +++ b/Hardware/ATI/ADL.cs	Wed Jan 27 19:30:10 2010 +0000
     5.3 @@ -48,7 +48,7 @@
     5.4      [MarshalAs(UnmanagedType.ByValTStr, SizeConst = ADL.ADL_MAX_PATH)]
     5.5      public string UDID;
     5.6      public int BusNumber;
     5.7 -    public int DriverNumber;
     5.8 +    public int DeviceNumber;
     5.9      public int FunctionNumber;
    5.10      public int VendorID;
    5.11      [MarshalAs(UnmanagedType.ByValTStr, SizeConst = ADL.ADL_MAX_PATH)]
    5.12 @@ -124,6 +124,9 @@
    5.13      public const int ADL_DL_FANCTRL_SUPPORTS_RPM_READ = 4;
    5.14      public const int ADL_DL_FANCTRL_SUPPORTS_RPM_WRITE = 8;
    5.15  
    5.16 +    public const int ATI_VENDOR_ID1 = 1002;
    5.17 +    public const int ATI_VENDOR_ID2 = 0x1002;
    5.18 +
    5.19      private delegate int ADL_Main_Control_CreateDelegate(
    5.20        ADL_Main_Memory_AllocDelegate callback, int enumConnectedAdapters);
    5.21      private delegate int ADL_Adapter_AdapterInfo_GetDelegate(IntPtr info,
     6.1 --- a/Hardware/ATI/ATIGPU.cs	Wed Jan 27 18:12:51 2010 +0000
     6.2 +++ b/Hardware/ATI/ATIGPU.cs	Wed Jan 27 19:30:10 2010 +0000
     6.3 @@ -46,16 +46,22 @@
     6.4      private string name;
     6.5      private Image icon;
     6.6      private int adapterIndex;
     6.7 +    private int busNumber;
     6.8 +    private int deviceNumber;
     6.9      private Sensor temperature;
    6.10      private Sensor fan;
    6.11      private Sensor coreClock;
    6.12      private Sensor memoryClock;
    6.13      private Sensor coreVoltage;
    6.14  
    6.15 -    public ATIGPU(string name, int adapterIndex) {
    6.16 +    public ATIGPU(string name, int adapterIndex, int busNumber, 
    6.17 +      int deviceNumber) 
    6.18 +    {
    6.19        this.name = name;
    6.20        this.icon = Utilities.EmbeddedResources.GetImage("ati.png");
    6.21        this.adapterIndex = adapterIndex;
    6.22 +      this.busNumber = busNumber;
    6.23 +      this.deviceNumber = deviceNumber;
    6.24  
    6.25        ADLFanSpeedInfo speedInfo = new ADLFanSpeedInfo();
    6.26        ADL.ADL_Overdrive5_FanSpeedInfo_Get(adapterIndex, 0, ref speedInfo);
    6.27 @@ -69,6 +75,10 @@
    6.28        Update();                   
    6.29      }
    6.30  
    6.31 +    public int BusNumber { get { return busNumber; } }
    6.32 +
    6.33 +    public int DeviceNumber { get { return deviceNumber; } }
    6.34 +
    6.35      public string Name {
    6.36        get { return name; }
    6.37      }
     7.1 --- a/Hardware/ATI/ATIGroup.cs	Wed Jan 27 18:12:51 2010 +0000
     7.2 +++ b/Hardware/ATI/ATIGroup.cs	Wed Jan 27 19:30:10 2010 +0000
     7.3 @@ -73,6 +73,16 @@
     7.4                  report.AppendLine(adapterInfo[i].AdapterName);     
     7.5                  report.Append("UDID: ");
     7.6                  report.AppendLine(adapterInfo[i].UDID);
     7.7 +                report.Append("Present: ");
     7.8 +                report.AppendLine(adapterInfo[i].Present.ToString());
     7.9 +                report.Append("VendorID: ");
    7.10 +                report.AppendLine(adapterInfo[i].VendorID.ToString());
    7.11 +                report.Append("BusNumber: ");
    7.12 +                report.AppendLine(adapterInfo[i].BusNumber.ToString());
    7.13 +                report.Append("DeviceNumber: ");
    7.14 +                report.AppendLine(adapterInfo[i].DeviceNumber.ToString());
    7.15 +                report.Append("FunctionNumber: ");
    7.16 +                report.AppendLine(adapterInfo[i].FunctionNumber.ToString());
    7.17                  report.AppendLine();
    7.18  
    7.19                  if (isActive == 1) {
    7.20 @@ -80,10 +90,25 @@
    7.21                    ADL.ADL_Adapter_ID_Get(adapterInfo[i].AdapterIndex,
    7.22                      out adapterID);
    7.23  
    7.24 -                  if (adapterID > 0 && adapterInfo[i].UDID != "") {
    7.25 -                    hardware.Add(new ATIGPU(
    7.26 -                      adapterInfo[i].AdapterName,
    7.27 -                      adapterInfo[i].AdapterIndex));
    7.28 +                  if (adapterID > 0 && 
    7.29 +                    adapterInfo[i].UDID != "" && 
    7.30 +                    adapterInfo[i].Present > 0 &&
    7.31 +                    (adapterInfo[i].VendorID == ADL.ATI_VENDOR_ID1 ||
    7.32 +                     adapterInfo[i].VendorID == ADL.ATI_VENDOR_ID2)) 
    7.33 +                  {
    7.34 +                    bool found = false;
    7.35 +                    foreach (ATIGPU gpu in hardware)
    7.36 +                      if (gpu.BusNumber == adapterInfo[i].BusNumber &&
    7.37 +                        gpu.DeviceNumber == adapterInfo[i].DeviceNumber) {
    7.38 +                        found = true;
    7.39 +                        break;
    7.40 +                      }
    7.41 +                    if (!found)
    7.42 +                      hardware.Add(new ATIGPU(
    7.43 +                        adapterInfo[i].AdapterName,
    7.44 +                        adapterInfo[i].AdapterIndex,
    7.45 +                        adapterInfo[i].BusNumber, 
    7.46 +                        adapterInfo[i].DeviceNumber));
    7.47                    }
    7.48                  }
    7.49                }