| 69 | } |
| 70 | |
| 71 | EXPORT_C_FUNC XResult HwQueueLaunch(HwQueueHandle hwq, HwCommandHandle hw_cmd) |
| 72 | { |
| 73 | std::shared_ptr<HwQueue> hwq_shptr = HwQueueManager::Get(hwq); |
| 74 | if (hwq_shptr == nullptr) { |
| 75 | XWARN("HwQueue with handle 0x" FMT_64X " does not exist", hwq); |
| 76 | return kXSchedErrorNotFound; |
| 77 | } |
| 78 | // Get and DELETE the HwCommand from the HwCommandManager. |
| 79 | std::shared_ptr<HwCommand> hw_cmd_shptr = HwCommandManager::Del(hw_cmd); |
| 80 | if (hw_cmd_shptr == nullptr) { |
| 81 | XWARN("HwCommand with handle 0x" FMT_64X " does not exist or not registered", hw_cmd); |
| 82 | return kXSchedErrorNotFound; |
| 83 | } |
| 84 | |
| 85 | auto callback = std::dynamic_pointer_cast<HwCallbackCommand>(hw_cmd_shptr); |
| 86 | if (callback != nullptr) return callback->Launch(hwq); |
| 87 | |
| 88 | hwq_shptr->Launch(hw_cmd_shptr); |
| 89 | return kXSchedSuccess; |
| 90 | } |
| 91 | |
| 92 | EXPORT_C_FUNC XResult HwQueueSynchronize(HwQueueHandle hwq) |
| 93 | { |