/* * Copyright (C) 2017-2019 Intel Corporation * * SPDX-License-Identifier: MIT * */ #pragma once #include "core/command_stream/linear_stream.h" #include "core/utilities/idlist.h" #include "core/utilities/stackvec.h" #include "runtime/command_stream/csr_definitions.h" #include "runtime/helpers/properties_helper.h" #include "runtime/memory_manager/residency_container.h" #include namespace NEO { class Device; class Event; class FlushStampTracker; class GraphicsAllocation; struct BatchBuffer { BatchBuffer(GraphicsAllocation *commandBufferAllocation, size_t startOffset, size_t chainedBatchBufferStartOffset, GraphicsAllocation *chainedBatchBuffer, bool requiresCoherency, bool lowPriority, QueueThrottle throttle, uint64_t sliceCount, size_t usedSize, LinearStream *stream); BatchBuffer() {} GraphicsAllocation *commandBufferAllocation = nullptr; size_t startOffset = 0u; size_t chainedBatchBufferStartOffset = 0u; GraphicsAllocation *chainedBatchBuffer = nullptr; bool requiresCoherency = false; bool low_priority = false; QueueThrottle throttle = QueueThrottle::MEDIUM; uint64_t sliceCount = QueueSliceCount::defaultSliceCount; size_t usedSize = 0u; //only used in drm csr in gem close worker active mode LinearStream *stream = nullptr; }; struct CommandBuffer : public IDNode { CommandBuffer(Device &device); ResidencyContainer surfaces; BatchBuffer batchBuffer; void *batchBufferEndLocation = nullptr; uint32_t inspectionId = 0; uint32_t taskCount = 0u; void *pipeControlThatMayBeErasedLocation = nullptr; void *epiloguePipeControlLocation = nullptr; std::unique_ptr flushStamp; Device &device; }; struct CommandBufferList : public IDList {}; using ResourcePackage = StackVec; class SubmissionAggregator { public: void recordCommandBuffer(CommandBuffer *commandBuffer); void aggregateCommandBuffers(ResourcePackage &resourcePackage, size_t &totalUsedSize, size_t totalMemoryBudget, uint32_t osContextId); CommandBufferList &peekCmdBufferList() { return cmdBuffers; } protected: CommandBufferList cmdBuffers; uint32_t inspectionId = 1; }; } // namespace NEO