/* * Copyright (C) 2018-2020 Intel Corporation * * SPDX-License-Identifier: MIT * */ #include "shared/source/helpers/flat_batch_buffer_helper.h" #include "shared/source/helpers/hw_helper.h" #include "shared/source/helpers/preamble_base.inl" namespace NEO { template void PreambleHelper::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::registerOffset); pCmd->setDataDword(l3Config); } template uint32_t PreambleHelper::getUrbEntryAllocationSize() { return 0x782; } template uint64_t PreambleHelper::programVFEState(LinearStream *pCommandStream, const HardwareInfo &hwInfo, int scratchSize, uint64_t scratchAddress, uint32_t maxFrontEndThreads, aub_stream::EngineType engineType) { using MEDIA_VFE_STATE = typename GfxFamily::MEDIA_VFE_STATE; addPipeControlBeforeVfeCmd(pCommandStream, &hwInfo, engineType); auto scratchSpaceAddressOffset = static_cast(pCommandStream->getUsed() + MEDIA_VFE_STATE::PATCH_CONSTANTS::SCRATCHSPACEBASEPOINTER_BYTEOFFSET); auto pMediaVfeState = reinterpret_cast(pCommandStream->getSpace(sizeof(MEDIA_VFE_STATE))); *pMediaVfeState = GfxFamily::cmdInitMediaVfeState; pMediaVfeState->setMaximumNumberOfThreads(maxFrontEndThreads); pMediaVfeState->setNumberOfUrbEntries(1); pMediaVfeState->setUrbEntryAllocationSize(PreambleHelper::getUrbEntryAllocationSize()); pMediaVfeState->setPerThreadScratchSpace(Kernel::getScratchSizeValueToProgramMediaVfeState(scratchSize)); pMediaVfeState->setStackSize(Kernel::getScratchSizeValueToProgramMediaVfeState(scratchSize)); uint32_t lowAddress = static_cast(0xFFFFFFFF & scratchAddress); uint32_t highAddress = static_cast(0xFFFFFFFF & (scratchAddress >> 32)); pMediaVfeState->setScratchSpaceBasePointer(lowAddress); pMediaVfeState->setScratchSpaceBasePointerHigh(highAddress); programAdditionalFieldsInVfeState(pMediaVfeState, hwInfo); return scratchSpaceAddressOffset; } template size_t PreambleHelper::getVFECommandsSize() { using MEDIA_VFE_STATE = typename GfxFamily::MEDIA_VFE_STATE; return sizeof(MEDIA_VFE_STATE) + sizeof(PIPE_CONTROL); } } // namespace NEO