Repository navigation
libobs: Compute a scene item's transform under the parent's video lock (#2115) - #2126
Merged
Merged
Conversation
#2115) Setters such as obs_sceneitem_set_pos update the transform on the caller thread while the graphics thread reads it under the scene's video lock. Split update_item_transform: read the source size first, compute under video_lock(item->parent) (recursive, already held on the render path), then send item_transform after unlocking so its handlers can't invert the graphics -> video lock order. Fixes #2115
Member
Author
|
GREEN: TSan run 40085244173 on this branch has 0 update_item_transform ↔ source_size_changed reports, against 46 in master run 40074741825. |
6 of 7 tasks
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2115 (decided on the issue: the split version of option 1).
update_item_transformis split in two:compute_item_transform: the arithmetic, unchanged.video_lock(item->parent), then sendsitem_transformafter unlocking.Why this order:
video_mutexis recursive. The render path (update_transforms_and_prune_sources,resize_group,resize_scene_base) already holds it, so nothing changes there; that includes its signal, which is still sent under the caller's lock as before.do_update_transform,scene_load_item, group apply and remove,obs_sceneitem_force_update_transform) now compute under the lock.get_widthandget_heightrun before locking because they can reach plugin code. The scene and canvas dimension reads are plain.RED: TSan run 40074741825 on master has 46 reports of update_item_transform (obs-scene.c.h:420/421) against source_size_changed (:504). Only TSan shows the race, so there's no Tier 2 RED. GREEN is the TSan run dispatched on this branch, and I'll post its counts.
./lintpasses; Tier 2 in PR CI checks transforms are unchanged.