2019-05-16 17:43:29 +08:00
|
|
|
/*
|
2020-02-06 23:06:00 +08:00
|
|
|
* Copyright (C) 2018-2020 Intel Corporation
|
2019-05-16 17:43:29 +08:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2020-02-24 05:44:01 +08: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 17:43:29 +08:00
|
|
|
|
|
|
|
namespace NEO {
|
|
|
|
|
|
|
|
template <typename GfxFamily>
|
|
|
|
void PreambleHelper<GfxFamily>::programL3(LinearStream *pCommandStream, uint32_t l3Config) {
|
2020-04-09 00:33:03 +08:00
|
|
|
auto pCmd = pCommandStream->getSpaceForCmd<MI_LOAD_REGISTER_IMM>();
|
|
|
|
MI_LOAD_REGISTER_IMM cmd = GfxFamily::cmdInitLoadRegisterImm;
|
2019-05-16 17:43:29 +08:00
|
|
|
|
2020-04-09 00:33:03 +08:00
|
|
|
cmd.setRegisterOffset(L3CNTLRegisterOffset<GfxFamily>::registerOffset);
|
|
|
|
cmd.setDataDword(l3Config);
|
|
|
|
|
|
|
|
*pCmd = cmd;
|
2019-05-16 17:43:29 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
template <typename GfxFamily>
|
|
|
|
uint32_t PreambleHelper<GfxFamily>::getUrbEntryAllocationSize() {
|
|
|
|
return 0x782;
|
|
|
|
}
|
|
|
|
|
|
|
|
template <typename GfxFamily>
|
2019-08-13 17:34:56 +08:00
|
|
|
uint64_t PreambleHelper<GfxFamily>::programVFEState(LinearStream *pCommandStream,
|
|
|
|
const HardwareInfo &hwInfo,
|
|
|
|
int scratchSize,
|
|
|
|
uint64_t scratchAddress,
|
2020-02-06 23:06:00 +08:00
|
|
|
uint32_t maxFrontEndThreads,
|
|
|
|
aub_stream::EngineType engineType) {
|
2019-05-16 23:17:53 +08:00
|
|
|
using MEDIA_VFE_STATE = typename GfxFamily::MEDIA_VFE_STATE;
|
2019-05-16 17:43:29 +08:00
|
|
|
|
2020-02-06 23:06:00 +08:00
|
|
|
addPipeControlBeforeVfeCmd(pCommandStream, &hwInfo, engineType);
|
2019-05-16 17:43:29 +08:00
|
|
|
|
2019-08-13 17:34:56 +08:00
|
|
|
auto scratchSpaceAddressOffset = static_cast<uint64_t>(pCommandStream->getUsed() + MEDIA_VFE_STATE::PATCH_CONSTANTS::SCRATCHSPACEBASEPOINTER_BYTEOFFSET);
|
2020-04-09 00:33:03 +08: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());
|
|
|
|
cmd.setPerThreadScratchSpace(Kernel::getScratchSizeValueToProgramMediaVfeState(scratchSize));
|
|
|
|
cmd.setStackSize(Kernel::getScratchSizeValueToProgramMediaVfeState(scratchSize));
|
2019-05-16 23:17:53 +08:00
|
|
|
uint32_t lowAddress = static_cast<uint32_t>(0xFFFFFFFF & scratchAddress);
|
|
|
|
uint32_t highAddress = static_cast<uint32_t>(0xFFFFFFFF & (scratchAddress >> 32));
|
2020-04-09 00:33:03 +08:00
|
|
|
cmd.setScratchSpaceBasePointer(lowAddress);
|
|
|
|
cmd.setScratchSpaceBasePointerHigh(highAddress);
|
2019-08-13 17:34:56 +08:00
|
|
|
|
2020-04-09 00:33:03 +08:00
|
|
|
programAdditionalFieldsInVfeState(&cmd, hwInfo);
|
|
|
|
*pMediaVfeState = cmd;
|
2019-10-01 17:51:31 +08:00
|
|
|
|
2019-08-13 17:34:56 +08:00
|
|
|
return scratchSpaceAddressOffset;
|
2019-05-16 17:43:29 +08:00
|
|
|
}
|
|
|
|
|
2019-05-16 23:17:53 +08: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 17:43:29 +08:00
|
|
|
} // namespace NEO
|