Fix async flag.

Signed-off-by: Michal Mrozek <michal.mrozek@intel.com>
This commit is contained in:
Michal Mrozek 2021-01-29 14:00:01 +00:00 committed by Compute-Runtime-Automation
parent c55886e9ff
commit cfe23873cf
4 changed files with 21 additions and 35 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2020 Intel Corporation
* Copyright (C) 2017-2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -108,9 +108,6 @@ void DrmCommandStreamReceiver<GfxFamily>::exec(const BatchBuffer &batchBuffer, u
DEBUG_BREAK_IF(!bb);
auto execFlags = static_cast<OsContextLinux *>(osContext)->getEngineFlag() | I915_EXEC_NO_RELOC;
if (DebugManager.flags.UseAsyncDrmExec.get() != -1) {
execFlags |= (EXEC_OBJECT_ASYNC * DebugManager.flags.UseAsyncDrmExec.get());
}
// Residency hold all allocation except command buffer, hence + 1
auto requiredSize = this->residency.size() + 1;

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2020 Intel Corporation
* Copyright (C) 2017-2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -441,4 +441,17 @@ TEST_F(DrmBufferObjectTest, givenBoMarkedForCaptureWhenFillingExecObjectThenCapt
bo->fillExecObject(execObject, osContext.get(), 0, 1);
EXPECT_TRUE(execObject.flags & EXEC_OBJECT_CAPTURE);
}
TEST_F(DrmBufferObjectTest, givenAsyncDebugFlagWhenFillingExecObjectThenFlagIsSet) {
drm_i915_gem_exec_object2 execObject;
DebugManagerStateRestore restorer;
DebugManager.flags.UseAsyncDrmExec.set(1);
memset(&execObject, 0, sizeof(execObject));
bo->setAddress(0x45000);
bo->setSize(0x1000);
bo->fillExecObject(execObject, osContext.get(), 0, 1);
EXPECT_TRUE(execObject.flags & EXEC_OBJECT_ASYNC);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2017-2020 Intel Corporation
* Copyright (C) 2017-2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -703,35 +703,6 @@ HWTEST_TEMPLATED_F(DrmCommandStreamBatchingTests, givenCSRWhenFlushIsCalledThenP
mm->freeGraphicsMemory(commandBuffer);
}
HWTEST_TEMPLATED_F(DrmCommandStreamBatchingTests, givenDebugFlagSetWhenCallingExecIoctlThenPassAsyncFlag) {
DebugManagerStateRestore restore;
auto commandBuffer = mm->allocateGraphicsMemoryWithProperties(MockAllocationProperties{csr->getRootDeviceIndex(), MemoryConstants::pageSize});
LinearStream cs(commandBuffer);
CommandStreamReceiverHw<FamilyType>::addBatchBufferEnd(cs, nullptr);
CommandStreamReceiverHw<FamilyType>::alignToCacheLine(cs);
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 0, nullptr, false, false, QueueThrottle::MEDIUM, QueueSliceCount::defaultSliceCount, cs.getUsed(), &cs, nullptr, false};
uint64_t baseFlags = static_cast<OsContextLinux &>(csr->getOsContext()).getEngineFlag() | I915_EXEC_NO_RELOC;
{
DebugManager.flags.UseAsyncDrmExec.set(0);
csr->flush(batchBuffer, csr->getResidencyAllocations());
EXPECT_EQ(baseFlags, this->mock->execBuffer.flags);
}
{
DebugManager.flags.UseAsyncDrmExec.set(1);
csr->flush(batchBuffer, csr->getResidencyAllocations());
EXPECT_EQ((baseFlags | EXEC_OBJECT_ASYNC), this->mock->execBuffer.flags);
}
mm->freeGraphicsMemory(commandBuffer);
}
HWTEST_TEMPLATED_F(DrmCommandStreamBatchingTests, givenCsrWhenDispatchPolicyIsSetToBatchingThenCommandBufferIsNotSubmitted) {
mock->reset();
csr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);

View File

@ -115,6 +115,11 @@ void BufferObject::fillExecObject(drm_i915_gem_exec_object2 &execObject, OsConte
execObject.alignment = 0;
execObject.offset = this->gpuAddress;
execObject.flags = EXEC_OBJECT_PINNED | EXEC_OBJECT_SUPPORTS_48B_ADDRESS;
if (DebugManager.flags.UseAsyncDrmExec.get() != -1) {
execObject.flags |= (EXEC_OBJECT_ASYNC * DebugManager.flags.UseAsyncDrmExec.get());
}
if (this->isMarkedForCapture()) {
execObject.flags |= EXEC_OBJECT_CAPTURE;
}