2019-05-16 11:43:29 +02:00
|
|
|
/*
|
2021-01-05 17:00:12 +00:00
|
|
|
* Copyright (C) 2018-2021 Intel Corporation
|
2019-05-16 11:43:29 +02:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
2020-02-23 22:44:01 +01:00
|
|
|
#include "shared/source/helpers/flat_batch_buffer_helper.h"
|
|
|
|
|
#include "shared/source/helpers/hw_helper.h"
|
|
|
|
|
#include "shared/source/helpers/preamble_base.inl"
|
2019-05-16 11:43:29 +02:00
|
|
|
|
2020-11-17 11:42:29 +01:00
|
|
|
#include "opencl/source/kernel/kernel_execution_type.h"
|
|
|
|
|
|
2019-05-16 11:43:29 +02:00
|
|
|
namespace NEO {
|
|
|
|
|
|
|
|
|
|
template <typename GfxFamily>
|
|
|
|
|
void PreambleHelper<GfxFamily>::programL3(LinearStream *pCommandStream, uint32_t l3Config) {
|
2020-10-06 10:58:18 +02:00
|
|
|
LriHelper<GfxFamily>::program(pCommandStream,
|
|
|
|
|
L3CNTLRegisterOffset<GfxFamily>::registerOffset,
|
|
|
|
|
l3Config,
|
|
|
|
|
false);
|
2019-05-16 11:43:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <typename GfxFamily>
|
|
|
|
|
uint32_t PreambleHelper<GfxFamily>::getUrbEntryAllocationSize() {
|
|
|
|
|
return 0x782;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <typename GfxFamily>
|
2019-08-13 11:34:56 +02:00
|
|
|
uint64_t PreambleHelper<GfxFamily>::programVFEState(LinearStream *pCommandStream,
|
|
|
|
|
const HardwareInfo &hwInfo,
|
2020-10-06 11:54:04 +02:00
|
|
|
uint32_t scratchSize,
|
2019-08-13 11:34:56 +02:00
|
|
|
uint64_t scratchAddress,
|
2020-02-06 16:06:00 +01:00
|
|
|
uint32_t maxFrontEndThreads,
|
2020-09-02 11:38:54 +02:00
|
|
|
aub_stream::EngineType engineType,
|
2020-11-17 11:42:29 +01:00
|
|
|
uint32_t additionalExecInfo,
|
|
|
|
|
KernelExecutionType kernelExecutionType) {
|
2019-05-16 17:17:53 +02:00
|
|
|
using MEDIA_VFE_STATE = typename GfxFamily::MEDIA_VFE_STATE;
|
2019-05-16 11:43:29 +02:00
|
|
|
|
2020-02-06 16:06:00 +01:00
|
|
|
addPipeControlBeforeVfeCmd(pCommandStream, &hwInfo, engineType);
|
2019-05-16 11:43:29 +02:00
|
|
|
|
2019-08-13 11:34:56 +02:00
|
|
|
auto scratchSpaceAddressOffset = static_cast<uint64_t>(pCommandStream->getUsed() + MEDIA_VFE_STATE::PATCH_CONSTANTS::SCRATCHSPACEBASEPOINTER_BYTEOFFSET);
|
2020-04-08 18:33:03 +02:00
|
|
|
auto pMediaVfeState = pCommandStream->getSpaceForCmd<MEDIA_VFE_STATE>();
|
|
|
|
|
MEDIA_VFE_STATE cmd = GfxFamily::cmdInitMediaVfeState;
|
|
|
|
|
cmd.setMaximumNumberOfThreads(maxFrontEndThreads);
|
|
|
|
|
cmd.setNumberOfUrbEntries(1);
|
|
|
|
|
cmd.setUrbEntryAllocationSize(PreambleHelper<GfxFamily>::getUrbEntryAllocationSize());
|
2020-10-06 11:54:04 +02:00
|
|
|
cmd.setPerThreadScratchSpace(PreambleHelper<GfxFamily>::getScratchSizeValueToProgramMediaVfeState(scratchSize));
|
|
|
|
|
cmd.setStackSize(PreambleHelper<GfxFamily>::getScratchSizeValueToProgramMediaVfeState(scratchSize));
|
2019-05-16 17:17:53 +02:00
|
|
|
uint32_t lowAddress = static_cast<uint32_t>(0xFFFFFFFF & scratchAddress);
|
|
|
|
|
uint32_t highAddress = static_cast<uint32_t>(0xFFFFFFFF & (scratchAddress >> 32));
|
2020-04-08 18:33:03 +02:00
|
|
|
cmd.setScratchSpaceBasePointer(lowAddress);
|
|
|
|
|
cmd.setScratchSpaceBasePointerHigh(highAddress);
|
2019-08-13 11:34:56 +02:00
|
|
|
|
2020-04-08 18:33:03 +02:00
|
|
|
programAdditionalFieldsInVfeState(&cmd, hwInfo);
|
2021-01-05 17:00:12 +00:00
|
|
|
appendProgramVFEState(hwInfo, kernelExecutionType, additionalExecInfo, &cmd);
|
2020-04-08 18:33:03 +02:00
|
|
|
*pMediaVfeState = cmd;
|
2019-10-01 11:51:31 +02:00
|
|
|
|
2019-08-13 11:34:56 +02:00
|
|
|
return scratchSpaceAddressOffset;
|
2019-05-16 11:43:29 +02:00
|
|
|
}
|
|
|
|
|
|
2019-05-16 17:17:53 +02:00
|
|
|
template <typename GfxFamily>
|
|
|
|
|
size_t PreambleHelper<GfxFamily>::getVFECommandsSize() {
|
|
|
|
|
using MEDIA_VFE_STATE = typename GfxFamily::MEDIA_VFE_STATE;
|
|
|
|
|
return sizeof(MEDIA_VFE_STATE) + sizeof(PIPE_CONTROL);
|
|
|
|
|
}
|
|
|
|
|
|
2019-05-16 11:43:29 +02:00
|
|
|
} // namespace NEO
|