2019-05-16 17:43:29 +08:00
|
|
|
/*
|
2024-01-04 18:27:27 +08:00
|
|
|
* Copyright (C) 2019-2024 Intel Corporation
|
2019-05-16 17:43:29 +08:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2021-05-18 10:46:21 +08:00
|
|
|
#include "shared/source/command_stream/stream_properties.h"
|
2020-02-24 05:44:01 +08:00
|
|
|
#include "shared/source/helpers/flat_batch_buffer_helper.h"
|
|
|
|
#include "shared/source/helpers/preamble_base.inl"
|
2021-09-25 00:40:29 +08:00
|
|
|
#include "shared/source/kernel/kernel_execution_type.h"
|
2020-11-17 18:42:29 +08:00
|
|
|
|
2019-05-16 17:43:29 +08:00
|
|
|
namespace NEO {
|
|
|
|
|
|
|
|
template <typename GfxFamily>
|
|
|
|
void PreambleHelper<GfxFamily>::programL3(LinearStream *pCommandStream, uint32_t l3Config) {
|
2020-10-06 16:58:18 +08:00
|
|
|
LriHelper<GfxFamily>::program(pCommandStream,
|
|
|
|
L3CNTLRegisterOffset<GfxFamily>::registerOffset,
|
|
|
|
l3Config,
|
|
|
|
false);
|
2019-05-16 17:43:29 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
template <typename GfxFamily>
|
|
|
|
uint32_t PreambleHelper<GfxFamily>::getUrbEntryAllocationSize() {
|
|
|
|
return 0x782;
|
|
|
|
}
|
|
|
|
|
|
|
|
template <typename GfxFamily>
|
2021-04-02 02:26:29 +08:00
|
|
|
void *PreambleHelper<GfxFamily>::getSpaceForVfeState(LinearStream *pCommandStream,
|
|
|
|
const HardwareInfo &hwInfo,
|
|
|
|
EngineGroupType engineGroupType) {
|
2019-05-16 23:17:53 +08:00
|
|
|
using MEDIA_VFE_STATE = typename GfxFamily::MEDIA_VFE_STATE;
|
2021-03-31 22:11:31 +08:00
|
|
|
addPipeControlBeforeVfeCmd(pCommandStream, &hwInfo, engineGroupType);
|
2021-04-02 02:26:29 +08:00
|
|
|
return pCommandStream->getSpaceForCmd<MEDIA_VFE_STATE>();
|
|
|
|
}
|
2019-05-16 17:43:29 +08:00
|
|
|
|
2021-04-02 02:26:29 +08:00
|
|
|
template <typename GfxFamily>
|
|
|
|
void PreambleHelper<GfxFamily>::programVfeState(void *pVfeState,
|
2022-12-20 23:56:50 +08:00
|
|
|
const RootDeviceEnvironment &rootDeviceEnvironment,
|
2021-04-02 02:26:29 +08:00
|
|
|
uint32_t scratchSize,
|
|
|
|
uint64_t scratchAddress,
|
|
|
|
uint32_t maxFrontEndThreads,
|
2023-09-13 01:51:43 +08:00
|
|
|
const StreamProperties &streamProperties) {
|
2021-04-02 02:26:29 +08:00
|
|
|
using MEDIA_VFE_STATE = typename GfxFamily::MEDIA_VFE_STATE;
|
|
|
|
|
|
|
|
auto pMediaVfeState = reinterpret_cast<MEDIA_VFE_STATE *>(pVfeState);
|
2020-04-09 00:33:03 +08:00
|
|
|
MEDIA_VFE_STATE cmd = GfxFamily::cmdInitMediaVfeState;
|
|
|
|
cmd.setMaximumNumberOfThreads(maxFrontEndThreads);
|
|
|
|
cmd.setNumberOfUrbEntries(1);
|
|
|
|
cmd.setUrbEntryAllocationSize(PreambleHelper<GfxFamily>::getUrbEntryAllocationSize());
|
2020-10-06 17:54:04 +08:00
|
|
|
cmd.setPerThreadScratchSpace(PreambleHelper<GfxFamily>::getScratchSizeValueToProgramMediaVfeState(scratchSize));
|
|
|
|
cmd.setStackSize(PreambleHelper<GfxFamily>::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
|
|
|
|
2022-12-20 23:56:50 +08:00
|
|
|
appendProgramVFEState(rootDeviceEnvironment, streamProperties, &cmd);
|
2020-04-09 00:33:03 +08:00
|
|
|
*pMediaVfeState = cmd;
|
2021-03-31 22:11:31 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
template <typename GfxFamily>
|
|
|
|
uint64_t PreambleHelper<GfxFamily>::getScratchSpaceAddressOffsetForVfeState(LinearStream *pCommandStream, void *pVfeState) {
|
|
|
|
using MEDIA_VFE_STATE = typename GfxFamily::MEDIA_VFE_STATE;
|
|
|
|
return static_cast<uint64_t>(reinterpret_cast<uintptr_t>(pVfeState) -
|
|
|
|
reinterpret_cast<uintptr_t>(pCommandStream->getCpuBase()) +
|
|
|
|
MEDIA_VFE_STATE::PATCH_CONSTANTS::SCRATCHSPACEBASEPOINTER_BYTEOFFSET);
|
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);
|
|
|
|
}
|
|
|
|
|
2023-10-20 06:32:43 +08:00
|
|
|
template <typename GfxFamily>
|
|
|
|
void PreambleHelper<GfxFamily>::appendProgramVFEState(const RootDeviceEnvironment &rootDeviceEnvironment, const StreamProperties &streamProperties, void *cmd) {}
|
|
|
|
|
|
|
|
template <typename GfxFamily>
|
|
|
|
size_t PreambleHelper<GfxFamily>::getCmdSizeForPipelineSelect(const RootDeviceEnvironment &rootDeviceEnvironment) {
|
|
|
|
using PIPELINE_SELECT = typename GfxFamily::PIPELINE_SELECT;
|
|
|
|
return sizeof(PIPELINE_SELECT);
|
|
|
|
}
|
|
|
|
|
2024-01-04 18:27:27 +08:00
|
|
|
template <typename GfxFamily>
|
|
|
|
void PreambleHelper<GfxFamily>::setSingleSliceDispatchMode(void *cmd, bool enable) {
|
|
|
|
}
|
|
|
|
|
2019-05-16 17:43:29 +08:00
|
|
|
} // namespace NEO
|