2018-10-02 14:37:30 -07:00
|
|
|
/*
|
2024-05-09 11:17:06 +00:00
|
|
|
* Copyright (C) 2018-2024 Intel Corporation
|
2018-10-02 14:37:30 -07:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
2020-02-23 22:44:01 +01:00
|
|
|
#include "shared/source/helpers/timestamp_packet.h"
|
2019-02-27 11:39:32 +01:00
|
|
|
|
2020-02-23 22:44:01 +01:00
|
|
|
#include "shared/source/command_stream/command_stream_receiver.h"
|
|
|
|
|
#include "shared/source/command_stream/linear_stream.h"
|
|
|
|
|
#include "shared/source/utilities/tag_allocator.h"
|
2018-10-02 14:37:30 -07:00
|
|
|
|
2023-01-17 17:04:14 +00:00
|
|
|
#include <iterator>
|
|
|
|
|
|
2019-03-26 11:59:46 +01:00
|
|
|
using namespace NEO;
|
2018-10-02 14:37:30 -07:00
|
|
|
|
2021-03-24 18:21:13 +00:00
|
|
|
void TimestampPacketContainer::add(TagNodeBase *timestampPacketNode) {
|
2018-10-02 14:37:30 -07:00
|
|
|
timestampPacketNodes.push_back(timestampPacketNode);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TimestampPacketContainer::~TimestampPacketContainer() {
|
2018-11-27 13:07:41 +01:00
|
|
|
for (auto node : timestampPacketNodes) {
|
|
|
|
|
node->returnTag();
|
2018-10-02 14:37:30 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TimestampPacketContainer::swapNodes(TimestampPacketContainer ×tampPacketContainer) {
|
|
|
|
|
timestampPacketNodes.swap(timestampPacketContainer.timestampPacketNodes);
|
|
|
|
|
}
|
|
|
|
|
|
2018-11-27 13:07:41 +01:00
|
|
|
void TimestampPacketContainer::assignAndIncrementNodesRefCounts(const TimestampPacketContainer &inputTimestampPacketContainer) {
|
2018-10-05 12:51:57 -07:00
|
|
|
auto &inputNodes = inputTimestampPacketContainer.peekNodes();
|
|
|
|
|
std::copy(inputNodes.begin(), inputNodes.end(), std::back_inserter(timestampPacketNodes));
|
|
|
|
|
|
2018-11-27 13:07:41 +01:00
|
|
|
for (auto node : inputNodes) {
|
2018-10-02 14:37:30 -07:00
|
|
|
node->incRefCount();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TimestampPacketContainer::makeResident(CommandStreamReceiver &commandStreamReceiver) {
|
2018-11-27 13:07:41 +01:00
|
|
|
for (auto node : timestampPacketNodes) {
|
2019-02-08 10:27:48 +01:00
|
|
|
commandStreamReceiver.makeResident(*node->getBaseGraphicsAllocation());
|
2018-10-02 14:37:30 -07:00
|
|
|
}
|
|
|
|
|
}
|
2021-06-21 17:39:40 +00:00
|
|
|
|
2021-06-23 11:04:10 +00:00
|
|
|
void TimestampPacketContainer::moveNodesToNewContainer(TimestampPacketContainer ×tampPacketContainer) {
|
|
|
|
|
TimestampPacketContainer tempContainer;
|
|
|
|
|
swapNodes(tempContainer);
|
|
|
|
|
|
|
|
|
|
timestampPacketContainer.assignAndIncrementNodesRefCounts(tempContainer);
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-24 15:23:48 +00:00
|
|
|
void TimestampPacketContainer::releaseNodes() {
|
|
|
|
|
for (auto node : timestampPacketNodes) {
|
|
|
|
|
node->returnTag();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
timestampPacketNodes.clear();
|
|
|
|
|
}
|
|
|
|
|
|
2021-06-21 17:39:40 +00:00
|
|
|
void TimestampPacketDependencies::moveNodesToNewContainer(TimestampPacketContainer ×tampPacketContainer) {
|
2021-06-23 11:04:10 +00:00
|
|
|
cacheFlushNodes.moveNodesToNewContainer(timestampPacketContainer);
|
|
|
|
|
previousEnqueueNodes.moveNodesToNewContainer(timestampPacketContainer);
|
|
|
|
|
barrierNodes.moveNodesToNewContainer(timestampPacketContainer);
|
|
|
|
|
auxToNonAuxNodes.moveNodesToNewContainer(timestampPacketContainer);
|
|
|
|
|
nonAuxToAuxNodes.moveNodesToNewContainer(timestampPacketContainer);
|
2024-05-09 11:17:06 +00:00
|
|
|
multiCsrDependencies.moveNodesToNewContainer(timestampPacketContainer);
|
2021-06-21 17:39:40 +00:00
|
|
|
}
|