| 1 |
/* |
| 2 |
* Copyright (C) 2020-2025 Intel Corporation |
| 3 |
* |
| 4 |
* SPDX-License-Identifier: MIT |
| 5 |
* |
| 6 |
*/ |
| 7 |
|
| 8 |
#pragma once |
| 9 |
#include "shared/source/direct_submission/direct_submission_hw.h" |
| 10 |
#include "shared/source/os_interface/windows/windows_defs.h" |
| 11 |
|
| 12 |
struct COMMAND_BUFFER_HEADER_REC; // NOLINT(readability-identifier-naming), forward declaration from sharedata_wrapper.h |
| 13 |
typedef struct COMMAND_BUFFER_HEADER_REC COMMAND_BUFFER_HEADER; |
| 14 |
|
| 15 |
namespace NEO { |
| 16 |
|
| 17 |
class OsContextWin; |
| 18 |
class Wddm; |
| 19 |
|
| 20 |
template <typename GfxFamily, typename Dispatcher> |
| 21 |
class WddmDirectSubmission : public DirectSubmissionHw<GfxFamily, Dispatcher> { |
| 22 |
public: |
| 23 |
WddmDirectSubmission(const DirectSubmissionInputParams &inputParams); |
| 24 |
|
| 25 |
~WddmDirectSubmission() override; |
| 26 |
|
| 27 |
void flushMonitorFence(bool notifyKmd) override; |
| 28 |
void unblockPagingFenceSemaphore(uint64_t pagingFenceValue) override; |
| 29 |
|
| 30 |
protected: |
| 31 |
bool allocateOsResources() override; |
| 32 |
bool submit(uint64_t gpuAddress, size_t size, const ResidencyContainer *allocationsForResidency) override; |
| 33 |
|
| 34 |
bool handleResidency() override; |
| 35 |
void handleCompletionFence(uint64_t completionValue, MonitoredFence &fence); |
| 36 |
void ensureRingCompletion() override; |
| 37 |
void handleSwitchRingBuffers(ResidencyContainer *allocationsForResidency) override; |
| 38 |
void handleStopRingBuffer() override; |
| 39 |
uint64_t updateTagValue(bool requireMonitorFence) override; |
| 40 |
bool dispatchMonitorFenceRequired(bool requireMonitorFence) override; |
| 41 |
MOCKABLE_VIRTUAL uint64_t updateTagValueImpl(uint32_t completionBufferIndex); |
| 42 |
MOCKABLE_VIRTUAL void updateTagValueImplForSwitchRingBuffer(uint32_t completionBufferIndex); |
| 43 |
void getTagAddressValue(TagData &tagData) override; |
| 44 |
void getTagAddressValueForRingSwitch(TagData &tagData) override; |
| 45 |
bool isCompleted(uint32_t ringBufferIndex) override; |
| 46 |
MOCKABLE_VIRTUAL void updateMonitorFenceValueForResidencyList(ResidencyContainer *allocationsForResidency); |
| 47 |
void makeGlobalFenceAlwaysResident() override; |
| 48 |
void dispatchStopRingBufferSection() override; |
| 49 |
size_t dispatchStopRingBufferSectionSize() override; |
| 50 |
|
| 51 |
TagData ringBufferEndCompletionTagData{}; |
| 52 |
OsContextWin *osContextWin; |
| 53 |
Wddm *wddm; |
| 54 |
MonitoredFence ringFence; |
| 55 |
std::unique_ptr<COMMAND_BUFFER_HEADER> commandBufferHeader; |
| 56 |
}; |
| 57 |
} // namespace NEO |