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