Skip to content

Commit d0396e6

Browse files
committed
settings: default SW rendering on Windows+ARM
Default to software GUI rendering on Windows on ARM. Users can explicitly set the config to re-enable HW accelerated rendering if they wish.
1 parent 46810df commit d0396e6

File tree

4 files changed

+30
-1
lines changed

4 files changed

+30
-1
lines changed

docs/configuration.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,10 @@ git config --global credential.guiSoftwareRendering true
247247

248248
Defaults to false (use hardware acceleration where available).
249249

250+
> [!NOTE]
251+
> Windows on ARM devices default to using software rendering to workaround a
252+
> known Avalonia issue: <https://github.com/AvaloniaUI/Avalonia/issues/10405>
253+
250254
**Also see: [GCM_GUI_SOFTWARE_RENDERING][gcm-gui-software-rendering]**
251255

252256
---

docs/environment.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,10 @@ export GCM_GUI_SOFTWARE_RENDERING=1
294294

295295
Defaults to false (use hardware acceleration where available).
296296

297+
> [!NOTE]
298+
> Windows on ARM devices default to using software rendering to workaround a
299+
> known Avalonia issue: <https://github.com/AvaloniaUI/Avalonia/issues/10405>
300+
297301
**Also see: [credential.guiSoftwareRendering][credential-guisoftwarerendering]**
298302

299303
---

src/shared/Core/PlatformUtils.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,22 @@ public static bool IsDevBox()
5353
#endif
5454
}
5555

56+
/// <summary>
57+
/// Returns true if the current process is running on an ARM processor.
58+
/// </summary>
59+
/// <returns>True if ARM(v6,hf) or ARM64, false otherwise</returns>
60+
public static bool IsArm()
61+
{
62+
switch (RuntimeInformation.OSArchitecture)
63+
{
64+
case Architecture.Arm:
65+
case Architecture.Arm64:
66+
return true;
67+
default:
68+
return false;
69+
}
70+
}
71+
5672
public static bool IsWindowsBrokerSupported()
5773
{
5874
if (!IsWindows())

src/shared/Core/Settings.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,10 +568,15 @@ public bool UseSoftwareRendering
568568
{
569569
get
570570
{
571+
// WORKAROUND: Some Windows ARM devices have a graphics driver issue that causes transparent windows
572+
// when using hardware rendering. Until this is fixed, we will default to software rendering on these
573+
// devices. Users can always override this setting back to HW-accelerated rendering if they wish.
574+
bool defaultValue = PlatformUtils.IsWindows() && PlatformUtils.IsArm();
575+
571576
return TryGetSetting(KnownEnvars.GcmGuiSoftwareRendering,
572577
KnownGitCfg.Credential.SectionName,
573578
KnownGitCfg.Credential.GuiSoftwareRendering,
574-
out string str) && str.ToBooleanyOrDefault(false);
579+
out string str) && str.ToBooleanyOrDefault(defaultValue);
575580
}
576581
}
577582

0 commit comments

Comments
 (0)