| 89 | } |
| 90 | |
| 91 | void AsyncXQueue::Suspend(int64_t flags) |
| 92 | { |
| 93 | // If the XQueue is already terminated, it should not be suspended. |
| 94 | if (terminated_.load()) return; |
| 95 | |
| 96 | // Will not suspend if it is already suspended. |
| 97 | bool expected = false; |
| 98 | if (!suspended_.compare_exchange_strong(expected, true)) return; |
| 99 | |
| 100 | if (flags & kQueueSuspendFlagWaitIdle) { |
| 101 | // Wait for all HwCommands to be completed, |
| 102 | // and the XQueue becomes idle before suspending. |
| 103 | cmd_buf_->WaitForNextIdle(); |
| 104 | } else if (flags & kQueueSuspendFlagWaitAll) { |
| 105 | // Wait for all HwCommands to be completed before suspending. |
| 106 | this->WaitAll(); |
| 107 | } |
| 108 | |
| 109 | launch_worker_->Pause(); |
| 110 | if (level_ >= kPreemptLevelDeactivate) kHwQueue->Deactivate(); |
| 111 | if (level_ >= kPreemptLevelInterrupt) kHwQueue->Interrupt(); |
| 112 | if (flags & kQueueSuspendFlagSyncHwQueue) kHwQueue->Synchronize(); |
| 113 | } |
| 114 | |
| 115 | void AsyncXQueue::Resume(int64_t flags) |
| 116 | { |
no test coverage detected