/* * Copyright (C) 2020-2021 Intel Corporation * * SPDX-License-Identifier: MIT * */ #include "shared/source/command_stream/linear_stream.h" #include "shared/source/command_stream/preemption.h" #include "shared/source/direct_submission/dispatchers/render_dispatcher.h" #include "shared/source/helpers/hw_helper.h" #include "shared/source/helpers/pipe_control_args.h" namespace NEO { template inline void RenderDispatcher::dispatchPreemption(LinearStream &cmdBuffer) { PreemptionHelper::programCmdStream(cmdBuffer, PreemptionMode::MidBatch, PreemptionMode::Disabled, nullptr); } template inline size_t RenderDispatcher::getSizePreemption() { size_t size = PreemptionHelper::getRequiredCmdStreamSize(PreemptionMode::MidBatch, PreemptionMode::Disabled); return size; } template inline void RenderDispatcher::dispatchMonitorFence(LinearStream &cmdBuffer, uint64_t gpuAddress, uint64_t immediateData, const HardwareInfo &hwInfo, bool useNotifyEnable, bool partitionedWorkload) { using POST_SYNC_OPERATION = typename GfxFamily::PIPE_CONTROL::POST_SYNC_OPERATION; PipeControlArgs args; args.dcFlushEnable = MemorySynchronizationCommands::isDcFlushAllowed(true, hwInfo); args.workloadPartitionOffset = partitionedWorkload; args.notifyEnable = useNotifyEnable; MemorySynchronizationCommands::addPipeControlAndProgramPostSyncOperation( cmdBuffer, POST_SYNC_OPERATION::POST_SYNC_OPERATION_WRITE_IMMEDIATE_DATA, gpuAddress, immediateData, hwInfo, args); } template inline size_t RenderDispatcher::getSizeMonitorFence(const HardwareInfo &hwInfo) { size_t size = MemorySynchronizationCommands::getSizeForPipeControlWithPostSyncOperation(hwInfo); return size; } template inline void RenderDispatcher::dispatchCacheFlush(LinearStream &cmdBuffer, const HardwareInfo &hwInfo, uint64_t address) { MemorySynchronizationCommands::addFullCacheFlush(cmdBuffer, hwInfo); } template inline void RenderDispatcher::dispatchTlbFlush(LinearStream &cmdBuffer, uint64_t address, const HardwareInfo &hwInfo) { PipeControlArgs args; args.tlbInvalidation = true; args.pipeControlFlushEnable = true; args.textureCacheInvalidationEnable = true; MemorySynchronizationCommands::addPipeControl(cmdBuffer, args); } template inline size_t RenderDispatcher::getSizeCacheFlush(const HardwareInfo &hwInfo) { size_t size = MemorySynchronizationCommands::getSizeForFullCacheFlush(); return size; } template inline size_t RenderDispatcher::getSizeTlbFlush() { return MemorySynchronizationCommands::getSizeForSinglePipeControl(); } } // namespace NEO