2018-01-19 17:00:51 +08:00
|
|
|
/*
|
2019-01-10 16:37:56 +08:00
|
|
|
* Copyright (C) 2018-2019 Intel Corporation
|
2018-01-19 17:00:51 +08:00
|
|
|
*
|
2018-09-18 15:11:08 +08:00
|
|
|
* SPDX-License-Identifier: MIT
|
2018-01-19 17:00:51 +08:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2019-02-06 00:38:57 +08:00
|
|
|
#include "runtime/aub/aub_center.h"
|
2018-01-19 17:00:51 +08:00
|
|
|
#include "runtime/command_stream/aub_command_stream_receiver.h"
|
2019-02-27 18:39:32 +08:00
|
|
|
#include "runtime/command_stream/command_stream_receiver_with_aub_dump.h"
|
|
|
|
#include "runtime/execution_environment/execution_environment.h"
|
2018-01-19 17:00:51 +08:00
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
namespace NEO {
|
2018-01-19 17:00:51 +08:00
|
|
|
|
|
|
|
extern CommandStreamReceiverCreateFunc commandStreamReceiverFactory[2 * IGFX_MAX_CORE];
|
|
|
|
|
|
|
|
template <typename BaseCSR>
|
2019-02-27 17:06:14 +08:00
|
|
|
CommandStreamReceiverWithAUBDump<BaseCSR>::CommandStreamReceiverWithAUBDump(const std::string &baseName, ExecutionEnvironment &executionEnvironment)
|
|
|
|
: BaseCSR(executionEnvironment) {
|
2019-03-02 01:56:22 +08:00
|
|
|
bool isAubManager = executionEnvironment.aubCenter && executionEnvironment.aubCenter->getAubManager();
|
|
|
|
bool isTbxMode = CommandStreamReceiverType::CSR_TBX == BaseCSR::getType();
|
|
|
|
bool createAubCsr = (isAubManager && isTbxMode) ? false : true;
|
2019-02-06 00:38:57 +08:00
|
|
|
if (createAubCsr) {
|
2019-02-27 17:06:14 +08:00
|
|
|
aubCSR.reset(AUBCommandStreamReceiver::create(baseName, false, executionEnvironment));
|
2019-02-06 00:38:57 +08:00
|
|
|
}
|
2018-01-19 17:00:51 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
template <typename BaseCSR>
|
2018-11-26 21:04:52 +08:00
|
|
|
FlushStamp CommandStreamReceiverWithAUBDump<BaseCSR>::flush(BatchBuffer &batchBuffer, ResidencyContainer &allocationsForResidency) {
|
2018-01-19 17:00:51 +08:00
|
|
|
if (aubCSR) {
|
2018-11-26 21:04:52 +08:00
|
|
|
aubCSR->flush(batchBuffer, allocationsForResidency);
|
2019-03-18 22:23:18 +08:00
|
|
|
aubCSR->setLatestSentTaskCount(BaseCSR::peekLatestSentTaskCount());
|
2018-01-19 17:00:51 +08:00
|
|
|
}
|
2018-11-26 21:04:52 +08:00
|
|
|
FlushStamp flushStamp = BaseCSR::flush(batchBuffer, allocationsForResidency);
|
2018-01-19 17:00:51 +08:00
|
|
|
return flushStamp;
|
|
|
|
}
|
|
|
|
|
|
|
|
template <typename BaseCSR>
|
2018-09-28 01:55:09 +08:00
|
|
|
void CommandStreamReceiverWithAUBDump<BaseCSR>::makeNonResident(GraphicsAllocation &gfxAllocation) {
|
2018-12-18 21:02:08 +08:00
|
|
|
auto residencyTaskCount = gfxAllocation.getResidencyTaskCount(this->osContext->getContextId());
|
2018-09-28 01:55:09 +08:00
|
|
|
BaseCSR::makeNonResident(gfxAllocation);
|
|
|
|
if (aubCSR) {
|
2019-03-27 21:42:49 +08:00
|
|
|
gfxAllocation.updateResidencyTaskCount(residencyTaskCount, this->osContext->getContextId());
|
2018-09-28 01:55:09 +08:00
|
|
|
aubCSR->makeNonResident(gfxAllocation);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-06-13 02:33:03 +08:00
|
|
|
template <typename BaseCSR>
|
|
|
|
void CommandStreamReceiverWithAUBDump<BaseCSR>::activateAubSubCapture(const MultiDispatchInfo &dispatchInfo) {
|
|
|
|
BaseCSR::activateAubSubCapture(dispatchInfo);
|
|
|
|
if (aubCSR) {
|
|
|
|
aubCSR->activateAubSubCapture(dispatchInfo);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-11-28 20:00:53 +08:00
|
|
|
template <typename BaseCSR>
|
2019-01-10 16:37:56 +08:00
|
|
|
void CommandStreamReceiverWithAUBDump<BaseCSR>::setupContext(OsContext &osContext) {
|
|
|
|
BaseCSR::setupContext(osContext);
|
2018-11-28 20:00:53 +08:00
|
|
|
if (aubCSR) {
|
2019-01-10 16:37:56 +08:00
|
|
|
aubCSR->setupContext(osContext);
|
2018-11-28 20:00:53 +08:00
|
|
|
}
|
|
|
|
}
|
2019-03-26 18:59:46 +08:00
|
|
|
} // namespace NEO
|