mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-04 15:53:45 +08:00
feature: find cpu base address from all command buffers of container
Related-To: NEO-10381 Signed-off-by: Zbigniew Zdanowicz <zbigniew.zdanowicz@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
6b33d91140
commit
d1041e2335
@@ -33,6 +33,7 @@ using CommandContainerTest = Test<CommandContainerFixture>;
|
||||
class MyMockCommandContainer : public CommandContainer {
|
||||
public:
|
||||
using CommandContainer::allocationIndirectHeaps;
|
||||
using CommandContainer::cmdBufferAllocations;
|
||||
using CommandContainer::defaultSshSize;
|
||||
using CommandContainer::dirtyHeaps;
|
||||
using CommandContainer::getAlignedCmdBufferSize;
|
||||
@@ -1986,3 +1987,45 @@ TEST_F(CommandContainerTest, givenHeaplessCmdContainerWhenResetContainerThenNoHe
|
||||
cmdContainer.reset();
|
||||
EXPECT_EQ(0u, deallocationList.size());
|
||||
}
|
||||
|
||||
TEST_F(CommandContainerTest, givenInitializedContainerWhenSearchedAddressIsWithinCommandStreamThenReturnCommandStreamCpuBase) {
|
||||
MyMockCommandContainer cmdContainer;
|
||||
|
||||
auto status = cmdContainer.initialize(pDevice, nullptr, HeapSize::defaultHeapSize, false, false);
|
||||
EXPECT_EQ(CommandContainer::ErrorCode::success, status);
|
||||
|
||||
void *cmdBuffer = ptrOffset(cmdContainer.getCommandStream()->getCpuBase(), 0x100);
|
||||
void *cpuBase = cmdContainer.findCpuBaseForCmdBufferAddress(cmdBuffer);
|
||||
EXPECT_EQ(cmdContainer.getCommandStream()->getCpuBase(), cpuBase);
|
||||
}
|
||||
|
||||
TEST_F(CommandContainerTest, givenInitializedContainerWithTwoCommandBuffersWhenSearchedAddressIsWithinOldCommandBufferThenReturnOldCommandBufferCpuBase) {
|
||||
MyMockCommandContainer cmdContainer;
|
||||
|
||||
auto status = cmdContainer.initialize(pDevice, nullptr, HeapSize::defaultHeapSize, false, false);
|
||||
EXPECT_EQ(CommandContainer::ErrorCode::success, status);
|
||||
|
||||
void *expectedCpuBase = cmdContainer.getCommandStream()->getCpuBase();
|
||||
void *cmdBuffer = ptrOffset(expectedCpuBase, 0x200);
|
||||
cmdContainer.allocateNextCommandBuffer();
|
||||
EXPECT_NE(expectedCpuBase, cmdContainer.getCommandStream()->getCpuBase());
|
||||
|
||||
void *cpuBase = cmdContainer.findCpuBaseForCmdBufferAddress(cmdBuffer);
|
||||
EXPECT_EQ(expectedCpuBase, cpuBase);
|
||||
}
|
||||
|
||||
TEST_F(CommandContainerTest, givenInitializedContainerWhenSearchedAddressIsOutsideCommandStreamThenReturnNullptr) {
|
||||
MyMockCommandContainer cmdContainer;
|
||||
|
||||
auto status = cmdContainer.initialize(pDevice, nullptr, HeapSize::defaultHeapSize, false, false);
|
||||
EXPECT_EQ(CommandContainer::ErrorCode::success, status);
|
||||
cmdContainer.allocateNextCommandBuffer();
|
||||
|
||||
void *cmdBuffer = reinterpret_cast<void *>(0x1);
|
||||
void *cpuBase = cmdContainer.findCpuBaseForCmdBufferAddress(cmdBuffer);
|
||||
EXPECT_EQ(nullptr, cpuBase);
|
||||
|
||||
cmdBuffer = reinterpret_cast<void *>(std::numeric_limits<uintptr_t>::max());
|
||||
cpuBase = cmdContainer.findCpuBaseForCmdBufferAddress(cmdBuffer);
|
||||
EXPECT_EQ(nullptr, cpuBase);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user