2017-12-21 07:45:38 +08:00
|
|
|
/*
|
2020-01-07 14:42:40 +08:00
|
|
|
* Copyright (C) 2017-2020 Intel Corporation
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
2018-09-19 04:17:55 +08:00
|
|
|
* SPDX-License-Identifier: MIT
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
#include "runtime/command_stream/tbx_command_stream_receiver.h"
|
2019-02-27 18:39:32 +08:00
|
|
|
#include "runtime/gen_common/aub_mapper.h"
|
2017-12-21 07:45:38 +08:00
|
|
|
#include "runtime/memory_manager/address_mapper.h"
|
|
|
|
#include "runtime/memory_manager/os_agnostic_memory_manager.h"
|
|
|
|
#include "runtime/memory_manager/page_table.h"
|
|
|
|
|
2019-02-27 18:39:32 +08:00
|
|
|
#include "command_stream_receiver_simulated_hw.h"
|
|
|
|
|
2019-04-18 18:37:57 +08:00
|
|
|
#include <set>
|
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
namespace NEO {
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2019-10-03 04:42:40 +08:00
|
|
|
class AubSubCaptureManager;
|
2018-11-02 13:28:20 +08:00
|
|
|
class TbxStream;
|
|
|
|
|
2017-12-21 07:45:38 +08:00
|
|
|
class TbxMemoryManager : public OsAgnosticMemoryManager {
|
|
|
|
public:
|
2019-03-15 17:22:35 +08:00
|
|
|
TbxMemoryManager(ExecutionEnvironment &executionEnvironment) : OsAgnosticMemoryManager(executionEnvironment) {}
|
2020-01-07 14:42:40 +08:00
|
|
|
uint64_t getSystemSharedMemory(uint32_t rootDeviceIndex) override {
|
2017-12-21 07:45:38 +08:00
|
|
|
return 1 * GB;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template <typename GfxFamily>
|
2018-09-26 04:47:03 +08:00
|
|
|
class TbxCommandStreamReceiverHw : public CommandStreamReceiverSimulatedHw<GfxFamily> {
|
2018-12-03 17:05:36 +08:00
|
|
|
protected:
|
2018-09-26 04:47:03 +08:00
|
|
|
typedef CommandStreamReceiverSimulatedHw<GfxFamily> BaseClass;
|
2018-12-19 20:11:16 +08:00
|
|
|
using AUB = typename AUBFamilyMapper<GfxFamily>::AUB;
|
2019-02-06 20:32:49 +08:00
|
|
|
using BaseClass::getParametersForWriteMemory;
|
2018-11-26 21:04:52 +08:00
|
|
|
using BaseClass::osContext;
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2019-02-05 21:53:38 +08:00
|
|
|
uint32_t getMaskAndValueForPollForCompletion() const;
|
|
|
|
bool getpollNotEqualValueForPollForCompletion() const;
|
|
|
|
|
2017-12-21 07:45:38 +08:00
|
|
|
public:
|
2018-11-02 13:28:20 +08:00
|
|
|
using CommandStreamReceiverSimulatedCommonHw<GfxFamily>::initAdditionalMMIO;
|
2019-01-07 21:50:54 +08:00
|
|
|
using CommandStreamReceiverSimulatedCommonHw<GfxFamily>::aubManager;
|
2019-02-07 20:21:58 +08:00
|
|
|
using CommandStreamReceiverSimulatedCommonHw<GfxFamily>::hardwareContextController;
|
2019-03-20 15:55:02 +08:00
|
|
|
using CommandStreamReceiverSimulatedCommonHw<GfxFamily>::engineInfo;
|
2018-11-02 13:28:20 +08:00
|
|
|
using CommandStreamReceiverSimulatedCommonHw<GfxFamily>::stream;
|
|
|
|
|
2019-11-24 21:50:41 +08:00
|
|
|
bool flush(BatchBuffer &batchBuffer, ResidencyContainer &allocationsForResidency) override;
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2019-04-18 18:37:57 +08:00
|
|
|
void waitForTaskCountWithKmdNotifyFallback(uint32_t taskCountToWait, FlushStamp flushStampToWait, bool useQuickKmdSleep, bool forcePowerSavingMode) override;
|
2019-12-13 23:46:52 +08:00
|
|
|
void downloadAllocation(GraphicsAllocation &gfxAllocation) override;
|
2019-04-18 18:37:57 +08:00
|
|
|
|
|
|
|
void processEviction() override;
|
2019-09-05 17:02:40 +08:00
|
|
|
void processResidency(const ResidencyContainer &allocationsForResidency) override;
|
2019-02-15 18:31:47 +08:00
|
|
|
void writeMemory(uint64_t gpuAddress, void *cpuAddress, size_t size, uint32_t memoryBank, uint64_t entryBits) override;
|
2019-02-11 16:04:16 +08:00
|
|
|
bool writeMemory(GraphicsAllocation &gfxAllocation) override;
|
2018-03-06 05:16:21 +08:00
|
|
|
|
2019-10-03 04:42:40 +08:00
|
|
|
AubSubCaptureStatus checkAndActivateAubSubCapture(const MultiDispatchInfo &dispatchInfo) override;
|
|
|
|
|
2017-12-21 07:45:38 +08:00
|
|
|
// Family specific version
|
2019-10-17 17:32:55 +08:00
|
|
|
MOCKABLE_VIRTUAL void submitBatchBuffer(uint64_t batchBufferGpuAddress, const void *batchBuffer, size_t batchBufferSize, uint32_t memoryBank, uint64_t entryBits, bool overrideRingHead);
|
2019-02-11 16:04:16 +08:00
|
|
|
void pollForCompletion() override;
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2019-10-29 15:01:53 +08:00
|
|
|
static CommandStreamReceiver *create(const std::string &baseName, bool withAubDump, ExecutionEnvironment &executionEnvironment, uint32_t rootDeviceIndex);
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2019-10-29 15:01:53 +08:00
|
|
|
TbxCommandStreamReceiverHw(ExecutionEnvironment &executionEnvironment, uint32_t rootDeviceIndex);
|
2017-12-21 07:45:38 +08:00
|
|
|
~TbxCommandStreamReceiverHw() override;
|
|
|
|
|
2019-01-29 18:48:54 +08:00
|
|
|
void initializeEngine();
|
2018-12-19 20:15:14 +08:00
|
|
|
|
2017-12-21 07:45:38 +08:00
|
|
|
TbxMemoryManager *getMemoryManager() {
|
|
|
|
return (TbxMemoryManager *)CommandStreamReceiver::getMemoryManager();
|
|
|
|
}
|
|
|
|
|
2018-11-02 13:28:20 +08:00
|
|
|
TbxStream tbxStream;
|
2019-10-03 04:42:40 +08:00
|
|
|
std::unique_ptr<AubSubCaptureManager> subCaptureManager;
|
2018-06-06 23:03:46 +08:00
|
|
|
uint32_t aubDeviceId;
|
2018-07-03 23:56:55 +08:00
|
|
|
bool streamInitialized = false;
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2018-09-21 04:54:19 +08:00
|
|
|
std::unique_ptr<PhysicalAddressAllocator> physicalAddressAllocator;
|
2018-09-27 21:08:57 +08:00
|
|
|
std::unique_ptr<std::conditional<is64bit, PML4, PDPE>::type> ppgtt;
|
2018-09-11 20:45:43 +08:00
|
|
|
std::unique_ptr<PDPE> ggtt;
|
2017-12-21 07:45:38 +08:00
|
|
|
// remap CPU VA -> GGTT VA
|
|
|
|
AddressMapper gttRemap;
|
2018-06-06 16:34:51 +08:00
|
|
|
|
2019-04-18 18:37:57 +08:00
|
|
|
std::set<GraphicsAllocation *> allocationsForDownload = {};
|
|
|
|
|
2018-06-06 16:34:51 +08:00
|
|
|
CommandStreamReceiverType getType() override {
|
|
|
|
return CommandStreamReceiverType::CSR_TBX;
|
|
|
|
}
|
2019-10-03 04:42:40 +08:00
|
|
|
|
|
|
|
bool dumpTbxNonWritable = false;
|
2017-12-21 07:45:38 +08:00
|
|
|
};
|
2019-03-26 18:59:46 +08:00
|
|
|
} // namespace NEO
|