Use global mutex to ensure driver access are sequential

This commit is contained in:
Kamil Trzciński 2022-11-20 21:17:21 +01:00
parent a1a438c3f8
commit f7e3e70c2b
6 changed files with 148 additions and 74 deletions

View file

@ -51,21 +51,25 @@ namespace PowerControl.Helpers.GPU
return true;
}
public VangoghGPU? Open()
public VangoghGPU? Open(bool validateSMU = true)
{
var gpu = VangoghGPU.OpenMMIO(MMIOAddress, MMIOSize);
if (gpu == null)
return null;
// Check supported SMU version
var smuVersion = gpu.SMUVersion;
if (smuVersion != SMUVersion)
if (validateSMU)
{
Log("SMU: {0:X8} => not supported", smuVersion);
return null;
// Check supported SMU version
var smuVersion = gpu.SMUVersion;
if (smuVersion != SMUVersion)
{
Log("SMU: {0:X8} => not supported", smuVersion);
return null;
}
Log("SMU: {0:X8} => detected", smuVersion);
}
Log("SMU: {0:X8} => detected", smuVersion);
return gpu;
}
};
@ -85,7 +89,7 @@ namespace PowerControl.Helpers.GPU
public static VangoghGPU? Open()
{
return DetectedDevice?.Open();
return DetectedDevice?.Open(false);
}
public static bool Detect()