software cursor on hardware rendering
Johan Vos
johan.vos at gluonhq.com
Wed Mar 24 08:15:43 UTC 2021
Hi,
I'm currently adding a software-cursor on top of hardware rendering (in
case no hardware or OS-provided cursor is available).
On all desktop platforms (and on Monocle with X11), we use the cursor
provided by the window manager. In case there is no window manager, Monocle
can use a software cursor in case we use the SW rendering pipeline.
But there are cases where hw-rendering is available, but no hw-cursor is
available. Instead of giving up all the hw-rendering, I want to add a
sw-cursor on top of the EGL/OpenGLES-based rendering. There are a number of
hooks that I can use:
1. do it entirely in the native layer. This will not be the fastest
approach, as we need to somehow decompose the EGL surface and add a texture
to it, but it should work. But it requires a fair amount of native code
that is driver-dependent and hard to maintain.
2. intercept the ViewPainter.paintImpl call, and add a Cursor similar to
how e.g. rectangles around dirtyRegions are rendered
3. invoke setOverlayRoot in ViewPainter, although that method seems to be
created solely for displaying a warning when going full screen
4. do it similar to how the SW cursor is rendered in Monocle:
PaintCollector will *after* all rendering is done invoke
`Application.GetApplication().notifyRenderingFinished();` and the Monocle
implementation will invoke MonocleScreen.swapBuffers() which will upload
the pixels for the cursor to the framebuffer. I'm not sure that is the best
approach, as it splits the rendering in 2 different chunks, and it doesn't
easily translate to the hw rendering case (where we simply call swapBuffers
on the GL Context).
Are there any thoughts/opinions about this?
- Johan
More information about the openjfx-dev
mailing list