/* * Copyright (C) 2020-2023 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/gfx_core_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 RootDeviceEnvironment &rootDeviceEnvironment, bool useNotifyEnable, bool partitionedWorkload, bool dcFlushRequired) { PipeControlArgs args; args.dcFlushEnable = dcFlushRequired; args.workloadPartitionOffset = partitionedWorkload; args.notifyEnable = useNotifyEnable; args.tlbInvalidation = true; args.textureCacheInvalidationEnable = true; MemorySynchronizationCommands::addBarrierWithPostSyncOperation( cmdBuffer, PostSyncMode::ImmediateData, gpuAddress, immediateData, rootDeviceEnvironment, args); } template inline size_t RenderDispatcher::getSizeMonitorFence(const RootDeviceEnvironment &rootDeviceEnvironment) { return MemorySynchronizationCommands::getSizeForBarrierWithPostSyncOperation(rootDeviceEnvironment, false); } template inline void RenderDispatcher::dispatchCacheFlush(LinearStream &cmdBuffer, const RootDeviceEnvironment &rootDeviceEnvironment, uint64_t address) { MemorySynchronizationCommands::addFullCacheFlush(cmdBuffer, rootDeviceEnvironment); } template inline void RenderDispatcher::dispatchTlbFlush(LinearStream &cmdBuffer, uint64_t address, const RootDeviceEnvironment &rootDeviceEnvironment) { PipeControlArgs args; args.tlbInvalidation = true; args.pipeControlFlushEnable = true; args.textureCacheInvalidationEnable = true; MemorySynchronizationCommands::addSingleBarrier(cmdBuffer, args); } template inline size_t RenderDispatcher::getSizeCacheFlush(const RootDeviceEnvironment &rootDeviceEnvironment) { size_t size = MemorySynchronizationCommands::getSizeForFullCacheFlush(); return size; } template inline size_t RenderDispatcher::getSizeTlbFlush(const RootDeviceEnvironment &rootDeviceEnvironment) { return MemorySynchronizationCommands::getSizeForSingleBarrier(true); } } // namespace NEO