2017-12-21 07:45:38 +08:00
|
|
|
/*
|
2018-01-29 18:18:34 +08:00
|
|
|
* Copyright (c) 2017 - 2018, Intel Corporation
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
|
|
* to deal in the Software without restriction, including without limitation
|
|
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
* Software is furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be included
|
|
|
|
* in all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
|
|
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
|
|
|
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
|
|
|
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
|
|
* OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "runtime/memory_manager/graphics_allocation.h"
|
|
|
|
#include "runtime/utilities/idlist.h"
|
|
|
|
#include "runtime/utilities/stackvec.h"
|
|
|
|
#include "runtime/command_stream/linear_stream.h"
|
2018-01-29 18:18:34 +08:00
|
|
|
#include "runtime/helpers/properties_helper.h"
|
2017-12-21 07:45:38 +08:00
|
|
|
#include <vector>
|
|
|
|
namespace OCLRT {
|
|
|
|
class Event;
|
|
|
|
class FlushStampTracker;
|
2018-01-29 18:18:34 +08:00
|
|
|
|
2017-12-21 07:45:38 +08:00
|
|
|
struct BatchBuffer {
|
|
|
|
BatchBuffer(GraphicsAllocation *commandBufferAllocation,
|
|
|
|
size_t startOffset,
|
|
|
|
bool requiresCoherency,
|
|
|
|
bool lowPriority,
|
2018-01-29 18:18:34 +08:00
|
|
|
QueueThrottle throttle,
|
2017-12-21 07:45:38 +08:00
|
|
|
size_t usedSize,
|
|
|
|
LinearStream *stream);
|
|
|
|
BatchBuffer() {}
|
|
|
|
GraphicsAllocation *commandBufferAllocation = nullptr;
|
|
|
|
size_t startOffset = 0u;
|
|
|
|
bool requiresCoherency = false;
|
|
|
|
bool low_priority = false;
|
2018-01-29 18:18:34 +08:00
|
|
|
QueueThrottle throttle = QueueThrottle::MEDIUM;
|
2017-12-21 07:45:38 +08:00
|
|
|
size_t usedSize = 0u;
|
|
|
|
|
|
|
|
//only used in drm csr in gem close worker active mode
|
|
|
|
LinearStream *stream = nullptr;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct CommandBuffer : public IDNode<CommandBuffer> {
|
|
|
|
CommandBuffer();
|
|
|
|
ResidencyContainer surfaces;
|
|
|
|
BatchBuffer batchBuffer;
|
|
|
|
void *batchBufferEndLocation = nullptr;
|
|
|
|
uint32_t inspectionId = 0;
|
|
|
|
uint32_t taskCount = 0u;
|
2018-02-15 15:29:57 +08:00
|
|
|
void *pipeControlThatMayBeErasedLocation = nullptr;
|
|
|
|
void *epiloguePipeControlLocation = nullptr;
|
2017-12-21 07:45:38 +08:00
|
|
|
std::unique_ptr<FlushStampTracker> flushStamp;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct CommandBufferList : public IDList<CommandBuffer, false, true, false> {};
|
|
|
|
|
|
|
|
using ResourcePackage = StackVec<GraphicsAllocation *, 128>;
|
|
|
|
|
|
|
|
class SubmissionAggregator {
|
|
|
|
public:
|
|
|
|
void recordCommandBuffer(CommandBuffer *commandBuffer);
|
|
|
|
void aggregateCommandBuffers(ResourcePackage &resourcePackage, size_t &totalUsedSize, size_t totalMemoryBudget);
|
|
|
|
CommandBufferList &peekCmdBufferList() { return cmdBuffers; }
|
|
|
|
|
|
|
|
protected:
|
|
|
|
CommandBufferList cmdBuffers;
|
|
|
|
uint32_t inspectionId = 1;
|
|
|
|
};
|
|
|
|
} // namespace OCLRT
|