Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow manual disabling of all functions related to the GPU #3360

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/AnimeMatrix/AniMatrixControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public AniMatrixControl(SettingsForm settingsForm)
{
settings = settingsForm;
if (!AppConfig.IsSlash() && !AppConfig.IsAnimeMatrix()) return;

try
{
if (AppConfig.IsSlash())
Expand Down
5 changes: 5 additions & 0 deletions app/AppConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@
return Get(zone + "_bat", Get(zone)) != 0;
}

public static string GetString(string name, string empty = null)

Check warning on line 215 in app/AppConfig.cs

View workflow job for this annotation

GitHub Actions / build

Cannot convert null literal to non-nullable reference type.
{
if (config.ContainsKey(name))
return config[name].ToString();
Expand Down Expand Up @@ -517,6 +517,11 @@
return ContainsModel("GA503") || ContainsModel("G533Q") || ContainsModel("GU502") || ContainsModel("GU603") || IsSlash();
}

public static bool NoGpu()
{
return Is("no_gpu");
}

public static bool IsStrixNumpad()
{
return ContainsModel("G713R");
Expand Down
2 changes: 1 addition & 1 deletion app/Gpu/AMD/AmdGpuControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public class AmdGpuControl : IGpuControl

public AmdGpuControl()
{
if (!Adl2.Load())
if (!Adl2.Load() || AppConfig.NoGpu())
return;

try
Expand Down
2 changes: 1 addition & 1 deletion app/Gpu/GPUModeControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public void InitGPUMode()
// GPU mode not supported
if (eco < 0 && mux < 0)
{
if (gpuExists is null) gpuExists = Program.acpi.GetFan(AsusFan.GPU) >= 0;
if (gpuExists is null) gpuExists = (!AppConfig.NoGpu()) && Program.acpi.GetFan(AsusFan.GPU) >= 0;
settings.HideGPUModes((bool)gpuExists);
}
}
Expand Down
37 changes: 20 additions & 17 deletions app/HardwareControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -289,26 +289,29 @@ public static void RecreateGpuControl()
{
GpuControl?.Dispose();

IGpuControl _gpuControl = new NvidiaGpuControl();

if (_gpuControl.IsValid)
if (!AppConfig.NoGpu())
{
GpuControl = _gpuControl;
Logger.WriteLine(GpuControl.FullName);
return;
}
IGpuControl _gpuControl = new NvidiaGpuControl();

_gpuControl.Dispose();
if (_gpuControl.IsValid)
{
GpuControl = _gpuControl;
Logger.WriteLine(GpuControl.FullName);
return;
}

_gpuControl = new AmdGpuControl();
if (_gpuControl.IsValid)
{
GpuControl = _gpuControl;
if (GpuControl.FullName.Contains("6850M")) AppConfig.Set("xgm_special", 1);
Logger.WriteLine(GpuControl.FullName);
return;
}
_gpuControl.Dispose();
_gpuControl.Dispose();

_gpuControl = new AmdGpuControl();
if (_gpuControl.IsValid)
{
GpuControl = _gpuControl;
if (GpuControl.FullName.Contains("6850M")) AppConfig.Set("xgm_special", 1);
Logger.WriteLine(GpuControl.FullName);
return;
}
_gpuControl.Dispose();
}

Logger.WriteLine("dGPU not found");
GpuControl = null;
Expand Down
5 changes: 2 additions & 3 deletions app/Peripherals/Mouse/AsusMouse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -481,9 +481,8 @@ public bool IsDeviceConnected()
{
try
{
HidSharp.DeviceList.Local.GetHidDevices(VendorID(), ProductID())
.First(x => x.DevicePath.Contains(path));
return true;
return HidSharp.DeviceList.Local.GetHidDevices(VendorID(), ProductID())
.FirstOrDefault(x => x.DevicePath.Contains(path)) != null;
}
catch
{
Expand Down
Loading