2018-09-26 07:27:29 +08:00
|
|
|
/*
|
2019-01-07 21:50:54 +08:00
|
|
|
* Copyright (C) 2018-2019 Intel Corporation
|
2018-09-26 07:27:29 +08:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
#include "runtime/command_stream/command_stream_receiver_hw.h"
|
2018-11-07 00:12:13 +08:00
|
|
|
#include "runtime/gen_common/aub_mapper.h"
|
2018-09-26 07:27:29 +08:00
|
|
|
#include "runtime/memory_manager/memory_banks.h"
|
2019-02-27 18:39:32 +08:00
|
|
|
|
2019-01-07 21:50:54 +08:00
|
|
|
#include "third_party/aub_stream/headers/hardware_context.h"
|
|
|
|
|
2019-01-19 04:44:23 +08:00
|
|
|
namespace aub_stream {
|
|
|
|
class AubManager;
|
2018-11-02 13:28:20 +08:00
|
|
|
struct AubStream;
|
2019-01-29 18:48:54 +08:00
|
|
|
} // namespace aub_stream
|
2018-11-02 13:28:20 +08:00
|
|
|
|
2018-09-26 07:27:29 +08:00
|
|
|
namespace OCLRT {
|
|
|
|
class GraphicsAllocation;
|
2019-02-07 20:21:58 +08:00
|
|
|
class HardwareContextController;
|
2018-09-26 07:27:29 +08:00
|
|
|
template <typename GfxFamily>
|
|
|
|
class CommandStreamReceiverSimulatedCommonHw : public CommandStreamReceiverHw<GfxFamily> {
|
2018-12-03 17:05:36 +08:00
|
|
|
protected:
|
2018-09-26 07:27:29 +08:00
|
|
|
using CommandStreamReceiverHw<GfxFamily>::CommandStreamReceiverHw;
|
2019-01-13 23:49:29 +08:00
|
|
|
using CommandStreamReceiverHw<GfxFamily>::deviceIndex;
|
2019-01-10 16:37:56 +08:00
|
|
|
using CommandStreamReceiverHw<GfxFamily>::hwInfo;
|
2019-01-13 23:49:29 +08:00
|
|
|
using CommandStreamReceiverHw<GfxFamily>::osContext;
|
2018-12-19 20:11:16 +08:00
|
|
|
using AUB = typename AUBFamilyMapper<GfxFamily>::AUB;
|
|
|
|
using MiContextDescriptorReg = typename AUB::MiContextDescriptorReg;
|
2018-09-26 07:27:29 +08:00
|
|
|
|
2019-02-06 20:32:49 +08:00
|
|
|
bool getParametersForWriteMemory(GraphicsAllocation &graphicsAllocation, uint64_t &gpuAddress, void *&cpuAddress, size_t &size) const;
|
2019-01-29 18:48:54 +08:00
|
|
|
|
2018-09-26 07:27:29 +08:00
|
|
|
public:
|
|
|
|
uint64_t getGTTBits() const {
|
|
|
|
return 0u;
|
|
|
|
}
|
2018-11-10 15:00:58 +08:00
|
|
|
void initGlobalMMIO();
|
2018-11-02 13:28:20 +08:00
|
|
|
void initAdditionalMMIO();
|
2018-12-04 23:45:00 +08:00
|
|
|
uint64_t getPPGTTAdditionalBits(GraphicsAllocation *gfxAllocation);
|
|
|
|
void getGTTData(void *memory, AubGTTData &data);
|
|
|
|
uint32_t getMemoryBankForGtt() const;
|
2018-12-18 18:16:56 +08:00
|
|
|
static const AubMemDump::LrcaHelper &getCsTraits(EngineInstanceT engineInstance);
|
2019-01-29 18:48:54 +08:00
|
|
|
void initEngineMMIO();
|
|
|
|
void submitLRCA(const MiContextDescriptorReg &contextDescriptor);
|
2019-01-10 16:37:56 +08:00
|
|
|
void setupContext(OsContext &osContext) override;
|
2019-02-11 16:04:16 +08:00
|
|
|
virtual void expectMemoryEqual(void *gfxAddress, const void *srcAddress, size_t length);
|
|
|
|
virtual void expectMemoryNotEqual(void *gfxAddress, const void *srcAddress, size_t length);
|
|
|
|
virtual void pollForCompletion() = 0;
|
|
|
|
virtual void pollForCompletionImpl(){};
|
|
|
|
virtual bool writeMemory(GraphicsAllocation &gfxAllocation) = 0;
|
2019-02-15 18:31:47 +08:00
|
|
|
virtual void writeMemory(uint64_t gpuAddress, void *cpuAddress, size_t size, uint32_t memoryBank, uint64_t entryBits) = 0;
|
2019-02-06 20:32:49 +08:00
|
|
|
virtual void writeMemoryWithAubManager(GraphicsAllocation &graphicsAllocation) = 0;
|
2018-11-02 13:28:20 +08:00
|
|
|
|
2019-01-19 04:44:23 +08:00
|
|
|
aub_stream::AubManager *aubManager = nullptr;
|
2019-02-07 20:21:58 +08:00
|
|
|
std::unique_ptr<HardwareContextController> hardwareContextController;
|
2019-01-07 21:50:54 +08:00
|
|
|
|
|
|
|
struct EngineInfo {
|
|
|
|
void *pLRCA;
|
|
|
|
uint32_t ggttLRCA;
|
|
|
|
void *pGlobalHWStatusPage;
|
|
|
|
uint32_t ggttHWSP;
|
|
|
|
void *pRingBuffer;
|
|
|
|
uint32_t ggttRingBuffer;
|
|
|
|
size_t sizeRingBuffer;
|
|
|
|
uint32_t tailRingBuffer;
|
2019-03-19 19:52:45 +08:00
|
|
|
} engineInfoTable[EngineType::NUM_ENGINES] = {};
|
2019-01-07 21:50:54 +08:00
|
|
|
|
2018-11-02 13:28:20 +08:00
|
|
|
AubMemDump::AubStream *stream;
|
2018-09-26 07:27:29 +08:00
|
|
|
};
|
|
|
|
} // namespace OCLRT
|