2018-04-04 17:34:46 +08:00
|
|
|
/*
|
2020-01-27 20:06:03 +08:00
|
|
|
* Copyright (C) 2018-2020 Intel Corporation
|
2018-09-18 15:11:08 +08:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*
|
|
|
|
*/
|
2018-04-04 17:34:46 +08:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2020-02-24 05:44:01 +08:00
|
|
|
#include "shared/source/command_stream/submissions_aggregator.h"
|
|
|
|
#include "shared/source/helpers/address_patch.h"
|
2019-02-27 18:39:32 +08:00
|
|
|
|
2018-04-04 17:34:46 +08:00
|
|
|
#include <map>
|
|
|
|
#include <vector>
|
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
namespace NEO {
|
2018-04-04 17:34:46 +08:00
|
|
|
|
|
|
|
enum class DispatchMode;
|
|
|
|
class MemoryManager;
|
2018-10-11 17:19:49 +08:00
|
|
|
class ExecutionEnvironment;
|
2018-04-04 17:34:46 +08:00
|
|
|
|
|
|
|
class FlatBatchBufferHelper {
|
|
|
|
public:
|
2018-10-11 17:19:49 +08:00
|
|
|
FlatBatchBufferHelper(ExecutionEnvironment &executionEnvironemnt) : executionEnvironemnt(executionEnvironemnt) {}
|
2018-04-04 17:34:46 +08:00
|
|
|
virtual ~FlatBatchBufferHelper(){};
|
|
|
|
MOCKABLE_VIRTUAL bool setPatchInfoData(const PatchInfoData &data);
|
|
|
|
MOCKABLE_VIRTUAL bool removePatchInfoData(uint64_t targetLocation);
|
|
|
|
MOCKABLE_VIRTUAL bool registerCommandChunk(uint64_t baseCpu, uint64_t baseGpu, uint64_t startOffset, uint64_t endOffset);
|
|
|
|
MOCKABLE_VIRTUAL bool registerCommandChunk(CommandChunk &commandChunk);
|
|
|
|
MOCKABLE_VIRTUAL bool registerCommandChunk(BatchBuffer &batchBuffer, size_t batchBufferStartCommandSize);
|
|
|
|
MOCKABLE_VIRTUAL bool registerBatchBufferStartAddress(uint64_t commandAddress, uint64_t startAddress);
|
2019-11-07 21:15:04 +08:00
|
|
|
virtual GraphicsAllocation *flattenBatchBuffer(uint32_t rootDeviceIndex, BatchBuffer &batchBuffer, size_t &sizeBatchBuffer, DispatchMode dispatchMode) = 0;
|
2018-04-04 17:34:46 +08:00
|
|
|
virtual char *getIndirectPatchCommands(size_t &indirectPatchCommandsSize, std::vector<PatchInfoData> &indirectPatchInfo) = 0;
|
2020-02-12 01:25:21 +08:00
|
|
|
virtual void removePipeControlData(size_t pipeControlLocationSize, void *pipeControlForNooping, const HardwareInfo &hwInfo) = 0;
|
2019-08-13 17:34:56 +08:00
|
|
|
virtual void collectScratchSpacePatchInfo(uint64_t scratchAddress, uint64_t commandOffset, const LinearStream &csr) = 0;
|
2018-04-04 17:34:46 +08:00
|
|
|
static void fixCrossThreadDataInfo(std::vector<PatchInfoData> &data, size_t offsetCrossThreadData, uint64_t gpuAddress);
|
|
|
|
|
|
|
|
std::vector<CommandChunk> &getCommandChunkList() { return commandChunkList; }
|
|
|
|
std::vector<PatchInfoData> &getPatchInfoCollection() { return patchInfoCollection; }
|
|
|
|
std::map<uint64_t, uint64_t> &getBatchBufferStartAddressSequence() { return batchBufferStartAddressSequence; }
|
|
|
|
|
|
|
|
protected:
|
2018-10-11 17:19:49 +08:00
|
|
|
MemoryManager *getMemoryManager() const;
|
|
|
|
ExecutionEnvironment &executionEnvironemnt;
|
2018-04-04 17:34:46 +08:00
|
|
|
|
|
|
|
std::vector<PatchInfoData> patchInfoCollection;
|
|
|
|
std::vector<CommandChunk> commandChunkList;
|
|
|
|
std::map<uint64_t, uint64_t> batchBufferStartAddressSequence;
|
|
|
|
};
|
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
} // namespace NEO
|