2017-12-21 07:45:38 +08:00
|
|
|
/*
|
2024-01-17 20:43:07 +08:00
|
|
|
* Copyright (C) 2018-2024 Intel Corporation
|
2018-09-18 15:11:08 +08:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2017-12-21 07:45:38 +08:00
|
|
|
#pragma once
|
2022-12-22 19:31:28 +08:00
|
|
|
#include "shared/source/command_container/cmdcontainer.h"
|
2020-02-24 05:44:01 +08:00
|
|
|
#include "shared/source/command_stream/csr_definitions.h"
|
2023-01-26 18:26:52 +08:00
|
|
|
#include "shared/source/command_stream/task_count_helper.h"
|
2022-07-01 16:15:04 +08:00
|
|
|
#include "shared/source/helpers/pipe_control_args.h"
|
2020-02-24 05:44:01 +08:00
|
|
|
#include "shared/source/utilities/idlist.h"
|
2019-02-27 18:39:32 +08:00
|
|
|
|
2017-12-21 07:45:38 +08:00
|
|
|
#include <vector>
|
2019-03-26 18:59:46 +08:00
|
|
|
namespace NEO {
|
2018-08-16 17:18:05 +08:00
|
|
|
class Device;
|
2017-12-21 07:45:38 +08:00
|
|
|
class Event;
|
|
|
|
class FlushStampTracker;
|
2018-07-14 00:50:55 +08:00
|
|
|
class GraphicsAllocation;
|
2018-01-29 18:18:34 +08:00
|
|
|
|
2017-12-21 07:45:38 +08:00
|
|
|
struct BatchBuffer {
|
|
|
|
BatchBuffer(GraphicsAllocation *commandBufferAllocation,
|
|
|
|
size_t startOffset,
|
2018-03-01 05:50:41 +08:00
|
|
|
size_t chainedBatchBufferStartOffset,
|
2022-11-19 05:02:29 +08:00
|
|
|
uint64_t taskStartAddress,
|
2018-03-01 05:50:41 +08:00
|
|
|
GraphicsAllocation *chainedBatchBuffer,
|
2017-12-21 07:45:38 +08:00
|
|
|
bool lowPriority,
|
2018-01-29 18:18:34 +08:00
|
|
|
QueueThrottle throttle,
|
2019-08-21 18:50:47 +08:00
|
|
|
uint64_t sliceCount,
|
2017-12-21 07:45:38 +08:00
|
|
|
size_t usedSize,
|
2020-01-16 00:02:47 +08:00
|
|
|
LinearStream *stream,
|
2020-11-18 21:56:18 +08:00
|
|
|
void *endCmdPtr,
|
2023-02-02 01:06:21 +08:00
|
|
|
uint32_t numCsrClients,
|
2022-11-27 04:10:32 +08:00
|
|
|
bool hasStallingCmds,
|
2023-09-20 19:04:00 +08:00
|
|
|
bool hasRelaxedOrderingDependencies,
|
|
|
|
bool dispatchMonitorFence);
|
2017-12-21 07:45:38 +08:00
|
|
|
BatchBuffer() {}
|
|
|
|
GraphicsAllocation *commandBufferAllocation = nullptr;
|
2023-11-17 21:14:41 +08:00
|
|
|
ResidencyContainer *allocationsForResidency = nullptr;
|
2017-12-21 07:45:38 +08:00
|
|
|
size_t startOffset = 0u;
|
2018-03-01 05:50:41 +08:00
|
|
|
size_t chainedBatchBufferStartOffset = 0u;
|
2022-11-19 05:02:29 +08:00
|
|
|
uint64_t taskStartAddress = 0; // if task not available, use CSR stream
|
|
|
|
|
2018-03-01 05:50:41 +08:00
|
|
|
GraphicsAllocation *chainedBatchBuffer = nullptr;
|
2024-01-19 19:11:38 +08:00
|
|
|
bool lowPriority = false;
|
|
|
|
QueueThrottle throttle = QueueThrottle::MEDIUM;
|
2019-08-21 18:50:47 +08:00
|
|
|
uint64_t sliceCount = QueueSliceCount::defaultSliceCount;
|
2017-12-21 07:45:38 +08:00
|
|
|
size_t usedSize = 0u;
|
|
|
|
|
2022-11-19 05:02:29 +08:00
|
|
|
// only used in drm csr in gem close worker active mode
|
2017-12-21 07:45:38 +08:00
|
|
|
LinearStream *stream = nullptr;
|
2020-01-16 00:02:47 +08:00
|
|
|
void *endCmdPtr = nullptr;
|
2023-02-02 01:06:21 +08:00
|
|
|
uint32_t numCsrClients = 0;
|
2020-11-18 21:56:18 +08:00
|
|
|
|
2024-01-17 20:43:07 +08:00
|
|
|
bool hasStallingCmds = false;
|
2024-01-19 19:11:38 +08:00
|
|
|
bool hasRelaxedOrderingDependencies = false;
|
2024-01-17 20:43:07 +08:00
|
|
|
bool ringBufferRestartRequest = false;
|
2024-01-19 19:11:38 +08:00
|
|
|
bool disableFlatRingBuffer = false;
|
|
|
|
bool dispatchMonitorFence = false;
|
2017-12-21 07:45:38 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct CommandBuffer : public IDNode<CommandBuffer> {
|
2018-12-04 22:11:29 +08:00
|
|
|
CommandBuffer(Device &device);
|
2023-11-24 20:20:27 +08:00
|
|
|
CommandBuffer &operator=(const CommandBuffer &) = delete;
|
|
|
|
CommandBuffer &operator=(CommandBuffer &&) = delete;
|
2023-10-20 22:34:45 +08:00
|
|
|
~CommandBuffer() override;
|
2017-12-21 07:45:38 +08:00
|
|
|
ResidencyContainer surfaces;
|
|
|
|
BatchBuffer batchBuffer;
|
|
|
|
void *batchBufferEndLocation = nullptr;
|
|
|
|
uint32_t inspectionId = 0;
|
2022-11-22 21:53:59 +08:00
|
|
|
TaskCountType taskCount = 0u;
|
2018-02-15 15:29:57 +08:00
|
|
|
void *pipeControlThatMayBeErasedLocation = nullptr;
|
|
|
|
void *epiloguePipeControlLocation = nullptr;
|
2022-07-01 16:15:04 +08:00
|
|
|
PipeControlArgs epiloguePipeControlArgs;
|
2017-12-21 07:45:38 +08:00
|
|
|
std::unique_ptr<FlushStampTracker> flushStamp;
|
2018-08-16 17:18:05 +08:00
|
|
|
Device &device;
|
2017-12-21 07:45:38 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct CommandBufferList : public IDList<CommandBuffer, false, true, false> {};
|
|
|
|
|
|
|
|
using ResourcePackage = StackVec<GraphicsAllocation *, 128>;
|
|
|
|
|
|
|
|
class SubmissionAggregator {
|
|
|
|
public:
|
|
|
|
void recordCommandBuffer(CommandBuffer *commandBuffer);
|
2018-12-04 22:11:29 +08:00
|
|
|
void aggregateCommandBuffers(ResourcePackage &resourcePackage, size_t &totalUsedSize, size_t totalMemoryBudget, uint32_t osContextId);
|
2017-12-21 07:45:38 +08:00
|
|
|
CommandBufferList &peekCmdBufferList() { return cmdBuffers; }
|
|
|
|
|
|
|
|
protected:
|
|
|
|
CommandBufferList cmdBuffers;
|
|
|
|
uint32_t inspectionId = 1;
|
|
|
|
};
|
2019-03-26 18:59:46 +08:00
|
|
|
} // namespace NEO
|