diff --git a/src/Linux/Avalonia.LinuxFramebuffer/LinuxFramebufferPlatform.cs b/src/Linux/Avalonia.LinuxFramebuffer/LinuxFramebufferPlatform.cs index 76e527a39a..f8f6b92b3e 100644 --- a/src/Linux/Avalonia.LinuxFramebuffer/LinuxFramebufferPlatform.cs +++ b/src/Linux/Avalonia.LinuxFramebuffer/LinuxFramebufferPlatform.cs @@ -60,9 +60,13 @@ namespace Avalonia.LinuxFramebuffer var opts = AvaloniaLocator.Current.GetService() ?? new LinuxFramebufferPlatformOptions(); + var timer = opts.ShouldRenderOnUIThread + ? new UiThreadRenderTimer(opts.Fps) + : new DefaultRenderTimer(opts.Fps); + AvaloniaLocator.CurrentMutable .Bind().ToConstant(new ManagedDispatcherImpl(new ManualRawEventGrouperDispatchQueueDispatcherInputProvider(EventGrouperDispatchQueue))) - .Bind().ToConstant(new DefaultRenderTimer(opts.Fps)) + .Bind().ToConstant(timer) .Bind().ToTransient() .Bind().ToConstant(new KeyboardDevice()) .Bind().ToSingleton() diff --git a/src/Linux/Avalonia.LinuxFramebuffer/LinuxFramebufferPlatformOptions.cs b/src/Linux/Avalonia.LinuxFramebuffer/LinuxFramebufferPlatformOptions.cs index bf925bbd75..ec772df57c 100644 --- a/src/Linux/Avalonia.LinuxFramebuffer/LinuxFramebufferPlatformOptions.cs +++ b/src/Linux/Avalonia.LinuxFramebuffer/LinuxFramebufferPlatformOptions.cs @@ -10,5 +10,12 @@ /// Default 60. /// public int Fps { get; set; } = 60; + + /// + /// Render directly on the UI thread instead of using a dedicated render thread. + /// This can be usable if your device don't have multiple cores to begin with. + /// This setting is false by default. + /// + public bool ShouldRenderOnUIThread { get; set; } } }