1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
|
/*
* Copyright (C) 2018-2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/helpers/timestamp_packet.h"
#include "shared/source/command_stream/command_stream_receiver.h"
#include "shared/source/command_stream/linear_stream.h"
#include "shared/source/utilities/tag_allocator.h"
using namespace NEO;
void TimestampPacketContainer::add(TagNodeBase *timestampPacketNode) {
timestampPacketNodes.push_back(timestampPacketNode);
}
TimestampPacketContainer::~TimestampPacketContainer() {
for (auto node : timestampPacketNodes) {
node->returnTag();
}
}
void TimestampPacketContainer::swapNodes(TimestampPacketContainer ×tampPacketContainer) {
timestampPacketNodes.swap(timestampPacketContainer.timestampPacketNodes);
}
void TimestampPacketContainer::assignAndIncrementNodesRefCounts(const TimestampPacketContainer &inputTimestampPacketContainer) {
auto &inputNodes = inputTimestampPacketContainer.peekNodes();
std::copy(inputNodes.begin(), inputNodes.end(), std::back_inserter(timestampPacketNodes));
for (auto node : inputNodes) {
node->incRefCount();
}
}
void TimestampPacketContainer::makeResident(CommandStreamReceiver &commandStreamReceiver) {
for (auto node : timestampPacketNodes) {
commandStreamReceiver.makeResident(*node->getBaseGraphicsAllocation());
}
}
void TimestampPacketContainer::moveNodesToNewContainer(TimestampPacketContainer ×tampPacketContainer) {
TimestampPacketContainer tempContainer;
swapNodes(tempContainer);
timestampPacketContainer.assignAndIncrementNodesRefCounts(tempContainer);
}
void TimestampPacketDependencies::moveNodesToNewContainer(TimestampPacketContainer ×tampPacketContainer) {
cacheFlushNodes.moveNodesToNewContainer(timestampPacketContainer);
previousEnqueueNodes.moveNodesToNewContainer(timestampPacketContainer);
barrierNodes.moveNodesToNewContainer(timestampPacketContainer);
auxToNonAuxNodes.moveNodesToNewContainer(timestampPacketContainer);
nonAuxToAuxNodes.moveNodesToNewContainer(timestampPacketContainer);
}
|