Development/compositor multi client rendering #949
Merged
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.
This PR addresses several critical issues in the Compositor's buffer management and client lifecycle handling:
Key Changes:
Fixed mode-set state management - The
_needsModeSetflag now properly resets after the first commit using atomic operations, preventing repeated mode-setting operations. Added thread-safe atomic operations with proper memory ordering.Request queue implementation - Replaced simple atomic
_currentIdwith a properAtomicFiforequest queue to ensure all requested buffers are rendered in order. This prevents buffer drops when multiple frames are queued rapidly.Frame tracking improvements - Added
isNewFrameparameter toAcquire()/Relinquish()calls to properly track when clients present new content vs re-rendering existing frames. This enables accurate frame statistics and prevents unnecessary rendering operations.ComRPC deadlock fix - Fixed a critical deadlock that occurred when compositor clients crashed. The
Detached()notification is now dispatched asynchronously via the WorkerPool instead of being called synchronously while holding locks, preventing the deadlock between the ComRPC cleanup path and the compositor's admin lock.Client lifecycle improvements - Extended client lifetime during the revoke sequence to prevent use-after-free scenarios. Textures are now cleaned up immediately during revoke before notifying observers.
Thread Safety Enhancements:
This PR requires the corresponding changes in ThunderClientLibraries PR rdkcentral/ThunderClientLibraries#325.