mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Increased GPU restart delay
This commit is contained in:
@@ -234,15 +234,6 @@ namespace GHelper.Display
|
|||||||
dm.dmDisplayFrequency = frequency;
|
dm.dmDisplayFrequency = frequency;
|
||||||
int iRet = ChangeDisplaySettingsEx(laptopScreen, ref dm, IntPtr.Zero, DisplaySettingsFlags.CDS_UPDATEREGISTRY, IntPtr.Zero);
|
int iRet = ChangeDisplaySettingsEx(laptopScreen, ref dm, IntPtr.Zero, DisplaySettingsFlags.CDS_UPDATEREGISTRY, IntPtr.Zero);
|
||||||
Logger.WriteLine("Screen = " + frequency.ToString() + "Hz : " + (iRet == 0 ? "OK" : iRet));
|
Logger.WriteLine("Screen = " + frequency.ToString() + "Hz : " + (iRet == 0 ? "OK" : iRet));
|
||||||
|
|
||||||
//Fallback scenario
|
|
||||||
if (iRet != 0)
|
|
||||||
{
|
|
||||||
Thread.Sleep(500);
|
|
||||||
iRet = ChangeDisplaySettingsEx(laptopScreen, ref dm, IntPtr.Zero, DisplaySettingsFlags.CDS_UPDATEREGISTRY, IntPtr.Zero);
|
|
||||||
Logger.WriteLine("Screen = " + frequency.ToString() + "Hz : " + (iRet == 0 ? "OK" : iRet));
|
|
||||||
}
|
|
||||||
|
|
||||||
return iRet;
|
return iRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ public class NvidiaGpuControl : IGpuControl
|
|||||||
Logger.WriteLine(ex.Message);
|
Logger.WriteLine(ex.Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
//NVIDIA.RestartDisplayDriver();
|
//GeneralApi.RestartDisplayDriver();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -112,7 +112,8 @@ public class NvidiaGpuControl : IGpuControl
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string script = @"$device = Get-PnpDevice | Where-Object { $_.FriendlyName -imatch 'NVIDIA' -and $_.Class -eq 'Display' }; Disable-PnpDevice $device.InstanceId -Confirm:$false; Start-Sleep -Seconds 3; Enable-PnpDevice $device.InstanceId -Confirm:$false";
|
|
||||||
|
string script = @"$device = Get-PnpDevice | Where-Object { $_.FriendlyName -imatch 'NVIDIA' -and $_.Class -eq 'Display' }; Disable-PnpDevice $device.InstanceId -Confirm:$false; Start-Sleep -Seconds 5; Enable-PnpDevice $device.InstanceId -Confirm:$false";
|
||||||
Logger.WriteLine(script);
|
Logger.WriteLine(script);
|
||||||
ProcessHelper.RunCMD("powershell", script);
|
ProcessHelper.RunCMD("powershell", script);
|
||||||
//Thread.Sleep(2000);
|
//Thread.Sleep(2000);
|
||||||
|
|||||||
Reference in New Issue
Block a user