2017-12-21 07:45:38 +08:00
|
|
|
/*
|
2021-05-17 02:51:16 +08:00
|
|
|
* Copyright (C) 2018-2021 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
|
2020-10-15 01:22:01 +08:00
|
|
|
#include "shared/source/memory_manager/address_mapper.h"
|
2020-11-02 22:54:01 +08:00
|
|
|
#include "shared/source/memory_manager/os_agnostic_memory_manager.h"
|
2020-10-15 01:22:01 +08:00
|
|
|
|
2020-02-23 05:50:57 +08:00
|
|
|
#include "opencl/source/command_stream/tbx_command_stream_receiver.h"
|
|
|
|
#include "opencl/source/memory_manager/page_table.h"
|
|
|
|
|
2020-08-27 04:36:51 +08:00
|
|
|
#include "aub_mapper.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
|
|
|
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;
|
2020-05-06 17:52:48 +08:00
|
|
|
void flushSubmissionsAndDownloadAllocations();
|
2020-05-13 17:25:29 +08:00
|
|
|
MOCKABLE_VIRTUAL void downloadAllocation(GraphicsAllocation &gfxAllocation);
|
2019-02-05 21:53:38 +08:00
|
|
|
|
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;
|
2020-05-06 17:52:48 +08:00
|
|
|
bool waitForCompletionWithTimeout(bool enableTimeout, int64_t timeoutMicroseconds, uint32_t taskCountToWait) override;
|
2020-05-13 17:25:29 +08:00
|
|
|
void downloadAllocations() override;
|
2019-04-18 18:37:57 +08:00
|
|
|
|
|
|
|
void processEviction() override;
|
2020-02-04 00:50:53 +08:00
|
|
|
void processResidency(const ResidencyContainer &allocationsForResidency, uint32_t handleId) 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;
|
2021-02-22 20:02:08 +08:00
|
|
|
void writeMMIO(uint32_t offset, uint32_t value) override;
|
2020-04-02 03:01:39 +08:00
|
|
|
bool expectMemory(const void *gfxAddress, const void *srcAddress, size_t length, uint32_t compareOperation) 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
|
|
|
|
2020-04-15 21:30:29 +08:00
|
|
|
void dumpAllocation(GraphicsAllocation &gfxAllocation) override;
|
|
|
|
|
2020-10-29 22:33:35 +08:00
|
|
|
static CommandStreamReceiver *create(const std::string &baseName,
|
|
|
|
bool withAubDump,
|
|
|
|
ExecutionEnvironment &executionEnvironment,
|
|
|
|
uint32_t rootDeviceIndex,
|
|
|
|
const DeviceBitfield deviceBitfield);
|
|
|
|
|
|
|
|
TbxCommandStreamReceiverHw(ExecutionEnvironment &executionEnvironment,
|
|
|
|
uint32_t rootDeviceIndex,
|
|
|
|
const DeviceBitfield deviceBitfield);
|
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
|
|
|
|
2020-01-21 18:00:03 +08:00
|
|
|
MemoryManager *getMemoryManager() {
|
|
|
|
return CommandStreamReceiver::getMemoryManager();
|
2017-12-21 07:45:38 +08:00
|
|
|
}
|
|
|
|
|
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
|