FlightGear and OpenGL Core Profile: Difference between revisions

Jump to navigation Jump to search
m
→‎Canvas.Path (OpenVG): https://forum.flightgear.org/viewtopic.php?f=71&t=39535&hilit=path+osg+canvas&start=45#p390533
m (→‎Canvas.Path (OpenVG): https://forum.flightgear.org/viewtopic.php?f=71&t=39535&hilit=path+osg+canvas&start=45#p390533)
Line 297: Line 297:


Shiva itself cannot be considered thread-safe, but may be invoked from multiple threads in fgfs, once fgfs is being used in conjunction with compositeviewer:
Shiva itself cannot be considered thread-safe, but may be invoked from multiple threads in fgfs, once fgfs is being used in conjunction with compositeviewer:
So, what the OP in 08/2021 was probably seeing is this:
# setting up multiple windows (using CV or not, probably irrelevant, since both options share the same CameraGroup back-end)
# using OSG multi-threading (i.e. no Singlethreaded)
# OSG will implicitly try to run some stuff asynchronously using worker threads
# this is why shiva gets called from multiple OSG threads, despite shiva itself not being thread-safe
This is neither specific to the Canvas ND, nor to the CompositeViewer mode.
As far as I can tell right now, it's due to ShivaVG - which some core devs have been wanting to replace/update for years anyway, see for example James' comments on "Skia": [[Canvas_news#Skia_talks]].
it does make sense that the OP can trigger this issue reliably, because he happens to be creating 3 different windows (=threads) - whereas I have been testing with a single additional window, which is why the issue probably takes time to show up. With multiple concurrent threads, the shiva code may get called from different threads, so that it will probably segfault rather "reliably".
In the meantime, there is no "fix" per se - the workaround is to use single-threaded mode when using canvas/shiva related features.
Alternatively, we could look at reworking the CanvasPath drawable implementation so that it's using explicit synchronization, to ensure it never gets called from multiple OSG threads.<ref>https://forum.flightgear.org/viewtopic.php?f=71&t=39535&hilit=path+osg+canvas&start=45#p390533</ref>


So far however everything points at canvas, and looking at canvas code, it seems that there's a lot of stuff going on in update and
So far however everything points at canvas, and looking at canvas code, it seems that there's a lot of stuff going on in update and

Navigation menu