2020-08-20 12:02:29 +02:00
|
|
|
/*
|
2023-01-16 15:30:27 +00:00
|
|
|
* Copyright (C) 2020-2023 Intel Corporation
|
2020-08-20 12:02:29 +02:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
2022-05-17 19:04:23 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
2023-01-17 17:04:14 +00:00
|
|
|
#include "shared/source/command_stream/submissions_aggregator.h"
|
2022-12-07 11:51:44 +00:00
|
|
|
#include "shared/source/memory_manager/allocation_properties.h"
|
2022-11-16 15:50:07 +00:00
|
|
|
#include "shared/source/memory_manager/memory_manager.h"
|
2020-08-20 12:02:29 +02:00
|
|
|
#include "shared/source/os_interface/device_factory.h"
|
|
|
|
|
#include "shared/source/os_interface/os_context.h"
|
2021-01-21 13:10:13 +01:00
|
|
|
#include "shared/test/common/fixtures/device_fixture.h"
|
2021-08-11 17:36:00 +00:00
|
|
|
#include "shared/test/common/helpers/engine_descriptor_helper.h"
|
2023-01-16 15:30:27 +00:00
|
|
|
#include "shared/test/common/mocks/mock_device.h"
|
2020-08-20 12:02:29 +02:00
|
|
|
|
|
|
|
|
#include <atomic>
|
|
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
|
|
using namespace NEO;
|
|
|
|
|
|
2021-03-30 18:11:00 +00:00
|
|
|
namespace CpuIntrinsicsTests {
|
2020-08-20 12:02:29 +02:00
|
|
|
extern std::atomic<uintptr_t> lastClFlushedPtr;
|
2021-03-30 18:11:00 +00:00
|
|
|
}
|
2020-08-20 12:02:29 +02:00
|
|
|
|
|
|
|
|
struct DirectSubmissionFixture : public DeviceFixture {
|
2022-08-11 14:01:11 +00:00
|
|
|
void setUp() {
|
|
|
|
|
DeviceFixture::setUp();
|
2020-08-20 12:02:29 +02:00
|
|
|
DeviceFactory::prepareDeviceEnvironments(*pDevice->getExecutionEnvironment());
|
|
|
|
|
|
2022-04-06 14:41:45 +00:00
|
|
|
osContext = pDevice->getDefaultEngine().osContext;
|
2020-08-20 12:02:29 +02:00
|
|
|
}
|
|
|
|
|
|
2022-04-06 14:41:45 +00:00
|
|
|
OsContext *osContext = nullptr;
|
2020-08-20 12:02:29 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct DirectSubmissionDispatchBufferFixture : public DirectSubmissionFixture {
|
2022-08-11 14:01:11 +00:00
|
|
|
void setUp() {
|
2023-02-22 07:29:42 +00:00
|
|
|
DebugManager.flags.DirectSubmissionFlatRingBuffer.set(0);
|
2022-08-11 14:01:11 +00:00
|
|
|
DirectSubmissionFixture::setUp();
|
2020-08-20 12:02:29 +02:00
|
|
|
MemoryManager *memoryManager = pDevice->getExecutionEnvironment()->memoryManager.get();
|
|
|
|
|
const AllocationProperties commandBufferProperties{pDevice->getRootDeviceIndex(), 0x1000,
|
2022-02-04 13:59:01 +00:00
|
|
|
AllocationType::COMMAND_BUFFER, pDevice->getDeviceBitfield()};
|
2020-08-20 12:02:29 +02:00
|
|
|
commandBuffer = memoryManager->allocateGraphicsMemoryWithProperties(commandBufferProperties);
|
2023-02-22 07:29:42 +00:00
|
|
|
stream = std::make_unique<LinearStream>(commandBuffer);
|
|
|
|
|
stream->getSpace(0x40);
|
2020-08-20 12:02:29 +02:00
|
|
|
|
|
|
|
|
batchBuffer.endCmdPtr = &bbStart[0];
|
|
|
|
|
batchBuffer.commandBufferAllocation = commandBuffer;
|
|
|
|
|
batchBuffer.usedSize = 0x40;
|
2022-11-18 21:02:29 +00:00
|
|
|
batchBuffer.taskStartAddress = 0x881112340000;
|
2023-02-22 07:29:42 +00:00
|
|
|
batchBuffer.stream = stream.get();
|
2020-08-20 12:02:29 +02:00
|
|
|
}
|
|
|
|
|
|
2022-08-11 14:01:11 +00:00
|
|
|
void tearDown() {
|
2020-08-20 12:02:29 +02:00
|
|
|
MemoryManager *memoryManager = pDevice->getExecutionEnvironment()->memoryManager.get();
|
|
|
|
|
memoryManager->freeGraphicsMemory(commandBuffer);
|
|
|
|
|
|
2022-08-11 14:01:11 +00:00
|
|
|
DirectSubmissionFixture::tearDown();
|
2020-08-20 12:02:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BatchBuffer batchBuffer;
|
|
|
|
|
uint8_t bbStart[64];
|
|
|
|
|
GraphicsAllocation *commandBuffer;
|
2023-02-22 07:29:42 +00:00
|
|
|
DebugManagerStateRestore restorer;
|
|
|
|
|
std::unique_ptr<LinearStream> stream;
|
2020-08-20 12:02:29 +02:00
|
|
|
};
|