Browse Source

Added UI thread rendering mode for fbdev (#14818)

pull/14838/head
Nikita Tsukanov 2 years ago
committed by GitHub
parent
commit
036d5463a6
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 6
      src/Linux/Avalonia.LinuxFramebuffer/LinuxFramebufferPlatform.cs
  2. 7
      src/Linux/Avalonia.LinuxFramebuffer/LinuxFramebufferPlatformOptions.cs

6
src/Linux/Avalonia.LinuxFramebuffer/LinuxFramebufferPlatform.cs

@ -60,9 +60,13 @@ namespace Avalonia.LinuxFramebuffer
var opts = AvaloniaLocator.Current.GetService<LinuxFramebufferPlatformOptions>() ?? new LinuxFramebufferPlatformOptions();
var timer = opts.ShouldRenderOnUIThread
? new UiThreadRenderTimer(opts.Fps)
: new DefaultRenderTimer(opts.Fps);
AvaloniaLocator.CurrentMutable
.Bind<IDispatcherImpl>().ToConstant(new ManagedDispatcherImpl(new ManualRawEventGrouperDispatchQueueDispatcherInputProvider(EventGrouperDispatchQueue)))
.Bind<IRenderTimer>().ToConstant(new DefaultRenderTimer(opts.Fps))
.Bind<IRenderTimer>().ToConstant(timer)
.Bind<ICursorFactory>().ToTransient<CursorFactoryStub>()
.Bind<IKeyboardDevice>().ToConstant(new KeyboardDevice())
.Bind<IPlatformIconLoader>().ToSingleton<LinuxFramebufferIconLoaderStub>()

7
src/Linux/Avalonia.LinuxFramebuffer/LinuxFramebufferPlatformOptions.cs

@ -10,5 +10,12 @@
/// Default 60.
/// </summary>
public int Fps { get; set; } = 60;
/// <summary>
/// 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.
/// </summary>
public bool ShouldRenderOnUIThread { get; set; }
}
}

Loading…
Cancel
Save