2017-12-21 07:45:38 +08:00
/*
2024-04-25 20:03:39 +08:00
* Copyright (C) 2018-2024 Intel Corporation
2017-12-21 07:45:38 +08:00
*
2018-09-20 11:54:29 +08:00
* SPDX-License-Identifier: MIT
2017-12-21 07:45:38 +08:00
*
*/
2020-02-24 05:44:01 +08:00
#include "shared/source/command_stream/linear_stream.h"
2023-01-02 19:14:39 +08:00
#include "shared/source/command_stream/submission_status.h"
2023-01-18 01:04:14 +08:00
#include "shared/source/command_stream/submissions_aggregator.h"
2022-12-06 15:32:34 +08:00
#include "shared/source/command_stream/tag_allocation_layout.h"
2020-02-24 05:44:01 +08:00
#include "shared/source/execution_environment/execution_environment.h"
2021-09-08 07:30:06 +08:00
#include "shared/source/gmm_helper/client_context/gmm_client_context.h"
2020-02-24 05:44:01 +08:00
#include "shared/source/gmm_helper/page_table_mngr.h"
#include "shared/source/helpers/aligned_memory.h"
#include "shared/source/helpers/flush_stamp.h"
2023-02-02 00:23:01 +08:00
#include "shared/source/helpers/gfx_core_helper.h"
2020-02-24 05:44:01 +08:00
#include "shared/source/memory_manager/residency.h"
#include "shared/source/os_interface/linux/drm_allocation.h"
#include "shared/source/os_interface/linux/drm_buffer_object.h"
2021-09-23 17:03:22 +08:00
#include "shared/source/os_interface/linux/drm_command_stream.h"
2020-02-24 05:44:01 +08:00
#include "shared/source/os_interface/linux/drm_memory_manager.h"
2020-05-08 16:04:06 +08:00
#include "shared/source/os_interface/linux/drm_memory_operations_handler.h"
2020-02-24 05:44:01 +08:00
#include "shared/source/os_interface/linux/drm_neo.h"
2022-05-18 01:16:13 +08:00
#include "shared/source/os_interface/linux/drm_wrappers.h"
2020-02-24 05:44:01 +08:00
#include "shared/source/os_interface/linux/os_context_linux.h"
2021-05-21 07:17:57 +08:00
#include "shared/source/os_interface/os_interface.h"
2023-04-25 04:45:11 +08:00
#include "shared/source/os_interface/sys_calls_common.h"
2020-02-24 17:22:30 +08:00
2019-03-26 18:59:46 +08:00
namespace NEO {
2017-12-21 07:45:38 +08:00
template <typename GfxFamily>
2020-10-29 22:33:35 +08:00
DrmCommandStreamReceiver<GfxFamily>::DrmCommandStreamReceiver(ExecutionEnvironment &executionEnvironment,
uint32_t rootDeviceIndex,
const DeviceBitfield deviceBitfield,
2023-12-19 20:39:07 +08:00
GemCloseWorkerMode mode)
2020-10-28 23:08:37 +08:00
: BaseClass(executionEnvironment, rootDeviceIndex, deviceBitfield), gemCloseWorkerOperationMode(mode) {
2018-09-17 21:42:15 +08:00
2020-05-15 19:52:11 +08:00
auto rootDeviceEnvironment = executionEnvironment.rootDeviceEnvironments[rootDeviceIndex].get();
2021-05-21 07:17:57 +08:00
this->drm = rootDeviceEnvironment->osInterface->getDriverModel()->as<Drm>();
2018-08-30 15:27:47 +08:00
residency.reserve(512);
execObjectsStorage.reserve(512);
2020-05-15 19:52:11 +08:00
2023-11-20 21:45:19 +08:00
if (this->drm->isVmBindAvailable()) {
2023-12-19 20:39:07 +08:00
gemCloseWorkerOperationMode = GemCloseWorkerMode::gemCloseWorkerInactive;
2021-06-28 21:10:21 +08:00
}
2023-11-30 16:32:25 +08:00
if (debugManager.flags.EnableGemCloseWorker.get() != -1) {
2023-12-19 20:39:07 +08:00
gemCloseWorkerOperationMode = debugManager.flags.EnableGemCloseWorker.get() ? GemCloseWorkerMode::gemCloseWorkerActive : GemCloseWorkerMode::gemCloseWorkerInactive;
2021-06-28 21:10:21 +08:00
}
2020-05-15 19:52:11 +08:00
auto hwInfo = rootDeviceEnvironment->getHardwareInfo();
2022-12-12 20:39:04 +08:00
auto &gfxCoreHelper = rootDeviceEnvironment->getHelper<GfxCoreHelper>();
auto localMemoryEnabled = gfxCoreHelper.getEnableLocalMemory(*hwInfo);
2020-05-15 19:52:11 +08:00
2023-12-13 17:17:24 +08:00
this->dispatchMode = localMemoryEnabled ? DispatchMode::batchedDispatch : DispatchMode::immediateDispatch;
2020-05-15 19:52:11 +08:00
2022-01-21 05:20:56 +08:00
if (ApiSpecificConfig::getApiType() == ApiSpecificConfig::L0) {
2023-12-13 17:17:24 +08:00
this->dispatchMode = DispatchMode::immediateDispatch;
2022-01-21 05:20:56 +08:00
}
2023-11-30 16:32:25 +08:00
if (debugManager.flags.CsrDispatchMode.get()) {
this->dispatchMode = static_cast<DispatchMode>(debugManager.flags.CsrDispatchMode.get());
2020-05-15 19:52:11 +08:00
}
2023-11-30 16:32:25 +08:00
int overrideUserFenceForCompletionWait = debugManager.flags.EnableUserFenceForCompletionWait.get();
2021-06-15 19:31:12 +08:00
if (overrideUserFenceForCompletionWait != -1) {
useUserFenceWait = !!(overrideUserFenceForCompletionWait);
2021-06-04 20:23:20 +08:00
}
2021-06-17 19:55:28 +08:00
useNotifyEnableForPostSync = useUserFenceWait;
2023-11-30 16:32:25 +08:00
int overrideUseNotifyEnableForPostSync = debugManager.flags.OverrideNotifyEnableForTagUpdatePostSync.get();
2021-06-22 23:44:29 +08:00
if (overrideUseNotifyEnableForPostSync != -1) {
useNotifyEnableForPostSync = !!(overrideUseNotifyEnableForPostSync);
}
2023-11-30 16:32:25 +08:00
kmdWaitTimeout = debugManager.flags.SetKmdWaitTimeout.get();
2017-12-21 07:45:38 +08:00
}
2022-03-25 21:00:53 +08:00
template <typename GfxFamily>
inline DrmCommandStreamReceiver<GfxFamily>::~DrmCommandStreamReceiver() {
if (this->isUpdateTagFromWaitEnabled()) {
this->waitForCompletionWithTimeout(WaitParams{false, false, 0}, this->peekTaskCount());
}
}
2017-12-21 07:45:38 +08:00
template <typename GfxFamily>
2022-01-07 22:53:31 +08:00
SubmissionStatus DrmCommandStreamReceiver<GfxFamily>::flush(BatchBuffer &batchBuffer, ResidencyContainer &allocationsForResidency) {
2023-11-30 16:32:25 +08:00
if (debugManager.flags.ExitOnSubmissionNumber.get() != -1) {
bool enabled = (this->taskCount >= static_cast<TaskCountType>(debugManager.flags.ExitOnSubmissionNumber.get()));
2023-04-25 04:45:11 +08:00
2023-11-30 16:32:25 +08:00
if (debugManager.flags.ExitOnSubmissionMode.get() == 1 && !EngineHelpers::isComputeEngine(this->osContext->getEngineType())) {
2023-04-25 04:45:11 +08:00
enabled = false;
}
2023-11-30 16:32:25 +08:00
if (debugManager.flags.ExitOnSubmissionMode.get() == 2 && !EngineHelpers::isBcs(this->osContext->getEngineType())) {
2023-04-25 04:45:11 +08:00
enabled = false;
}
if (enabled) {
SysCalls::exit(0);
}
}
2020-04-30 19:24:34 +08:00
this->printDeviceIndex();
2017-12-21 07:45:38 +08:00
DrmAllocation *alloc = static_cast<DrmAllocation *>(batchBuffer.commandBufferAllocation);
DEBUG_BREAK_IF(!alloc);
BufferObject *bb = alloc->getBO();
2019-09-23 22:30:31 +08:00
if (bb == nullptr) {
2023-12-13 17:17:24 +08:00
return SubmissionStatus::outOfMemory;
2019-09-23 22:30:31 +08:00
}
2017-12-21 07:45:38 +08:00
2019-08-21 18:50:47 +08:00
if (this->lastSentSliceCount != batchBuffer.sliceCount) {
if (drm->setQueueSliceCount(batchBuffer.sliceCount)) {
this->lastSentSliceCount = batchBuffer.sliceCount;
}
}
2020-05-25 15:02:14 +08:00
auto memoryOperationsInterface = static_cast<DrmMemoryOperationsHandler *>(this->executionEnvironment.rootDeviceEnvironments[this->rootDeviceIndex]->memoryOperationsInterface.get());
2020-11-27 20:02:43 +08:00
std::unique_lock<std::mutex> lock;
if (!this->directSubmission.get() && !this->blitterDirectSubmission.get()) {
lock = memoryOperationsInterface->lockHandlerIfUsed();
}
2022-11-15 19:21:56 +08:00
auto submissionStatus = this->printBOsForSubmit(allocationsForResidency, *batchBuffer.commandBufferAllocation);
2023-12-13 17:17:24 +08:00
if (submissionStatus != SubmissionStatus::success) {
2022-11-15 19:21:56 +08:00
return submissionStatus;
}
2021-02-19 23:23:35 +08:00
2022-09-30 02:31:22 +08:00
if (this->drm->isVmBindAvailable()) {
allocationsForResidency.push_back(batchBuffer.commandBufferAllocation);
}
2022-01-07 22:53:31 +08:00
MemoryOperationsStatus retVal = memoryOperationsInterface->mergeWithResidencyContainer(this->osContext, allocationsForResidency);
2023-12-13 17:17:24 +08:00
if (retVal != MemoryOperationsStatus::success) {
if (retVal == MemoryOperationsStatus::outOfMemory) {
return SubmissionStatus::outOfMemory;
2022-01-07 22:53:31 +08:00
}
2023-12-13 17:17:24 +08:00
return SubmissionStatus::failed;
2022-01-07 22:53:31 +08:00
}
2020-05-08 16:04:06 +08:00
2021-04-29 16:58:16 +08:00
if (this->directSubmission.get()) {
2021-10-29 19:54:52 +08:00
this->startControllingDirectSubmissions();
2022-01-07 22:53:31 +08:00
bool ret = this->directSubmission->dispatchCommandBuffer(batchBuffer, *this->flushStamp.get());
if (ret == false) {
2023-03-24 17:01:23 +08:00
return Drm::getSubmissionStatusFromReturnCode(this->directSubmission->getDispatchErrorCode());
2022-01-07 22:53:31 +08:00
}
2023-12-13 17:17:24 +08:00
return SubmissionStatus::success;
2020-07-17 17:28:59 +08:00
}
2020-10-19 21:36:57 +08:00
if (this->blitterDirectSubmission.get()) {
2021-10-29 19:54:52 +08:00
this->startControllingDirectSubmissions();
2022-01-07 22:53:31 +08:00
bool ret = this->blitterDirectSubmission->dispatchCommandBuffer(batchBuffer, *this->flushStamp.get());
if (ret == false) {
2023-03-24 17:01:23 +08:00
return Drm::getSubmissionStatusFromReturnCode(this->blitterDirectSubmission->getDispatchErrorCode());
2022-01-07 22:53:31 +08:00
}
2023-12-13 17:17:24 +08:00
return SubmissionStatus::success;
2020-10-19 21:36:57 +08:00
}
2020-07-17 17:28:59 +08:00
2021-06-18 09:11:36 +08:00
if (isUserFenceWaitActive()) {
2021-08-09 17:52:54 +08:00
this->flushStamp->setStamp(latestSentTaskCount);
2021-06-04 20:23:20 +08:00
} else {
this->flushStamp->setStamp(bb->peekHandle());
}
2022-03-29 19:51:44 +08:00
2023-11-30 16:32:25 +08:00
auto readBackMode = debugManager.flags.ReadBackCommandBufferAllocation.get();
2022-03-29 19:51:44 +08:00
bool readBackAllowed = ((batchBuffer.commandBufferAllocation->isAllocatedInLocalMemoryPool() && readBackMode == 1) || readBackMode == 2);
if (readBackAllowed) {
readBackAllocation(ptrOffset(batchBuffer.commandBufferAllocation->getUnderlyingBuffer(), batchBuffer.startOffset));
}
2021-10-12 09:32:45 +08:00
auto ret = this->flushInternal(batchBuffer, allocationsForResidency);
2018-05-11 15:57:59 +08:00
2023-12-19 20:39:07 +08:00
if (this->gemCloseWorkerOperationMode == GemCloseWorkerMode::gemCloseWorkerActive) {
2019-09-23 22:30:31 +08:00
bb->reference();
this->getMemoryManager()->peekGemCloseWorker()->push(bb);
2017-12-21 07:45:38 +08:00
}
2022-09-13 22:26:03 +08:00
return ret;
2017-12-21 07:45:38 +08:00
}
2022-03-29 19:51:44 +08:00
template <typename GfxFamily>
void DrmCommandStreamReceiver<GfxFamily>::readBackAllocation(void *source) {
reserved = *reinterpret_cast<volatile uint32_t *>(source);
}
2021-02-19 23:23:35 +08:00
template <typename GfxFamily>
2022-11-15 19:21:56 +08:00
SubmissionStatus DrmCommandStreamReceiver<GfxFamily>::printBOsForSubmit(ResidencyContainer &allocationsForResidency, GraphicsAllocation &cmdBufferAllocation) {
2023-11-30 16:32:25 +08:00
if (debugManager.flags.PrintBOsForSubmit.get()) {
2021-02-19 23:23:35 +08:00
std::vector<BufferObject *> bosForSubmit;
for (auto drmIterator = 0u; drmIterator < osContext->getDeviceBitfield().size(); drmIterator++) {
if (osContext->getDeviceBitfield().test(drmIterator)) {
for (auto gfxAllocation = allocationsForResidency.begin(); gfxAllocation != allocationsForResidency.end(); gfxAllocation++) {
auto drmAllocation = static_cast<DrmAllocation *>(*gfxAllocation);
2022-11-15 19:21:56 +08:00
auto retCode = drmAllocation->makeBOsResident(osContext, drmIterator, &bosForSubmit, true);
if (retCode) {
return Drm::getSubmissionStatusFromReturnCode(retCode);
}
2021-02-19 23:23:35 +08:00
}
auto drmCmdBufferAllocation = static_cast<DrmAllocation *>(&cmdBufferAllocation);
2022-11-15 19:21:56 +08:00
auto retCode = drmCmdBufferAllocation->makeBOsResident(osContext, drmIterator, &bosForSubmit, true);
if (retCode) {
return Drm::getSubmissionStatusFromReturnCode(retCode);
}
2021-02-19 23:23:35 +08:00
}
}
printf("Buffer object for submit\n");
for (const auto &bo : bosForSubmit) {
2021-02-24 04:12:14 +08:00
printf("BO-%d, range: %" SCNx64 " - %" SCNx64 ", size: %" SCNdPTR "\n", bo->peekHandle(), bo->peekAddress(), ptrOffset(bo->peekAddress(), bo->peekSize()), bo->peekSize());
2021-02-19 23:23:35 +08:00
}
printf("\n");
}
2023-12-13 17:17:24 +08:00
return SubmissionStatus::success;
2021-02-19 23:23:35 +08:00
}
2019-09-23 22:30:31 +08:00
template <typename GfxFamily>
2022-01-21 02:13:07 +08:00
int DrmCommandStreamReceiver<GfxFamily>::exec(const BatchBuffer &batchBuffer, uint32_t vmHandleId, uint32_t drmContextId, uint32_t index) {
2019-09-23 22:30:31 +08:00
DrmAllocation *alloc = static_cast<DrmAllocation *>(batchBuffer.commandBufferAllocation);
DEBUG_BREAK_IF(!alloc);
BufferObject *bb = alloc->getBO();
DEBUG_BREAK_IF(!bb);
2022-06-15 00:47:02 +08:00
auto osContextLinux = static_cast<OsContextLinux *>(this->osContext);
2023-12-13 17:05:31 +08:00
auto execFlags = osContextLinux->getEngineFlag() | drm->getIoctlHelper()->getDrmParamValue(DrmParam::execNoReloc);
2019-09-23 22:30:31 +08:00
2022-09-30 02:31:22 +08:00
// requiredSize determinant:
// * vmBind UNAVAILABLE => residency holds all allocations except for the command buffer
// * vmBind AVAILABLE => residency holds command buffer as well
2019-09-23 22:30:31 +08:00
auto requiredSize = this->residency.size() + 1;
if (requiredSize > this->execObjectsStorage.size()) {
this->execObjectsStorage.resize(requiredSize);
}
2022-01-20 02:14:10 +08:00
uint64_t completionGpuAddress = 0;
2022-11-22 21:53:59 +08:00
TaskCountType completionValue = 0;
2022-09-30 02:31:22 +08:00
if (this->drm->isVmBindAvailable() && this->drm->completionFenceSupport()) {
2023-06-06 23:11:09 +08:00
completionGpuAddress = getTagAllocation()->getGpuAddress() + (index * this->immWritePostSyncWriteOffset) + TagAllocationLayout::completionFenceOffset;
2022-01-20 02:14:10 +08:00
completionValue = this->latestSentTaskCount;
}
2021-10-12 09:32:45 +08:00
int ret = bb->exec(static_cast<uint32_t>(alignUp(batchBuffer.usedSize - batchBuffer.startOffset, 8)),
2020-05-21 18:21:13 +08:00
batchBuffer.startOffset, execFlags,
2023-09-12 18:26:59 +08:00
false,
2020-08-11 20:00:41 +08:00
this->osContext,
2020-07-31 13:45:48 +08:00
vmHandleId,
2019-09-23 22:30:31 +08:00
drmContextId,
2020-05-06 18:37:15 +08:00
this->residency.data(), this->residency.size(),
2022-01-20 02:14:10 +08:00
this->execObjectsStorage.data(),
completionGpuAddress,
completionValue);
2019-09-23 22:30:31 +08:00
this->residency.clear();
2021-10-12 09:32:45 +08:00
return ret;
2019-09-23 22:30:31 +08:00
}
2017-12-21 07:45:38 +08:00
template <typename GfxFamily>
2022-11-15 18:04:19 +08:00
SubmissionStatus DrmCommandStreamReceiver<GfxFamily>::processResidency(const ResidencyContainer &inputAllocationsForResidency, uint32_t handleId) {
2022-09-30 02:31:22 +08:00
if (drm->isVmBindAvailable()) {
2023-12-13 17:17:24 +08:00
return SubmissionStatus::success;
2022-09-30 02:31:22 +08:00
}
int ret = 0;
for (auto &alloc : inputAllocationsForResidency) {
auto drmAlloc = static_cast<DrmAllocation *>(alloc);
ret = drmAlloc->makeBOsResident(osContext, handleId, &this->residency, false);
if (ret != 0) {
break;
2022-05-27 11:58:07 +08:00
}
2017-12-21 07:45:38 +08:00
}
2022-09-30 02:31:22 +08:00
2022-11-15 18:04:19 +08:00
return Drm::getSubmissionStatusFromReturnCode(ret);
2017-12-21 07:45:38 +08:00
}
template <typename GfxFamily>
void DrmCommandStreamReceiver<GfxFamily>::makeNonResident(GraphicsAllocation &gfxAllocation) {
// Vector is moved to command buffer inside flush.
// If flush wasn't called we need to make all objects non-resident.
// If makeNonResident is called before flush, vector will be cleared.
2018-12-03 17:05:36 +08:00
if (gfxAllocation.isResident(this->osContext->getContextId())) {
2017-12-21 07:45:38 +08:00
if (this->residency.size() != 0) {
this->residency.clear();
}
2019-07-29 22:11:51 +08:00
for (auto fragmentId = 0u; fragmentId < gfxAllocation.fragmentsStorage.fragmentCount; fragmentId++) {
gfxAllocation.fragmentsStorage.fragmentStorageData[fragmentId].residency->resident[osContext->getContextId()] = false;
2017-12-21 07:45:38 +08:00
}
}
2022-01-25 21:24:45 +08:00
if (!gfxAllocation.isAlwaysResident(this->osContext->getContextId())) {
gfxAllocation.releaseResidencyInOsContext(this->osContext->getContextId());
}
2017-12-21 07:45:38 +08:00
}
template <typename GfxFamily>
2019-07-29 22:11:51 +08:00
DrmMemoryManager *DrmCommandStreamReceiver<GfxFamily>::getMemoryManager() const {
return static_cast<DrmMemoryManager *>(CommandStreamReceiver::getMemoryManager());
2017-12-21 07:45:38 +08:00
}
2019-11-07 01:14:30 +08:00
template <typename GfxFamily>
GmmPageTableMngr *DrmCommandStreamReceiver<GfxFamily>::createPageTableManager() {
2021-09-08 07:30:06 +08:00
auto rootDeviceEnvironment = this->executionEnvironment.rootDeviceEnvironments[this->rootDeviceIndex].get();
auto gmmClientContext = rootDeviceEnvironment->getGmmClientContext();
GMM_DEVICE_INFO deviceInfo{};
GMM_DEVICE_CALLBACKS_INT deviceCallbacks{};
deviceInfo.pDeviceCb = &deviceCallbacks;
gmmClientContext->setGmmDeviceInfo(&deviceInfo);
auto gmmPageTableMngr = GmmPageTableMngr::create(gmmClientContext, TT_TYPE::AUXTT, nullptr);
2019-11-07 01:14:30 +08:00
gmmPageTableMngr->setCsrHandle(this);
2021-09-08 07:30:06 +08:00
2021-09-29 23:59:41 +08:00
this->pageTableManager.reset(gmmPageTableMngr);
2021-09-08 07:30:06 +08:00
2019-11-07 01:14:30 +08:00
return gmmPageTableMngr;
}
2017-12-21 07:45:38 +08:00
template <typename GfxFamily>
2021-09-17 21:05:26 +08:00
bool DrmCommandStreamReceiver<GfxFamily>::waitForFlushStamp(FlushStamp &flushStamp) {
2021-06-04 20:23:20 +08:00
auto waitValue = static_cast<uint32_t>(flushStamp);
2021-06-18 09:11:36 +08:00
if (isUserFenceWaitActive()) {
2023-07-20 17:14:08 +08:00
uint64_t tagAddress = castToUint64(const_cast<TagAddressType *>(getTagAddress()));
2024-04-26 22:39:26 +08:00
return waitUserFence(waitValue, tagAddress, kmdWaitTimeout, false, NEO::InterruptId::notUsed);
2021-06-04 20:23:20 +08:00
} else {
2021-06-18 09:11:36 +08:00
this->drm->waitHandle(waitValue, kmdWaitTimeout);
2021-06-04 20:23:20 +08:00
}
2017-12-21 07:45:38 +08:00
return true;
}
2023-07-20 17:14:08 +08:00
template <typename GfxFamily>
SubmissionStatus DrmCommandStreamReceiver<GfxFamily>::flushInternal(const BatchBuffer &batchBuffer, const ResidencyContainer &allocationsForResidency) {
if (drm->useVMBindImmediate()) {
auto osContextLinux = static_cast<OsContextLinux *>(this->osContext);
osContextLinux->waitForPagingFence();
}
auto &drmContextIds = static_cast<const OsContextLinux *>(osContext)->getDrmContextIds();
uint32_t contextIndex = 0;
for (auto tileIterator = 0u; tileIterator < this->osContext->getDeviceBitfield().size(); tileIterator++) {
if (this->osContext->getDeviceBitfield().test(tileIterator)) {
2023-11-30 16:32:25 +08:00
if (debugManager.flags.ForceExecutionTile.get() != -1 && this->osContext->getDeviceBitfield().count() > 1) {
tileIterator = contextIndex = debugManager.flags.ForceExecutionTile.get();
2023-07-20 17:14:08 +08:00
}
auto processResidencySuccess = this->processResidency(allocationsForResidency, tileIterator);
2023-12-13 17:17:24 +08:00
if (processResidencySuccess != SubmissionStatus::success) {
2023-07-20 17:14:08 +08:00
return processResidencySuccess;
}
2023-11-30 16:32:25 +08:00
if (debugManager.flags.PrintDeviceAndEngineIdOnSubmission.get()) {
2023-07-20 17:14:08 +08:00
printf("%u: Drm Submission of contextIndex: %u, with context id %u\n", SysCalls::getProcessId(), contextIndex, drmContextIds[contextIndex]);
}
int ret = this->exec(batchBuffer, tileIterator, drmContextIds[contextIndex], contextIndex);
if (ret) {
return Drm::getSubmissionStatusFromReturnCode(ret);
}
contextIndex++;
2023-11-30 16:32:25 +08:00
if (debugManager.flags.EnableWalkerPartition.get() == 0) {
2023-12-13 17:17:24 +08:00
return SubmissionStatus::success;
2023-07-20 17:14:08 +08:00
}
}
}
2023-12-13 17:17:24 +08:00
return SubmissionStatus::success;
2023-07-20 17:14:08 +08:00
}
template <typename GfxFamily>
2024-04-26 22:39:26 +08:00
bool DrmCommandStreamReceiver<GfxFamily>::waitUserFence(TaskCountType waitValue, uint64_t hostAddress, int64_t timeout, bool userInterrupt, uint32_t externalInterruptId) {
int ret = drm->waitOnUserFences(static_cast<const OsContextLinux &>(*this->osContext), hostAddress, waitValue, this->activePartitions, timeout, this->immWritePostSyncWriteOffset, userInterrupt, externalInterruptId);
2023-07-20 17:14:08 +08:00
return (ret == 0);
}
2021-02-17 18:33:41 +08:00
template <typename GfxFamily>
2021-06-15 19:31:12 +08:00
bool DrmCommandStreamReceiver<GfxFamily>::isKmdWaitModeActive() {
if (this->drm->isVmBindAvailable()) {
2021-06-18 09:11:36 +08:00
return useUserFenceWait;
2021-06-15 19:31:12 +08:00
}
return true;
2021-02-17 18:33:41 +08:00
}
2021-06-18 09:11:36 +08:00
template <typename GfxFamily>
inline bool DrmCommandStreamReceiver<GfxFamily>::isUserFenceWaitActive() {
return (this->drm->isVmBindAvailable() && useUserFenceWait);
}
2023-06-13 22:37:41 +08:00
template <typename GfxFamily>
bool DrmCommandStreamReceiver<GfxFamily>::isKmdWaitOnTaskCountAllowed() const {
return this->isDirectSubmissionEnabled();
}
2019-03-26 18:59:46 +08:00
} // namespace NEO