compute-runtime/runtime/helpers/blit_commands_helper.h

78 lines
3.6 KiB
C
Raw Normal View History

/*
* Copyright (C) 2019-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include "core/command_stream/csr_deps.h"
#include "core/memory_manager/memory_constants.h"
#include "core/utilities/stackvec.h"
#include "runtime/helpers/properties_helper.h"
#include <cstdint>
namespace NEO {
struct BuiltinOpParams;
class Context;
class CommandStreamReceiver;
class GraphicsAllocation;
class LinearStream;
struct TimestampPacketStorage;
template <typename TagType>
struct TagNode;
struct BlitProperties;
struct TimestampPacketDependencies;
using BlitPropertiesContainer = StackVec<BlitProperties, 16>;
struct BlitProperties {
static BlitProperties constructPropertiesForReadWriteBuffer(BlitterConstants::BlitDirection blitDirection,
CommandStreamReceiver &commandStreamReceiver,
GraphicsAllocation *memObjAllocation,
GraphicsAllocation *preallocatedHostAllocation,
void *hostPtr, uint64_t memObjGpuVa,
uint64_t hostAllocGpuVa, size_t hostPtrOffset,
size_t copyOffset, uint64_t copySize);
static BlitProperties constructProperties(BlitterConstants::BlitDirection blitDirection,
CommandStreamReceiver &commandStreamReceiver,
const BuiltinOpParams &builtinOpParams);
static BlitProperties constructPropertiesForCopyBuffer(GraphicsAllocation *dstAllocation, GraphicsAllocation *srcAllocation,
size_t dstOffset, size_t srcOffset, uint64_t copySize);
static BlitProperties constructPropertiesForAuxTranslation(AuxTranslationDirection auxTranslationDirection,
GraphicsAllocation *allocation);
static void setupDependenciesForAuxTranslation(BlitPropertiesContainer &blitPropertiesContainer, TimestampPacketDependencies &timestampPacketDependencies,
TimestampPacketContainer &kernelTimestamps, const EventsRequest &eventsRequest,
CommandStreamReceiver &gpguCsr, CommandStreamReceiver &bcsCsr);
static BlitterConstants::BlitDirection obtainBlitDirection(uint32_t commandType);
TagNode<TimestampPacketStorage> *outputTimestampPacket = nullptr;
BlitterConstants::BlitDirection blitDirection;
CsrDependencies csrDependencies;
AuxTranslationDirection auxTranslationDirection = AuxTranslationDirection::None;
GraphicsAllocation *dstAllocation = nullptr;
GraphicsAllocation *srcAllocation = nullptr;
uint64_t dstGpuAddress = 0;
uint64_t srcGpuAddress = 0;
uint64_t copySize = 0;
size_t dstOffset = 0;
size_t srcOffset = 0;
};
template <typename GfxFamily>
struct BlitCommandsHelper {
static size_t estimateBlitCommandsSize(uint64_t copySize, const CsrDependencies &csrDependencies, bool updateTimestampPacket);
static size_t estimateBlitCommandsSize(const BlitPropertiesContainer &blitPropertiesContainer);
static void dispatchBlitCommandsForBuffer(const BlitProperties &blitProperties, LinearStream &linearStream);
static void appendBlitCommandsForBuffer(const BlitProperties &blitProperties, typename GfxFamily::XY_COPY_BLT &blitCmd);
};
} // namespace NEO