sync_manager.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. // SPDX-FileCopyrightText: Ryujinx Team and Contributors
  2. // SPDX-License-Identifier: MIT
  3. #pragma once
  4. #include <mutex>
  5. #include <vector>
  6. #include "common/common_types.h"
  7. namespace Tegra {
  8. namespace Host1x {
  9. class Host1x;
  10. struct SyncptIncr {
  11. u32 id;
  12. u32 class_id;
  13. u32 syncpt_id;
  14. bool complete;
  15. SyncptIncr(u32 id_, u32 class_id_, u32 syncpt_id_, bool done = false)
  16. : id(id_), class_id(class_id_), syncpt_id(syncpt_id_), complete(done) {}
  17. };
  18. class SyncptIncrManager {
  19. public:
  20. explicit SyncptIncrManager(Host1x& host1x);
  21. ~SyncptIncrManager();
  22. /// Add syncpoint id and increment all
  23. void Increment(u32 id);
  24. /// Returns a handle to increment later
  25. u32 IncrementWhenDone(u32 class_id, u32 id);
  26. /// IncrememntAllDone, including handle
  27. void SignalDone(u32 handle);
  28. /// Increment all sequential pending increments that are already done.
  29. void IncrementAllDone();
  30. private:
  31. std::vector<SyncptIncr> increments;
  32. std::mutex increment_lock;
  33. u32 current_id{};
  34. Host1x& host1x;
  35. };
  36. } // namespace Host1x
  37. } // namespace Tegra