2019-05-16 17:43:29 +08:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2018-2019 Intel Corporation
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2019-05-16 23:17:53 +08:00
|
|
|
#include "runtime/helpers/hw_helper.h"
|
2019-05-16 17:43:29 +08:00
|
|
|
#include "runtime/helpers/preamble_base.inl"
|
|
|
|
|
|
|
|
namespace NEO {
|
|
|
|
|
|
|
|
template <typename GfxFamily>
|
|
|
|
void PreambleHelper<GfxFamily>::programL3(LinearStream *pCommandStream, uint32_t l3Config) {
|
|
|
|
auto pCmd = (MI_LOAD_REGISTER_IMM *)pCommandStream->getSpace(sizeof(MI_LOAD_REGISTER_IMM));
|
|
|
|
*pCmd = GfxFamily::cmdInitLoadRegisterImm;
|
|
|
|
|
|
|
|
pCmd->setRegisterOffset(L3CNTLRegisterOffset<GfxFamily>::registerOffset);
|
|
|
|
pCmd->setDataDword(l3Config);
|
|
|
|
}
|
|
|
|
|
|
|
|
template <typename GfxFamily>
|
|
|
|
uint32_t PreambleHelper<GfxFamily>::getUrbEntryAllocationSize() {
|
|
|
|
return 0x782;
|
|
|
|
}
|
|
|
|
|
|
|
|
template <typename GfxFamily>
|
2019-05-29 21:37:54 +08:00
|
|
|
void PreambleHelper<GfxFamily>::programVFEState(LinearStream *pCommandStream,
|
|
|
|
const HardwareInfo &hwInfo,
|
|
|
|
int scratchSize,
|
|
|
|
uint64_t scratchAddress,
|
|
|
|
uint32_t maxFrontEndThreads) {
|
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
|
|
|
|
|
|
|
addPipeControlBeforeVfeCmd(pCommandStream, &hwInfo);
|
|
|
|
|
2019-05-16 23:17:53 +08:00
|
|
|
auto pMediaVfeState = reinterpret_cast<MEDIA_VFE_STATE *>(pCommandStream->getSpace(sizeof(MEDIA_VFE_STATE)));
|
2019-05-16 17:43:29 +08:00
|
|
|
*pMediaVfeState = GfxFamily::cmdInitMediaVfeState;
|
2019-05-29 21:37:54 +08:00
|
|
|
pMediaVfeState->setMaximumNumberOfThreads(maxFrontEndThreads);
|
2019-05-16 17:43:29 +08:00
|
|
|
pMediaVfeState->setNumberOfUrbEntries(1);
|
|
|
|
pMediaVfeState->setUrbEntryAllocationSize(PreambleHelper<GfxFamily>::getUrbEntryAllocationSize());
|
|
|
|
pMediaVfeState->setPerThreadScratchSpace(Kernel::getScratchSizeValueToProgramMediaVfeState(scratchSize));
|
|
|
|
pMediaVfeState->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));
|
2019-05-16 17:43:29 +08:00
|
|
|
pMediaVfeState->setScratchSpaceBasePointer(lowAddress);
|
|
|
|
pMediaVfeState->setScratchSpaceBasePointerHigh(highAddress);
|
|
|
|
}
|
|
|
|
|
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
|