uno icon indicating copy to clipboard operation
uno copied to clipboard

[Epic] Skia Rendering Backend Support

Open jeromelaban opened this issue 5 years ago • 8 comments

This issue is an epic that tracks opened issues and larger items to improve the Skia backend support, for Linux and other platforms.

  • [ ] Default fonts management https://github.com/unoplatform/uno/issues/6441
  • [x] https://github.com/unoplatform/uno/issues/9813
  • [ ] Layout Grid Snapping (https://github.com/unoplatform/uno/issues/5370)
  • [ ] https://github.com/unoplatform/uno/issues/9417
  • [ ] ^^^ Must Have ^^^
  • [ ] Multiline TextBox
  • [ ] ReadyToRun support for x64, arm64
  • [ ] Automated testing
  • [ ] Compositor Thread
  • [ ] Composition Animations support
  • [ ] Multi-Window support
  • [ ] Acrylic brush support
  • [ ] Single file packaging
  • [ ] Per layer runtime selection (Skia rendering + non-UI per platform)
  • [ ] Touch support for Tizen platform
  • [ ] Lifecycle management for Tizen platform
  • [ ] WebView support https://github.com/unoplatform/uno/issues/4233
  • [ ] ElevatedView support
  • [ ] ScrollViewer Zoom support
  • [ ] Reveal support https://github.com/unoplatform/uno/issues/5724
  • [x] screenshot testing
  • [x] Touch support for GTK platform (https://github.com/unoplatform/uno/issues/4936)
  • [x] Focus Manager
  • [x] GTK backend GL rendering
  • [x] Cursors support https://github.com/unoplatform/uno/issues/5851
  • [x] Focus hints
  • [x] Enhanced ScrollViewer https://github.com/unoplatform/uno/issues/5666
  • [x] SkiaSharp.Views support https://github.com/unoplatform/uno/issues/4713 and https://github.com/mono/SkiaSharp/pull/1634
  • [x] TextBox support (https://github.com/unoplatform/uno/issues/4319)
  • [x] Keyboard events support (https://github.com/unoplatform/uno/issues/4318)
  • [x] Improved TextBlock support (https://github.com/unoplatform/uno/issues/7204)
  • [x] Canvas.ZIndex https://github.com/unoplatform/uno/issues/5644
  • [x] DPI Scaling support

jeromelaban avatar Oct 19 '20 17:10 jeromelaban

@jeromelaban, and maybe also @mattleibow, could you help me with some questions?

I think SkiaSharp runs with OpenGL/GPU graphics acceleration, so my question: today the render that we have in Gtk uses OpenGL/GPU? I did not find anything that could affirm this, in some tests I had a certain increase in the use of the GPU (maybe this increase is just from the Gtk shell), but when using in some Linux embedded systems with lower CPU power the performance is much worse, seems that everything is being done in CPU. Looking at the code I didn't find anything creating the openGL context.

And the second question, if we are not using openGL/GPU in SkiaSharp for Gtk what would be the effort to implement this? (it would be easy, difficult, we already have something to base on ....)

microhobby avatar Jan 07 '21 02:01 microhobby

@microhobby at this point, the Uno implementation for the Skia backend uses a derivative of the SkiaSharp.Views GTK View which is using software rendering. There's no official OpenGL implementation of the GTK rendering, so we do no know the kind of effort would be needed to enable this. @mattleibow may know more.

In all cases, we have that on the backlog and we'll investigate it as part of the Linux support effort.

jeromelaban avatar Jan 07 '21 13:01 jeromelaban

At this point, there was not much demand for GTK views so I just threw in this commented code. https://github.com/mono/SkiaSharp/blob/main/source/SkiaSharp.Views.Forms/SkiaSharp.Views.Forms.GTK/SKGLWidget.cs

It theoretically should be quite easy to use if we use the GLWidget from OpenTK. Not exactly sure the issue that I had... Might have been just the fact that there was a few assembly conflicts because Forms used to bundle its own copy in the nuget. But I think that changed.

Until I can get to it, someone could have a stab at this.

That code was also GTK 2 so may need adjusting. I also see that GLWidget seems to no longer be the thing: https://github.com/opentk/opentk/blob/3.x/src/OpenTK.GLWidget/GLWidget.cs Not sure if this is superseded by something better or they stopped supporting it. But, either way, this should not stop us from creating our own views. Most GL views now already have entirely custom setup for the GL context.

GitHub
SkiaSharp is a cross-platform 2D graphics API for .NET platforms based on Google's Skia Graphics Library. It provides a comprehensive 2D API that can be used across mobile, server and desktop m...
GitHub
The Open Toolkit library is a fast, low-level C# wrapper for OpenGL, OpenAL & OpenCL. It also includes windowing, mouse, keyboard and joystick input and a robust and fast math library, giving y...

mattleibow avatar Mar 13 '21 04:03 mattleibow

The issue needs adjusting Keyboard events support (#4318) is already done.

mterwoord avatar Apr 30 '21 08:04 mterwoord

I'm curious about WASM. Is it in the scope of this epic? Is there a hope it will improve performance in browsers?

Leon99 avatar Jun 02 '21 09:06 Leon99

@Leon99 we have in the backlog to work on adding a skia rendering backend for Wasm, though while it may improve the performance, it may also reduce compatibility for some features like accessibility, IME support or third party javascript integrations.

It will likely be a compromise. That being said, w.r.t performance, you can already take a look at Uno 3.8-dev bits, there are some pretty significant advances there.

jeromelaban avatar Jun 02 '21 11:06 jeromelaban

Is the native view hosting doable in skia rendering, eg for WebView? What is the method to do it, rendering infront of skia canvas?

georgiuk avatar Nov 21 '21 16:11 georgiuk

@georgiuk overlays and compositing are two techniques we're investigating, but we're not there yet. Both techniques have their advantages and drawbacks (overlay makes compositing impossible, and threaded rendering jittery, while compositing can make pointers support somewhat difficult).

jeromelaban avatar Nov 23 '21 17:11 jeromelaban

Multi-Touch support for Skia WPF does not appear to have been added.

lindexi avatar Sep 22 '23 03:09 lindexi

do we still need the gtk runtime to be installed separately with skia rendering backend?

ivanjx avatar Nov 18 '23 04:11 ivanjx

@ivanjx for now, this is still needed. We've made recent changes to make this dependency visible when the app is started.

Do you have a scenario where this is causing issues?

jeromelaban avatar Nov 20 '23 03:11 jeromelaban

@jeromelaban i mean if the backend will be on skia why not just remove the gtk completely like in avalonia? the issue with gtksharp is that we need to install it separately rather than just including dlls like skiasharp.

ivanjx avatar Nov 27 '23 04:11 ivanjx