-
Notifications
You must be signed in to change notification settings - Fork 276
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix race condition when rendering the UI (#774)
* Fix race condition when rendering the UI This fix depends on a fix in ign-rendering module, because it depends on the new Camera::SwapFromThread function Without it, compilation will fail Affects gazebosim/gz-rendering#304 Signed-off-by: Matias N. Goldberg <[email protected]> * Force serialization of render commands This avoids us to break ign-rendering ABI while also simplifying the amount of work to be done Serializing work is easier to maintain and debug Only CPU-bound scenario would potentially benefit from parallel command generation (in terms of UI responsiveness) Parallel command generation can be added back later Also fixed coding style Refer to gazebosim/gz-rendering#304 (comment) for discussion Affects ign-rendering#304 Signed-off-by: Matias N. Goldberg <[email protected]> * Fix deadlock on initialization & shutdown Also fixes preexisting race condition when shutting down and improper uninitialization of the worker thread Signed-off-by: Matias N. Goldberg <[email protected]> * Fix deadlock when using MoveTo modifier Fix coding style Signed-off-by: Matias N. Goldberg <[email protected]> * Reimplemented synchronization mechanism to fix deadlocks It's a good thing we went for serializing rendering. THe way Qt implements the double buffer scheme using signals & slots is fundamentally flawed because it assumes the worker thread never needs to synchronize (e.g. to invalidate FBOs if window resolution changes). Trying to synchronize can easily cause deadlocks if Qt thread has spurious updates which don't end up emitting TextureInUse, as the worker thread is running slower than Qt thread. A way to fix this could be to use a different synchronization mechanism where the main thread increases a request counter and the worker thread is constantly looping but only wakes up when that counter is > 0. For now, this will do. Signed-off-by: Matias N. Goldberg <[email protected]> * Document RenderSync Turn some pointers into references Signed-off-by: Matias N. Goldberg <[email protected]> * Document missing parameter Signed-off-by: Matias N. Goldberg <[email protected]> * Document better our use of emit TextureInUse Signed-off-by: Matias N. Goldberg <[email protected]> * Change Q_SLOTS to slots for consistency I changed it because it didn't work, but it must've been old code because it works now. Signed-off-by: Matias N. Goldberg <[email protected]> Co-authored-by: Ian Chen <[email protected]>
- Loading branch information
1 parent
fb973bd
commit 80379fb
Showing
2 changed files
with
241 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.