2019-04-03 21:59:31 +08:00
|
|
|
/*
|
2020-01-22 23:22:30 +08:00
|
|
|
* Copyright (C) 2019-2020 Intel Corporation
|
2019-04-03 21:59:31 +08:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
2020-02-24 05:44:01 +08:00
|
|
|
#include "shared/source/command_stream/csr_deps.h"
|
|
|
|
#include "shared/source/helpers/aux_translation.h"
|
2020-04-02 17:28:38 +08:00
|
|
|
#include "shared/source/helpers/constants.h"
|
2020-02-25 16:55:13 +08:00
|
|
|
#include "shared/source/helpers/vec.h"
|
2020-02-24 05:44:01 +08:00
|
|
|
#include "shared/source/utilities/stackvec.h"
|
2019-06-26 17:37:46 +08:00
|
|
|
|
2019-04-03 21:59:31 +08:00
|
|
|
#include <cstdint>
|
|
|
|
|
|
|
|
namespace NEO {
|
2019-06-27 22:08:20 +08:00
|
|
|
class CommandStreamReceiver;
|
2019-04-03 21:59:31 +08:00
|
|
|
class GraphicsAllocation;
|
|
|
|
class LinearStream;
|
2019-11-13 00:56:10 +08:00
|
|
|
struct TimestampPacketStorage;
|
2020-02-10 21:17:12 +08:00
|
|
|
struct RootDeviceEnvironment;
|
2019-11-13 00:56:10 +08:00
|
|
|
|
|
|
|
template <typename TagType>
|
|
|
|
struct TagNode;
|
2019-06-26 17:37:46 +08:00
|
|
|
|
2019-11-18 20:35:44 +08:00
|
|
|
struct BlitProperties;
|
2020-02-11 01:14:52 +08:00
|
|
|
struct HardwareInfo;
|
2019-11-18 20:35:44 +08:00
|
|
|
struct TimestampPacketDependencies;
|
2019-11-25 16:11:37 +08:00
|
|
|
using BlitPropertiesContainer = StackVec<BlitProperties, 16>;
|
2019-11-18 20:35:44 +08:00
|
|
|
|
2019-06-26 17:37:46 +08:00
|
|
|
struct BlitProperties {
|
2019-07-01 17:08:58 +08:00
|
|
|
static BlitProperties constructPropertiesForReadWriteBuffer(BlitterConstants::BlitDirection blitDirection,
|
2019-06-27 22:08:20 +08:00
|
|
|
CommandStreamReceiver &commandStreamReceiver,
|
2019-12-12 17:47:28 +08:00
|
|
|
GraphicsAllocation *memObjAllocation,
|
|
|
|
GraphicsAllocation *preallocatedHostAllocation,
|
|
|
|
void *hostPtr, uint64_t memObjGpuVa,
|
2020-02-25 16:55:13 +08:00
|
|
|
uint64_t hostAllocGpuVa, Vec3<size_t> hostPtrOffset,
|
|
|
|
Vec3<size_t> copyOffset, Vec3<size_t> copySize,
|
|
|
|
size_t hostRowPitch, size_t hostSlicePitch,
|
|
|
|
size_t gpuRowPitch, size_t gpuSlicePitch);
|
2019-06-26 17:37:46 +08:00
|
|
|
|
2019-07-01 17:08:58 +08:00
|
|
|
static BlitProperties constructPropertiesForCopyBuffer(GraphicsAllocation *dstAllocation, GraphicsAllocation *srcAllocation,
|
2020-04-02 17:47:30 +08:00
|
|
|
Vec3<size_t> dstOffset, Vec3<size_t> srcOffset, Vec3<size_t> copySize,
|
|
|
|
size_t srcRowPitch, size_t srcSlicePitch,
|
|
|
|
size_t dstRowPitch, size_t dstSlicePitch);
|
2019-07-01 17:08:58 +08:00
|
|
|
|
2019-07-04 20:22:28 +08:00
|
|
|
static BlitProperties constructPropertiesForAuxTranslation(AuxTranslationDirection auxTranslationDirection,
|
|
|
|
GraphicsAllocation *allocation);
|
|
|
|
|
2019-11-18 20:35:44 +08:00
|
|
|
static void setupDependenciesForAuxTranslation(BlitPropertiesContainer &blitPropertiesContainer, TimestampPacketDependencies ×tampPacketDependencies,
|
2020-01-27 20:06:03 +08:00
|
|
|
TimestampPacketContainer &kernelTimestamps, const CsrDependencies &depsFromEvents,
|
2019-11-18 20:35:44 +08:00
|
|
|
CommandStreamReceiver &gpguCsr, CommandStreamReceiver &bcsCsr);
|
|
|
|
|
2019-11-13 00:56:10 +08:00
|
|
|
TagNode<TimestampPacketStorage> *outputTimestampPacket = nullptr;
|
2019-07-01 17:08:58 +08:00
|
|
|
BlitterConstants::BlitDirection blitDirection;
|
2019-06-26 17:37:46 +08:00
|
|
|
CsrDependencies csrDependencies;
|
2019-07-04 20:22:28 +08:00
|
|
|
AuxTranslationDirection auxTranslationDirection = AuxTranslationDirection::None;
|
2019-06-26 17:37:46 +08:00
|
|
|
|
2019-06-27 22:08:20 +08:00
|
|
|
GraphicsAllocation *dstAllocation = nullptr;
|
|
|
|
GraphicsAllocation *srcAllocation = nullptr;
|
2019-12-12 17:47:28 +08:00
|
|
|
uint64_t dstGpuAddress = 0;
|
|
|
|
uint64_t srcGpuAddress = 0;
|
2020-02-25 16:55:13 +08:00
|
|
|
|
|
|
|
Vec3<size_t> copySize = 0;
|
|
|
|
Vec3<size_t> dstOffset = 0;
|
|
|
|
Vec3<size_t> srcOffset = 0;
|
|
|
|
|
|
|
|
size_t dstRowPitch = 0;
|
|
|
|
size_t dstSlicePitch = 0;
|
|
|
|
size_t srcRowPitch = 0;
|
|
|
|
size_t srcSlicePitch = 0;
|
2019-06-26 17:37:46 +08:00
|
|
|
};
|
2019-04-03 21:59:31 +08:00
|
|
|
|
|
|
|
template <typename GfxFamily>
|
|
|
|
struct BlitCommandsHelper {
|
2020-02-25 16:55:13 +08:00
|
|
|
static size_t estimateBlitCommandsSize(Vec3<size_t> copySize, const CsrDependencies &csrDependencies, bool updateTimestampPacket);
|
2020-02-11 01:14:52 +08:00
|
|
|
static size_t estimateBlitCommandsSize(const BlitPropertiesContainer &blitPropertiesContainer, const HardwareInfo &hwInfo);
|
2020-02-25 16:55:13 +08:00
|
|
|
static uint64_t calculateBlitCommandDestinationBaseAddress(const BlitProperties &blitProperties, uint64_t offset, uint64_t row, uint64_t slice);
|
|
|
|
static uint64_t calculateBlitCommandSourceBaseAddress(const BlitProperties &blitProperties, uint64_t offset, uint64_t row, uint64_t slice);
|
2020-02-10 21:17:12 +08:00
|
|
|
static void dispatchBlitCommandsForBuffer(const BlitProperties &blitProperties, LinearStream &linearStream, const RootDeviceEnvironment &rootDeviceEnvironment);
|
|
|
|
static void appendBlitCommandsForBuffer(const BlitProperties &blitProperties, typename GfxFamily::XY_COPY_BLT &blitCmd, const RootDeviceEnvironment &rootDeviceEnvironment);
|
2019-04-03 21:59:31 +08:00
|
|
|
};
|
|
|
|
} // namespace NEO
|