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