1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
|
/*
* Copyright (C) 2020-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include "shared/source/os_interface/device_factory.h"
#include "shared/source/os_interface/os_context.h"
#include "shared/test/common/fixtures/device_fixture.h"
#include "shared/test/common/helpers/engine_descriptor_helper.h"
#include <atomic>
#include <memory>
using namespace NEO;
namespace CpuIntrinsicsTests {
extern std::atomic<uintptr_t> lastClFlushedPtr;
}
struct DirectSubmissionFixture : public DeviceFixture {
void setUp() {
DeviceFixture::setUp();
DeviceFactory::prepareDeviceEnvironments(*pDevice->getExecutionEnvironment());
osContext = pDevice->getDefaultEngine().osContext;
}
OsContext *osContext = nullptr;
};
struct DirectSubmissionDispatchBufferFixture : public DirectSubmissionFixture {
void setUp() {
DirectSubmissionFixture::setUp();
MemoryManager *memoryManager = pDevice->getExecutionEnvironment()->memoryManager.get();
const AllocationProperties commandBufferProperties{pDevice->getRootDeviceIndex(), 0x1000,
AllocationType::COMMAND_BUFFER, pDevice->getDeviceBitfield()};
commandBuffer = memoryManager->allocateGraphicsMemoryWithProperties(commandBufferProperties);
batchBuffer.endCmdPtr = &bbStart[0];
batchBuffer.commandBufferAllocation = commandBuffer;
batchBuffer.usedSize = 0x40;
}
void tearDown() {
MemoryManager *memoryManager = pDevice->getExecutionEnvironment()->memoryManager.get();
memoryManager->freeGraphicsMemory(commandBuffer);
DirectSubmissionFixture::tearDown();
}
BatchBuffer batchBuffer;
uint8_t bbStart[64];
GraphicsAllocation *commandBuffer;
};
|