int32_t cmdqRecFlushAsyncCallback(cmdqRecHandle handle, CmdqAsyncFlushCB callback, uint32_t userData) { int32_t status = 0; cmdqCommandStruct desc = { 0 }; TaskStruct *pTask = NULL; status = cmdq_rec_finalize_command(handle, false); if (status < 0) { return status; } desc.scenario = handle->scenario; desc.priority = handle->priority; desc.engineFlag = handle->engineFlag; desc.pVABase = (cmdqU32Ptr_t)(unsigned long)handle->pBuffer; desc.blockSize = handle->blockSize; desc.regRequest.count = 0; desc.regRequest.regAddresses = (cmdqU32Ptr_t)(unsigned long)NULL; desc.regValue.count = 0; desc.regValue.regValues = (cmdqU32Ptr_t)(unsigned long)NULL; /* secure path */ cmdq_rec_setup_sec_data_of_command_desc_by_rec_handle(&desc, handle); /* profile marker */ cmdq_rec_setup_profile_marker_data(&desc, handle); status = cmdqCoreSubmitTaskAsync(&desc, NULL, 0, &pTask); /* insert the callback here. */ /* note that, the task may be already completed at this point. */ if (pTask) { pTask->flushCallback = callback; pTask->flushData = userData; } CMDQ_MSG ("[Auto Release] Submit ASYNC task scenario: %d, priority: %d, engine: 0x%llx, buffer: 0x%p, size: %d\n", handle->scenario, handle->priority, handle->engineFlag, handle->pBuffer, handle->blockSize); /* insert the task into auto-release queue */ if (pTask) { status = cmdqCoreAutoReleaseTask(pTask); } else { status = -ENOMEM; } return status; }
int32_t cmdqRecFlushAsync(cmdqRecHandle handle) { int32_t status = 0; cmdqCommandStruct desc = { 0 }; TaskStruct *pTask = NULL; status = cmdq_rec_finalize_command(handle, false); if (status < 0) { return status; } desc.scenario = handle->scenario; desc.priority = handle->priority; desc.engineFlag = handle->engineFlag; desc.pVABase = handle->pBuffer; desc.blockSize = handle->blockSize; desc.regRequest.count = 0; desc.regRequest.regAddresses = NULL; desc.regValue.count = 0; desc.regValue.regValues = NULL; status = cmdqCoreSubmitTaskAsync(&desc, NULL, 0, &pTask); CMDQ_MSG ("[Auto Release] Submit ASYNC task scenario: %d, priority: %d, engine: 0x%llx, buffer: 0x%p, size: %d\n", handle->scenario, handle->priority, handle->engineFlag, handle->pBuffer, handle->blockSize); if (pTask) { pTask->flushCallback = NULL; pTask->flushData = 0; } /* insert the task into auto-release queue */ if (pTask) { status = cmdqCoreAutoReleaseTask(pTask); } else { status = -ENOMEM; } return status; }