Add move logic to TimestampPacketContainer

Change-Id: Ib666fd57b4ca9123e324a82c3e648b0da49abffc
Signed-off-by: Dunajski, Bartosz <bartosz.dunajski@intel.com>
This commit is contained in:
Dunajski, Bartosz
2019-11-12 08:31:46 +01:00
parent 50f9674d79
commit af8ce96ab4
10 changed files with 63 additions and 12 deletions

View File

@@ -344,7 +344,7 @@ class CommandQueueHw : public CommandQueue {
Surface **surfacesForResidency,
size_t surfacesCount,
const MultiDispatchInfo &multiDispatchInfo,
TimestampPacketContainer *previousTimestampPacketNodes,
TimestampPacketContainer &previousTimestampPacketNodes,
TimestampPacketContainer &barrierTimestampPacketNode,
std::unique_ptr<KernelOperation> &blockedCommandsData,
const EnqueueProperties &enqueueProperties,

View File

@@ -345,7 +345,7 @@ void CommandQueueHw<GfxFamily>::enqueueHandler(Surface **surfacesForResidency,
surfacesForResidency,
numSurfaceForResidency,
multiDispatchInfo,
&previousTimestampPacketNodes,
previousTimestampPacketNodes,
barrierTimestampPacketNode,
blockedCommandsData,
enqueueProperties,
@@ -740,7 +740,7 @@ void CommandQueueHw<GfxFamily>::enqueueBlocked(
Surface **surfaces,
size_t surfaceCount,
const MultiDispatchInfo &multiDispatchInfo,
TimestampPacketContainer *previousTimestampPacketNodes,
TimestampPacketContainer &previousTimestampPacketNodes,
TimestampPacketContainer &barrierTimestampPacketNode,
std::unique_ptr<KernelOperation> &blockedCommandsData,
const EnqueueProperties &enqueueProperties,
@@ -820,7 +820,8 @@ void CommandQueueHw<GfxFamily>::enqueueBlocked(
auto event = castToObjectOrAbort<Event>(eventsRequest.eventWaitList[i]);
event->incRefInternal();
}
command->setTimestampPacketNode(*timestampPacketContainer, *previousTimestampPacketNodes, barrierTimestampPacketNode);
command->setTimestampPacketNode(*timestampPacketContainer, std::move(previousTimestampPacketNodes),
std::move(barrierTimestampPacketNode));
command->setEventsRequest(eventsRequest);
}
outEvent->setCommand(std::move(command));

View File

@@ -341,15 +341,15 @@ void Command::setEventsRequest(EventsRequest &eventsRequest) {
}
}
void Command::setTimestampPacketNode(TimestampPacketContainer &current, TimestampPacketContainer &previous, TimestampPacketContainer &barrier) {
void Command::setTimestampPacketNode(TimestampPacketContainer &current, TimestampPacketContainer &&previous, TimestampPacketContainer &&barrier) {
currentTimestampPacketNodes = std::make_unique<TimestampPacketContainer>();
currentTimestampPacketNodes->assignAndIncrementNodesRefCounts(current);
previousTimestampPacketNodes = std::make_unique<TimestampPacketContainer>();
previousTimestampPacketNodes->assignAndIncrementNodesRefCounts(previous);
*previousTimestampPacketNodes = std::move(previous);
barrierTimestampPacketNodes = std::make_unique<TimestampPacketContainer>();
barrierTimestampPacketNodes->assignAndIncrementNodesRefCounts(barrier);
*barrierTimestampPacketNodes = std::move(barrier);
}
Command::~Command() {

View File

@@ -94,7 +94,7 @@ class Command : public IFNode<Command> {
virtual LinearStream *getCommandStream() {
return nullptr;
}
void setTimestampPacketNode(TimestampPacketContainer &current, TimestampPacketContainer &previous, TimestampPacketContainer &barrier);
void setTimestampPacketNode(TimestampPacketContainer &current, TimestampPacketContainer &&previous, TimestampPacketContainer &&barrier);
void setEventsRequest(EventsRequest &eventsRequest);
void makeTimestampPacketsResident(CommandStreamReceiver &commandStreamReceiver);

View File

@@ -71,10 +71,12 @@ struct TimestampPacketStorage {
static_assert(((4 * TimestampPacketSizeControl::preferredPacketCount + 1) * sizeof(uint32_t)) == sizeof(TimestampPacketStorage),
"This structure is consumed by GPU and has to follow specific restrictions for padding and size");
class TimestampPacketContainer : public NonCopyableOrMovableClass {
class TimestampPacketContainer : public NonCopyableClass {
public:
using Node = TagNode<TimestampPacketStorage>;
TimestampPacketContainer() = default;
TimestampPacketContainer(TimestampPacketContainer &&) = default;
TimestampPacketContainer &operator=(TimestampPacketContainer &&) = default;
MOCKABLE_VIRTUAL ~TimestampPacketContainer();
const std::vector<Node *> &peekNodes() const { return timestampPacketNodes; }

View File

@@ -32,7 +32,7 @@ struct TagNode : public IDNode<TagNode<TagType>> {
void incRefCount() { refCount++; }
void returnTag() {
MOCKABLE_VIRTUAL void returnTag() {
allocator->returnTag(this);
}