Skip to content

Commit

Permalink
settings: default SW rendering on Windows+ARM
Browse files Browse the repository at this point in the history
Default to software GUI rendering on Windows on ARM.
Users can explicitly set the config to re-enable HW accelerated
rendering if they wish.
  • Loading branch information
mjcheetham committed Oct 23, 2023
1 parent 46810df commit b425b13
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 1 deletion.
4 changes: 4 additions & 0 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,10 @@ git config --global credential.guiSoftwareRendering true

Defaults to false (use hardware acceleration where available).

> [!NOTE]
> On ARM64 Windows the default is true (use software rendering) to workaround a
> known Avalonia issue: <https://github.com/AvaloniaUI/Avalonia/issues/10405>
**Also see: [GCM_GUI_SOFTWARE_RENDERING][gcm-gui-software-rendering]**

---
Expand Down
4 changes: 4 additions & 0 deletions docs/environment.md
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,10 @@ export GCM_GUI_SOFTWARE_RENDERING=1

Defaults to false (use hardware acceleration where available).

> [!NOTE]
> On ARM64 Windows the default is true (use software rendering) to workaround a
> known Avalonia issue: <https://github.com/AvaloniaUI/Avalonia/issues/10405>
**Also see: [credential.guiSoftwareRendering][credential-guisoftwarerendering]**

---
Expand Down
16 changes: 16 additions & 0 deletions src/shared/Core/PlatformUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,22 @@ public static bool IsDevBox()
#endif
}

/// <summary>
/// Returns true if the current process is running on an ARM processor.
/// </summary>
/// <returns>True if ARM(v6,hf) or ARM64, false otherwise</returns>
public static bool IsArm()
{
switch (RuntimeInformation.OSArchitecture)
{
case Architecture.Arm:
case Architecture.Arm64:
return true;
default:
return false;
}
}

public static bool IsWindowsBrokerSupported()
{
if (!IsWindows())
Expand Down
7 changes: 6 additions & 1 deletion src/shared/Core/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -568,10 +568,15 @@ public bool UseSoftwareRendering
{
get
{
// WORKAROUND: Some Windows ARM devices have a graphics driver issue that causes transparent windows
// when using hardware rendering. Until this is fixed, we will default to software rendering on these
// devices. Users can always override this setting back to HW-accelerated rendering if they wish.
bool defaultValue = PlatformUtils.IsWindows() && PlatformUtils.IsArm();

return TryGetSetting(KnownEnvars.GcmGuiSoftwareRendering,
KnownGitCfg.Credential.SectionName,
KnownGitCfg.Credential.GuiSoftwareRendering,
out string str) && str.ToBooleanyOrDefault(false);
out string str) && str.ToBooleanyOrDefault(defaultValue);
}
}

Expand Down

0 comments on commit b425b13

Please sign in to comment.