Skip to content

Conversation

@bramoosterhuis
Copy link
Contributor

@bramoosterhuis bramoosterhuis commented Jan 5, 2026

This PR addresses several critical issues in the Compositor's buffer management and client lifecycle handling:

Key Changes:

  1. Fixed mode-set state management - The _needsModeSet flag now properly resets after the first commit using atomic operations, preventing repeated mode-setting operations. Added thread-safe atomic operations with proper memory ordering.

  2. Request queue implementation - Replaced simple atomic _currentId with a proper AtomicFifo request queue to ensure all requested buffers are rendered in order. This prevents buffer drops when multiple frames are queued rapidly.

  3. Frame tracking improvements - Added isNewFrame parameter to Acquire()/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.

  4. 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.

  5. 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:

  • Proper atomic operations with explicit memory ordering
  • Eliminated race conditions in buffer state management
  • Safe handling of concurrent client detachment scenarios

This PR requires the corresponding changes in ThunderClientLibraries PR rdkcentral/ThunderClientLibraries#325.


@bramoosterhuis bramoosterhuis merged commit 691eea9 into master Jan 6, 2026
47 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Jan 6, 2026
@bramoosterhuis bramoosterhuis deleted the development/compositor-multi-client-rendering branch January 7, 2026 09:01
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants